|
Box-Whisker chart with gradient fill |
Posted by Dave Pick on Mar-03-2012 00:58 |
|
Hi,
Is there a way to apply a gradient fill to a box in a Box-Whisker chart, more specifically a floating box chart?
Many Thanks
Dave |
Re: Box-Whisker chart with gradient fill |
Posted by Peter Kwan on Mar-06-2012 00:50 |
|
Hi Dave,
Yes. There are many methods depending on the type of gradient you want. If you want to use a global gradient color (eg. the fill color varies depending on the vertical position relative to the plot area), you may use a normal gradient color as the fill color. For example:
int myFillColor = c.linearGradientColor(0, c.getPlotArea().getTopY(), 0, c.getPlotArea().getTopY() + c.getPlotArea().getHeight, 0xccccff, 0x000088);
BoxWhiskerLayer layer = c.addBoxLayer(topData, bottomData, myFillColor);
The BoxWhiskerLayer also supports "Soft lighting" and "Glass lighting" shading method used in bar charts. See the "Soft Bar Shading" and "Glass Bar Shading" sample code for an example. (The setBorderColor method use to enable these effects also works for the BoxWhiskerLayer.)
The bar chart layer also supports a "Bar lighting" method (see the "Gradient Bar Shading" sample code). This effect is not supported by the BoxWhiskerLayer, but you can use a BarLayer to create a floating box chart too. So you can still have floating boxes with this effect. To create a floating box chart with a BarLayer, you may use a Stacked Bar Chart, and set the bottom stack fill color to Chart.Transparent, and the border color to Chart.Transparent too.
Hope this can help.
Regards
Peter Kwan |
|