Setting histogram breaks in JFreeChart

后端 未结 1 1106
不知归路
不知归路 2020-12-07 03:44

I am using JFreeChart to draw histograms by filling a HistogramDataset object with my data and using the ChartFactory.createHistogram(). However, So far I have not been able

1条回答
  •  情书的邮戳
    2020-12-07 03:55

    SimpleHistogramBin is a good choice for this, as it allows specifying the bin bounds. Add the resulting bins to a SimpleHistogramDataset for use with ChartFactory.createHistogram(). Invoke setAdjustForBinSize() as needed.

    SimpleHistogramDataset data = new SimpleHistogramDataset("Time");
    for (int i = 10; i < 70; i += 10) {
        data.addBin(new SimpleHistogramBin(i, i + 10, true, false));
    }
    data.setAdjustForBinSize(false);
    

    image

    0 讨论(0)
提交回复
热议问题