I'm trying to use JfreeChart to create a chart for the histogram of an image , but I don't fully understand how to provide the input data for the histogram .The function I am suppose to use is this:
addSeries(java.lang.Comparable key, double[] values, int bins)
I find that documentation is really unclear. I have a 256-element array filled with the number of pixels of each intensity which I want to be able to use as an input, but I don't know how. Has someone encountered this problem before ?
Examples loading data into a JFreeChart HistogramDataset:
HistogramDataset dataset = new HistogramDataset();
dataset.setType(HistogramType.RELATIVE_FREQUENCY);
dataset.addSeries("H1", double[], 20);
HistogramDataset dataset = new HistogramDataset();
double[] values = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0};
dataset.addSeries("H1", values, 10, 0.0, 10.0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With