开发者

jFreeChart: Possible to combine StatisticalBarRenderer and LayeredBarRenderer?

开发者 https://www.devze.com 2023-01-08 07:45 出处:网络
I want to create a chart that consists of couples of two bars. one of them a regular bar, the second one is layered and has a deviation.

I want to create a chart that consists of couples of two bars. one of them a regular bar, the second one is layered and has a deviation.

This is a snippet of my code:

private static J开发者_如何转开发FreeChart createStatisticalBarChart(DefaultStatisticalCategoryDataset dataset, String chartTitle, String domainAxisLabel, String rangeAxisLabel, List<String> sunndayMap) {

    CategoryAxis xAxis = new CategoryAxis(domainAxisLabel);
    ValueAxis yAxis = new NumberAxis(rangeAxisLabel);
    CategoryItemRenderer renderer = new StatisticalBarRenderer();

    CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);


    JFreeChart chart = new JFreeChart(chartTitle,
            new Font("Arial", Font.PLAIN, 10),
            plot,
            true);

My dataset has mean+standarddeviatin records with every second record's deviation being "0", so that no range indicators will be displayed.

How can I accomplish that?


You can use a small negative value in setItemMargin() to achieve an overlap, for example

renderer.setItemMargin(-0.10f);

It appears that standard deviation lines are not drawn if the getStdDevValue() method returns null. You might try that value instead of "0".

0

精彩评论

暂无评论...
验证码 换一张
取 消