|
Generate the same chart with diferents colors |
Posted by Erick on Apr-04-2012 02:53 |
|
Hi Peter,
I need to made exactly the same chart (pie, line, bar, scatter, area, multi type charts) with diferents colors for each layer several times. The values remain the same, only change the the data layers colors.
The problem is when I use $c->makeChart function, I can't longer change any color of the data layers.
Actually I'm creating a new chart object and passing a new set of colors each time, but this is very inefficient process since I already have all data set on my chart.
Is there any way to do this without having to create a new Chart object?
Thanks |
Re: Generate the same chart with diferents colors |
Posted by Peter Kwan on Apr-05-2012 00:39 |
|
Hi Erick,
Whereas you must create a new XYChart object to change a chart if you have already output the chart, the process is not inefficient.
If you actually measure the CPU time required setting up the chart, you will find that the CPU time used is negligible when compared to the time used to actually render the chart. For the CPU time required to generate a chart, the $c->makeChart line probably takes over 95%, while all other methods combined (such as setting up the data sets) takes less than 5%. In other words, creating a new XYChart should not cause inefficiency because it takes negligible CPU time compared to actually rendering the chart with $c->makeChart (you need to call $c->makeChart anyway if you need to output multiple charts - even just the colors are different - so this call cannot be avoided).
Regards
Peter Kwan |
|