Scripting discrete colour rules

Does anyone have a script that can create discrete colour rules and add them to a chart?

what do you mean by discreate colour rules? Can you give an example for it?

Line chart has one measure which is broken out by row into separate series. In the colour setting in the data binding panel, I put the hierarchy name.

I can now add discrete colour rules based on that hierarchy. So I put in the value and the colour for each option in the hierarchy.

Instead of manually adding over 20 per chart, I would like to script this.

Have you exhausted "themes" in your installation? Sounds to me like you're replacing the Dundas defaults (over and over and over).

Can themes be done on a per hierarchy level?

You got me there. In my experience, I wanted the uniform pallette and sequence of how it's applied. When I think in terms of hierarchies, I think of Inventory types versus Locations versus Date/Time. Your process description sounds like you're managing the colour sequence, but that's first-come-first-served in the order of the elements you list. My reply was in the context of default themes for "my instance" and/or "my tenant" (replacing Dundas default). I'm curious how you would apply to a hierarchy, not that I have the answer there.

Hello David,

Actually you don't need any script to do your work.


you can simply save the style of the chart where you define the color rules and then you can apply the style to any other chart.


I have tested it and even if the other charts show the points in different sort order , the color rules will apply to the points based on the values of the hierarchy.


Is this what you are looking for or you have different bussines case?

One more thing,

The style will take effect once you add the same hierarchy to Color section in Data Analysis Panel.


So, Two steps are required : applying the style and puuting the same hierarchy to Color Rule.

Thank Mohammed that sounds like a good solution. I'll try it and see if it works for me

Color Rules, No need to use a script as Dundas BI has almost everything built in without the need of scripting as you can reach whatever customization is required

I can confirm that this solution works

I'll have to disagree with you there Samer.


I don't have the patience to add 30 colour rules to 5 charts. And it is impossible to reach much of the customisation that I need without scripting.

I have changed color rule values. Although I did not add any Black, it shows up in my charts. I can't find a way to get rid of it.

I also wish there was an easier way to create styles and themes! You have to create and test so many styles to create a theme. Replacing colors is a very manual process that takes more time than it should.

Any hierachy members that do not have colour rules will revert to using the chart pallette. If you delete all the chart pallete colours, the black shouldn't show up.


However, this does mean that you may have something in your chart that shouldn't be there.