JFreechart, line chart with filled areas

I am trying to create a diagram like below:

Sample Chart - Requirement

While I've achieved almost everything by just creating a line chart and adjusting the shape / paint for the Renderer, I can't seem to find a way to fill in the areas below the ruler.

Any hints how can I do this?

+3


source to share


1 answer


You can create your chart with StackedXYAreaRenderer

. Set AREA_AND_SHAPES

in constructor and include paths. For an example see Code ChartFactory

for createStackedXYAreaChart()

.

StackedXYAreaRenderer r = new StackedXYAreaRenderer(XYAreaRenderer.AREA_AND_SHAPES);
r.setOutline(true);

      



For the renderer, you can adjust the paint and stroke of the outline as desired.

+3


source







All Articles