The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I'm creating custom pie chart so in that i have to add slice color change functionality.
I have prepared default color array for the categories and creating slice for formate penal.
Below is the code which i have added in setting.ts file
sliceSettings.sliceDropdownItems.forEach((item, idx) => {
slices.push({
uid: `slice_color_uid_${item.value}`,
displayName: `${item.displayName} Color`,
control: {
type: powerbi.visuals.FormattingComponent.ColorPicker,
properties: {
descriptor: {
objectName: 'slices',
propertyName: 'sliceColor',
},
value: {
value: sliceSettings.sliceColorArray?.[idx] || ''
}
}
},
disabled: false
});
});
but when I try to change the color I'm not able the get that changed color details so Please help me on that
capabilities.json
"slices": {
"displayName": "Slices",
"properties": {
"selectedSlice": {
"displayName": "Selected Slice",
"type": { "enumeration": [] }
},
"sliceColor": {
"displayName": "Slice Color",
"type": { "fill": { "solid": { "color": true } } }
}
}
},
I think, I have to set dynamic properties based on categories but I'm not able to find any solution to set dynamic properties.
Solved! Go to Solution.
Hi @NileshBhayani ,
Thanks for reaching out to the Microsoft fabric community forum.
In the current setup, the capabilities.json file defines a single sliceColor property under the slices object, which applies uniformly rather than on a per-category basis. This structure lacks the flexibility to store and retrieve distinct formatting settings for each slice. As a result, while colour pickers may appear in the formatting pane, the visual cannot persist or retrieve category-specific colour selections at runtime. To enable this level of customization, we must shift from static to data-bound object properties, which allow Power BI to associate formatting settings dynamically with each data point in the visual.
Reference: GitHub - microsoft/powerbi-visuals-utils-formattingmodel: powerbi visuals formatting model helper ut...
If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thank you
Hi @NileshBhayani ,
Thanks for reaching out to the Microsoft fabric community forum.
In the current setup, the capabilities.json file defines a single sliceColor property under the slices object, which applies uniformly rather than on a per-category basis. This structure lacks the flexibility to store and retrieve distinct formatting settings for each slice. As a result, while colour pickers may appear in the formatting pane, the visual cannot persist or retrieve category-specific colour selections at runtime. To enable this level of customization, we must shift from static to data-bound object properties, which allow Power BI to associate formatting settings dynamically with each data point in the visual.
Reference: GitHub - microsoft/powerbi-visuals-utils-formattingmodel: powerbi visuals formatting model helper ut...
If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thank you
User | Count |
---|---|
80 | |
78 | |
37 | |
34 | |
31 |
User | Count |
---|---|
93 | |
81 | |
60 | |
49 | |
49 |