Forum Discussion
andrjohns
Helper II
2 years agoConditional Formatting - createDataViewWildcardSelector with Grouped Data
Hi All! I'm having some issues using the recommended `createDataViewWildcardSelector` when implementing conditional formatting for data with groupings. Using the `CircleCard` demo visual (fro...
andrjohns
Helper II
2 years agoFor any that come across this thread in the future, the solution that I found was to use a different kind of 'Wildcard' selector.
I found that the visuals API defined different types of data repetition selectors, specifically a role wildcard
So where the original implementation was:
fontSize = new formattingSettings.NumUpDown({
name: "fontSize",
displayName: "Text Size",
value: 12,
selector: dataViewWildcard.createDataViewWildcardSelector(dataViewWildcard.DataViewWildcardMatchingOption.InstancesAndTotals),
instanceKind: powerbi.VisualEnumerationInstanceKinds.ConstantOrRule
});
I followed the definition for creating the dataview wildcard selector and replaced the selector definition with:
fontSize = new formattingSettings.NumUpDown({
name: "fontSize",
displayName: "Text Size",
value: 12,
selector: { data: [{ roles: ["category"] }] },
instanceKind: powerbi.VisualEnumerationInstanceKinds.ConstantOrRule
});
With this change, the conditional formatting objects were then bound to 'categories' as before, even when a grouping series is used