Vertical Bar Chart ?

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

Vertical Bar Chart ?

Post by rpoetker » Wed Jan 22, 2003 5:12 am

Hello,

I have a requirement to display a vertical bar chart for a set of data. JFreechart makes this very simple to do.

However, I have a customization I cannot seem to figure out. How can a bar for a category begin at a negative number and at end at a greater number? In other words, my bars alway begin at 0 and are drawn downward to negative numbers. I would like to begin at say -80 and head upward to say -10. Does anyone have an idea the best way to approach this?

Thanks,
-Russ.

David Gilbert

Re: Vertical Bar Chart ?

Post by David Gilbert » Wed Jan 22, 2003 4:24 pm

The CategoryDataset interface only returns a single value, but you need two values for what you want to do. So you need to use IntervalCategoryDataset which is an extension of CategoryDataset. Then you need a renderer that knows what to do with the extra data - use VerticalIntervalBarRenderer.

There is a demo called IntervalBarChartDemo that shows how this is put together.

Regards,

Dave Gilbert

rpoetker

Re: Vertical Bar Chart ?

Post by rpoetker » Wed Jan 22, 2003 6:40 pm

David,

Thanks for the advice. I will give this a shot and let you know how it worked out.

BTW, thank you for this nice graphing package. I also purchased the help doc, which clarified quite a few things for me.

-Russ.

Locked