tags:

views:

24

answers:

1

Hello everyone! 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. something like this (photoshopped): alt text

This is a snippet of my code:

private static JFreeChart 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.

Anyone an idea how I can accomplish that?

+1  A: 

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".

trashgod
Setting it to null instead of 0 totally did it. Thanks man!
tzippy