Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi all,
I'm currently working on my line chart project with pbi custom visual. Then I stumble upon some problem with customizable line color.
I add color option like this in capabilities.json
and update options according to the data with getFormattingModel()
public getFormattingModel(): powerbiVisualsApi.visuals.FormattingModel {
const colorSelectorCard: powerbi.visuals.FormattingCard = {
displayName: "Data Colors",
uid: "dataColorsCard_uid",
groups: [
{
displayName: undefined,
uid: "dataColorsCard_group_uid",
slices: [],
}
]
};
if (this.lineDataPoint.length) {
this.lineDataPoint.forEach((dataPoint, idx) => {
(<powerbi.visuals.FormattingGroup>colorSelectorCard.groups[0]).slices.push(
{
uid: `dataColorsCard_group_colorSelector${idx}_uid`,
displayName: dataPoint.category,
control: {
type: powerbi.visuals.FormattingComponent.ColorPicker,
properties: {
descriptor: {
objectName: "colorSelector",
propertyName: "fill",
selector: dataViewWildcard.createDataViewWildcardSelector(dataViewWildcard.DataViewWildcardMatchingOption.InstancesAndTotals),
altConstantValueSelector: dataPoint.selectionId.getSelector(),
instanceKind: powerbi.VisualEnumerationInstanceKinds.ConstantOrRule
},
value: { value: dataPoint.color }
}
}
});
});
colorSelectorCard.revertToDefaultDescriptors = [
{
objectName: "colorSelector",
propertyName: "fill",
}
];
}
return { cards: [ colorSelectorCard ] }
}
Options is appear and adjustable as expect (I put in 2 line data).
Nevetheless, the output objects from dataViews[0].categorical.categories[0] is appear to be in the length of value in categories instead of number of line data (660 instead of 2).
This could probably lead to some bug in the future, so I want some help on how to shape the objects data to be equal to number of input line data not the categories length.
Thanks
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 8 | |
| 8 | |
| 4 | |
| 3 | |
| 2 |