|
Question from newbie: How to provide different shade of background in XY chart? |
Posted by cdo2 on May-11-2013 22:25 |
|
I have a need to provide different shade of background in XY chart. For example, the first
1/3 of the chart is of color white, the next 1/3 is of color grey, and the last 1/3 of the
chart is of color white.
I haven't had much experience with DirectorChart but need to modify the current code to
provide this visualization.
Thanks,
CD |
Re: Question from newbie: How to provide different shade of background in XY chart? |
Posted by Peter Kwan on May-14-2013 00:30 |
|
Hi cdo2,
If you would like to color the plot area background based on data values, you may refer to the sample code "Marks and Zones" and "Marks and Zones (2)".
http://www.advsofteng.com/doc/cdphp.htm#markzone.htm
http://www.advsofteng.com/doc/cdphp.htm#markzone2.htm
If you would like to color the chart background based on pixel height (eg. the colors are for decoration purpose and does not reflect data values), you may create an array of colors, where the array length is equal to the height of the chart in pixels. You can then use that array of colors as the background color, like (as I am not sure of your programming langauge, I will use PHP as an example):
$c = new XYChart(....);
$c->setBackground($c->patternColor($myColorArray, $c->getHeight()));
If you configure the color array so that the first 1/3 of the elements are white, the next 1/3 is grey, and the last 1/3 is which, you will get the color you want.
Hope this can help.
Regards
Peter Kwan |
|