Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I am just trying to be consistent with synchronizing the colors of data points from my custom visual with the other 'out of the box' pbi visuals. I am using the code snippet from the documentation to assign colors to my data points:
let colorPalette: IColorPalette = host.colorPalette; // host: IVisualHost for (let i = 0, len = Math.max(category.values.length, dataValue.values.length); i < len; i++) { barChartDataPoints.push({ category: category.values[i], value: dataValue.values[i], color: colorPalette.getColor(category.values[i]).value, }); }
Some of the time the data points from my visual are the same as other visuals and other times they are not.
My question is, does all the visuals in the pbi dashboard pull from the same host.colorPalette object? If so what determines which hex color gets assigned to each data point in the object? Why are the colors assigned to my data points in the colorPalette object different from other visuals that are displaying the same data points. Is there a way from your data points to always get assigned the same colors as others visuals. I have read the documentation https://microsoft.github.io/PowerBI-visuals/docs/how-to-guide/adding-colors-to-your-visual/
Thanks!
Matt
Even I am having the same issue. When increasing the data with slicer the colors are getting repeated.
User | Count |
---|---|
15 | |
4 | |
2 | |
1 | |
1 |
User | Count |
---|---|
21 | |
3 | |
2 | |
2 | |
2 |