Forum Discussion

mroot's avatar
mroot
Frequent Visitor
6 years ago
Solved

ISelectionIds getting reassigned

I am assigning selectionIds to my data points with the following loop:

 

let dataViews = options.dataViews //options: VisualUpdateOptions
let categorical = dataViews[0].categorical;
let dataValues = categorical.values;

for(let dataValue of dataValues) {
    let values = dataValue.values;
    for(let i = 0, len = dataValue.values.length; i < len; i++) {
        let selectionId = host.createSelectionIdBuilder()
            .withCategory(categorical.categories[0], i)
            .withMeasure(dataValue.source.queryName)
            .withSeries(categorical.values, categorical.values[i])
            .createSelectionId();
    }
}

 

In a powerBi report when I select a data point from another visual the update method is called on my custom visual class.  It appears to me that my dataView gets filter to only include that selected data point I clicked from the other visual.  What also seems to happen is that the data points from the other visuals are given new selectionIds.  But I am only given one of the data points to reassign. How do I keep the selection Ids from all my data points (not just the data point that has been selected from another visual) in sync with other visuals when there has been a selection?

 

Thanks!

 

Matt