|
"Axis.Addzone", any way to apply color shading? |
Posted by Daniel on Apr-02-2013 16:28 |
|
Hi,
I am trying to spruce up and existing plot and use shaded colors instead of plain ones.
When it comes to axis banding, I have found no way to do it in a simple manner to do it.
I resorted to the base drawarea.rect() function to implement an horizontal shaded band (after drawing). And liked it (see the difference!). Not really easy. Any simpler alternative?
Daniel
|
Re: "Axis.Addzone", any way to apply color shading? |
Posted by Peter Kwan on Apr-03-2013 03:22 |
|
Hi Daniel,
You may use BaseChart.linearGradientColor or BaseChart.linearGradientColor2 to create a gradient color, and use it as the color in Axis.addZone.
BaseChart.linearGradientColor and BaseChart.linearGradientColor2 use pixel coordinates to define the gradient. If you would like to use data values to define the gradient, you would need to first call XYChart.layoutAxes to auto-scale the axis (note that you need to enter all your data to the chart first so that the axis scale can reflect your data range), then you may use XYChart.getXCoor and XYChart.getYCoor to convert from data values to pixel coordinates.
Hope this can help.
Regards
Peter Kwan |
Re: "Axis.Addzone", any way to apply color shading? |
Posted by Daniel on Apr-03-2013 16:10 |
|
Thanks Peter,
Since this requires the layoutaxes(), I will have to reorganise the code a tad. But It certainly does help:)
Daniel |
|