PDA

View Full Version : Develop Chart Theme



mgtneven
27 Dec 2011, 12:25 AM
Hi all!

I need to develop general theme to use in several types of charts (pie, column, etc.).

The ptoblem is that I need to change the colors of the series- based on the number of series I have in the chart in real-time.

Colors for chart series is determined by the chart base color provided in the theme defaults. Default base color is then used to calculate the colors for other series as needed. These calculations are based on dividing the hue value by the number of series colors needed. Saturation and lightness values are not changed.

My base color is: HSL: Hue=210deg; Saturation=43%; Lightness=55% , HEX: # 5588BB

For multi series charts the hue value (0 360 deg) will be divided by the number of required series distributing the colors across the spectrum.

For example:

3 series chart: 360/3=120, so:
base heu is: 210deg.
slice 2: H210+120deg= H300.
slice 3: H300+120deg=H90.

7 series chart: 360/7=~52, so:
base heu is: 210deg.
slice 2:H210+52deg=H262.
slice 2:H262+52deg=H314.
slice 2:H314+52deg=H6.
slice 2:H6+52deg=H58.
slice 2:H58+52deg=H110.
slice 2:H110+52deg=H162.

and so on...

It is not simple, I know.

Any idea? it will be helpful!!!

Many thanks.

mitchellsimoens
27 Dec 2011, 7:17 AM
In the constructor, if you can get the chart's number of series then you can set what you want or you can pass int he number of series. Not sure if you can do it dynamically like you want... haven't seen it done before.