Hi
I need to make area chart with gradient look and feel as shown in the image url below:
http://www.raunakkathuria.com/images/jf ... achart.jpg
Currently what I have made looks like this
http://www.raunakkathuria.com/images/jf ... actual.jpg
I need to have gradient look and feel inside the chart area.
Information : Chart Type: XYAreaChart, Plot: XYPlot, Domain Axis: DateAxis
Thanks
Gradient Look For AreaChart
-
- Posts: 16
- Joined: Wed Dec 22, 2010 5:35 pm
- antibot: No, of course not.
- Location: India
- Contact:
Gradient Look For AreaChart
Raunak Kathuria
Re: Gradient Look For AreaChart
Hi,
I'm still learning JFreechart so my answer might not be the right solution.
You can set the Paint used by the renderer as follows:
where:
seriesIndex: the index of the series you want to set the paint
paint: use GradientPaint class for a gradient fill
The problem with this approach is that you must set the startingY and endingY for the gradient and if the Plot is resized afterwards then you might need to create a new GradientPaint.
You also have the option of extending XYAreaRenderer to make it render the way you like it.
With regards,
Luis Fernando
I'm still learning JFreechart so my answer might not be the right solution.
You can set the Paint used by the renderer as follows:
Code: Select all
XYItemRenderer renderer = plot.getRenderer();
renderer.setSeriesPaint(seriesIndex, paint);
seriesIndex: the index of the series you want to set the paint
paint: use GradientPaint class for a gradient fill
The problem with this approach is that you must set the startingY and endingY for the gradient and if the Plot is resized afterwards then you might need to create a new GradientPaint.
You also have the option of extending XYAreaRenderer to make it render the way you like it.
With regards,
Luis Fernando