JFreechart, Line Chart with filled Areas

六眼飞鱼酱① 提交于 2019-12-06 07:19:51

问题


I am trying to create chart like below:

While I've almost achieved everything by simply creating a line chart and customizing shape/paint for Renderer, I can't seem to find a way to fill the areas under the series line.

Any clues, how can I do this?


回答1:


You could create your chart with a StackedXYAreaRenderer. Specify AREA_AND_SHAPES in the constructor and enable outlines. See the ChartFactory code for createStackedXYAreaChart() as an example.

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

Given a renderer, you can set the outline paint and stroke as desired.



来源:https://stackoverflow.com/questions/31166588/jfreechart-line-chart-with-filled-areas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!