Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi!
I have my data bound as a table, and I want to color each row of data differently.
I got each row to display in the "format" but I don't know how to load a change in the format data as I don't know where it's bound to in the dataView object. My enumerateObjectInstances code is below for the rows.
public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
let objectName = options.objectName;
let objectEnumeration: VisualObjectInstance[] = [];
if (!this.barSettings ||
!this.barLabelSetting) {
return objectEnumeration;
}
switch (objectName) {
case 'colorSelector':
for (let labelColor in this.barLabelSetting) {
objectEnumeration.push({
objectName: objectName,
displayName: this.barLabelSetting[labelColor].name,
properties: {
fill: {
solid: {
color: this.barLabelSetting[labelColor].color
}
}
},
selector: this.barLabelSetting[labelColor].selectionId.getSelector()
});
}
break;
Does anyone know where to find it? Or should I be doing a different selector binding?
Regards,
Jerome
Solved! Go to Solution.
In case any one else has this problem, I found a solution. But it's kinda roundabout. But it does work as long as your intent is not to color every row, but to color each "group" of rows having the same kind of identity, in the same way. That was my original intent, anyway.
I realised that for table mappings, conditional formattings doesn't work, and this probably extends to this sort of colour mappings for each row. What I did then was to add an additional (that's right there are two mappings in the capabilities.json) dataViewMappings for categorical to get that categorical object. The first GOTCHA is that even though I was only using one of the data columns, I still needed to add in all the selects for all the data that I was using otherwise the table mapping doesn't work properly. The second GOTCHA is that since i'm not drawing the objects based on this category, but for each row, a reverse lookup is required to retrieve the value index of the category. This is to create a second set of SelectionIds for the categories that you can bind to the selector in the enumerateObjectInstances function above. And voilà! you get the objects properly created in the dataView object to retreive the colour details.
Hope this helps someone else.
In case any one else has this problem, I found a solution. But it's kinda roundabout. But it does work as long as your intent is not to color every row, but to color each "group" of rows having the same kind of identity, in the same way. That was my original intent, anyway.
I realised that for table mappings, conditional formattings doesn't work, and this probably extends to this sort of colour mappings for each row. What I did then was to add an additional (that's right there are two mappings in the capabilities.json) dataViewMappings for categorical to get that categorical object. The first GOTCHA is that even though I was only using one of the data columns, I still needed to add in all the selects for all the data that I was using otherwise the table mapping doesn't work properly. The second GOTCHA is that since i'm not drawing the objects based on this category, but for each row, a reverse lookup is required to retrieve the value index of the category. This is to create a second set of SelectionIds for the categories that you can bind to the selector in the enumerateObjectInstances function above. And voilà! you get the objects properly created in the dataView object to retreive the colour details.
Hope this helps someone else.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 |