Displaying Zero Value in Bar Chart

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

Displaying Zero Value in Bar Chart

Post by Michael Jacobs » Wed Sep 11, 2002 1:21 am

I want to be able to display a zero value in my bar chart. I use a legend, and therefore don't have horizontal axis labels. However, when there is a zero value, there is just a blank space. I'd like a "minimal" line to be drawn there so the user sees that data was supposed to be there. Is there a way to do this?

If there isn't, I'm going to add the horizontal labels back in.

Thanks!

Michael

David Gilbert

Re: Displaying Zero Value in Bar Chart

Post by David Gilbert » Thu Sep 12, 2002 9:33 am

This probably needs a special case to be added to the VerticalBarRenderer class. I'll add it to the to-do list.

Regards,

DG.

Michael Jacobs

Re: Displaying Zero Value in Bar Chart

Post by Michael Jacobs » Thu Sep 12, 2002 5:02 pm

I was able to accomplish the feat by changing my Integer values to Float values, and then setting the zero values to ".1". The zero values showed up as small bars at the bottom that looked exactly like I wanted. My axis is set to display integers only, so this works out perfectly.

The only other tricky part was regarding the tooltip generation. I needed to loop through the ChartEntities and change all occurrences of .1 to 0. This worked as well.

Locked