createVerticalBarChart and using date

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Altug B. Altintas

createVerticalBarChart and using date

Post by Altug B. Altintas » Tue May 29, 2001 2:54 pm

Hi ,

i need to draw VerticalBarChart with using DATE data .
For example i want to put Double data on Y axis
and DATE data on X axis , but i saw that VerticalBarChart doesn't work with DATE data .. am i right ? if not so please send me a simple example about VerticalBarChart that uses Double on Y axis and Date on X axis .

Thanks

David Gilbert

RE: createVerticalBarChart and using date

Post by David Gilbert » Wed May 30, 2001 12:37 am

You can use any subclass of java.lang.Object as a category in your implementation of CategoryDataSource. JFreeChart will use the toString() method as the category label - so you could use your own date class, as long as the toString() method outputs something sensible. However, JFreeChart will still treat the dates as discrete categories that will be evenly spaced regardless of the particular dates used.

If you want a bar chart with dates to scale, then you need to implement a new type of plot - I've considered implementing a new XYBarPlot class that would do the job, but haven't found time to write the code yet. The trick is determining the width of the bars - this could be set as a property of the plot class, or supplied by the data source (I prefer the latter solution, because it's more general).

I encourage you to have a go at implementing something - that's what free software/open source is all about.

Regards,

DG.

Altug B. Altintas

RE: createVerticalBarChart and using date

Post by Altug B. Altintas » Wed May 30, 2001 7:39 am

Thanks for your response ,
i just need a sample code about "createVerticalBarChart" .Can u send me a sample code about
VerticalBar charts that date value on X axis and double value on Y axis.

Thank u very much.

Locked