Sign in to follow this  
srividya_sharma

Default color list for plot data

Recommended Posts

Is it possible to define the plot colors at the <chart/> level, and not within each <dataset/> element?

If so, this would be a matter of (considerable) convenience for us, since the XML will be generated programatically, and we would like to keep the chart definition separate from the data definition.  I know how to use the 'color' attribute within each <dataset/> to define the color of each plot, and that works file.  What I am asking is whether it is possible to define a list of colors at the <chart/> level, so that the first <dataset/> is assigned the first color, the second <dataset/> is assigned the second color, and so on.

Thanks.

Share this post


Link to post
Share on other sites

Hi

Can you please see if paletteColors attribute of chart tag is what you are looking for?

From the docs:

paletteColors String List of hex color codes separated by comma

While the palette attribute allows to select a palette theme that applies to chart background, canvas, font and tool-tips, it does not change the colors of data items (i.e., column, line, pie etc.). Using paletteColors attribute, you can specify your custom list of hex colors for the data items. The list of colors have to be separated by comma e.g., <chart paletteColors='FF0000,0372AB,FF5904...'>. The chart will cycle through the list of specified colors and then render the data plot accordingly.

To use the same set of colors throughout all your charts in a web application, you can store the list of palette colors in your application globally and then provide the same in each chart XML.

Please refer to documentation page for further details.

Hope this helps. :)

Srividya

Share this post


Link to post
Share on other sites

Sorry, yes, that is what I was looking for!

I did read the on-line doc, but was getting the 'palette' and 'palletColors' attributes confused ... sorry, my bad!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this