Is it possible to create a histogram with JFreeChart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Linh Nguyen

Is it possible to create a histogram with JFreeChart

Post by Linh Nguyen » Tue Jun 04, 2002 4:00 pm

Hi,
I want to create a histogram. Is there any simple way to do this, or do I have to make all the calculations by hand?
Thank you very much for beeing so helpful with my other questions.
Linh

David Gilbert

Re: Is it possible to create a histogram with JFreeChart

Post by David Gilbert » Tue Jun 04, 2002 4:08 pm

Hi Linh,

It's not as simple yet as it could be, but in the ChartFactory class there is a method createVerticalXYBarChart(...). This requires an IntervalXYDataset.

At the moment, the TimeSeriesCollection class is the only one that implements the IntervaXYDataset interface, and it does so with constant bar widths. This class isn't going to help you create a histogram (but does give one example implementation of the IntervalXYDataset interface).

You could write a more generic implementation that allowed for varying column widths (which is sometimes necessary for histograms if I recall correctly). Then it would be good to create some utility methods to process a set of observations into a dataset for a frequency histogram.

I'm not that familiar with all the variations of histograms, so it would be great if some people could define some additional requirements. Or a good reference...

Regards,

DG.

Ted Hill

Re: Is it possible to create a histogram with JFreeChart

Post by Ted Hill » Tue Aug 13, 2002 6:59 pm

Hello,

I would also like to use JFreeChart to produce histograms.

Here are a couple of good (and simple) on line references which illustrate what is needed for a histogram.

http://quarknet.fnal.gov/toolkits/ati/histograms.html

http://www.shodor.com/interactivate/act ... index.html


I hope that JFreeChart will be able to include histogram classes in the future.

Thank you,

Ted Hill

Locked