I have Pie charts showing Top 5 categories plus Other category, and have defined a custom color palette for this. I then define in the series as follows:
series {
field: VizFieldFull {
label: 'Series'
ref: ref('some_model', 'metric1')
format {
type: 'number'
pattern: 'inherited'
}
}
settings {
color_palette: "Five Plus One"
}
}
My intent is for holistics to automatically assign the first five colours to the Top 5 categories and the last colour to the Other. I am able to set the color_palette value to the default palette names. Can we set the custom palettes as well?
However, our color palette default is created to assign color to categories, not the order of the pie chart. In order to assign the first five colors to the Top 5 categories and the last color to the Other, you have to delete all mapping information in the code:
@Tai_Nguyen I am using code editor in Canvas Dashboards. I do intend to use the color_palette property to set a palette, so the pie automatically sets the colours. However, it does not let me specify a custom palette. I am only able to specify the pre-built ones.
Hi @shahid, Iād like to confirm a couple of points to better assist you:
It seems you already know how to select a color palette for your chart, based on my previous instructions.
Youāre looking to create or modify a custom color palette that can be applied to your chart, rather than relying solely on pre-built palettes.
If thatās correct, you can create or update your own color palette by navigating to āSettings > More Settings >Chart Color Palettes ā in Holistics. For further guidance on this, please refer to our documentation on Color Palettes.
I hope this information is helpful. Please feel free to reach out if you have any further questions or need additional assistance.
@Tai_Nguyen I know how to create custom palettes and I had already created one. I am creating a Canvas Dashboard, using the code editor view, and not visually. In it, I have a Pie Chart visual, with the following series configuration:
The above code works, since ācategoricalā palette is pre-defined. However, the following doesnāt work, since the āFive Plus Oneā palette was created by me. It doesnāt work, even if I define a name without any spaces.
series {
field: VizFieldFull {
label: 'Revenue'
ref: ref('sales', 'revenue')
format {
type: 'number'
pattern: 'inherited'
}
}
settings {
color_palette: 'Five Plus One'
}
}
I get an error:
Incompatible property 'color_palette'.
Type 'String' is not assignable to type 'ColorPalette'
-------------------------------------------------------------------------
Property color_palette (optional): "categorical" | "div-blue-red" | "div-teal-orange" | "seq-blue" | "seq-teal" | "seq-viridis" | "seq-magma"
-------------------------------------------------------------------------
No quick fixes available
Hi @shahidt, Thank you for your reply. After reviewing the details, our team has confirmed that it is indeed a bug on our end. We are actively working on a solution and will keep you updated with any progress.
We apologize for any inconvenience this has caused you and your team, and we appreciate your patience and understanding as we resolve this matter.
Hi @shahidt,
Iām pleased to announce that we have released a patch that fixes the issue with the color palette selector in the Edit Report modal.
Thank you for bringing this to our attention and for your patience. If you have any further questions or need assistance, please donāt hesitate to reach out.
@Tai_Nguyen I was not able to try this sooner, but I still get an error. I created a new palette called āFive-Plus-Oneā and then set it to the color_palette property like this:
It still throws an error saying that String values arenāt allowed. I noticed the property also accepts a number. I tried using numbers between 1 and 8 (number of palettes I have), but they all ended up showing the default palette.
I apologize for the delayed response. I overlooked your message earlier.
Could you please open the edit UI and select Five-Plus-One in the UI? Iāve noticed that the color palette name in the code differs from the label in the Color Palette UI.
@Tai_Nguyen I got around to trying the proposed solution, and the interface left me with a numeric value for the palette. It also worked as expected. Thanks.
@Tai_Nguyen this feature is still very buggy. When I navigate to a different report and come back to the page that has the custom palette, it shows the default palette colours. Then if I click on the cache reset button, it shows the right colours.
Hi @shahidt, thank you for updating/reporting your issue with us. Our engineering team is checking this issue. I will let you know if thereās any update on this issue.
@Tai_Nguyen Unfortunately, it is still buggy. The earlier bug of not using the custom palette is fixed and every time I visit the dashboard, it uses my custom palette. However, the colour assignment is now incorrect.
It actually used to work well before the latest changes. In my custom palette, I have defined five shades of green and then one orange. The expectation is to use the five shades of green for each of the pie slices, where I am showing Top 5 labels and a sixth slice for āOthersā.
When I first chose the custom palette in the Edit view, it used to assign the six colours to all the possible dimension values, and not just the Top Five plus Others. However, after saving and when it only showed the Top five label, it used to properly assign five shades of green to the Top 5 labels and then the orange to Other.
Based on the picture below, it seems to first assign colour to all labels and then chose the Top 5 from there. Ideally it should first choose the top five dimensions and then just assign colours.
@Tai_Nguyen please see the attached image for palette definition and expectation. Earlier, the āHow it should workā part was what I got, but after the latest changes, I donāt get that anymore.
@Tai_Nguyen I just noticed that the feature where any paletteās sequentially defined colours were being used on the slicers that were visible after any filters are now not working, even in legacy dashboards and default palettes.
After investigating, weāve confirmed this is a valid issue and are working on a fix. It looks like we overlooked the āGroup small values of Legend into āOtherāā option when handling color assignments.
Thanks so much for reporting it ā weāll keep you informed on the progress!