3D Bar chart with 0 value

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

3D Bar chart with 0 value

Post by Don Mitchell » Tue Dec 03, 2002 7:45 pm

I have a 3D Bar Chart with multiple series per category. Some of the categories have a value of 0 (zero) for some of the series. These show up as missing columns. Is there a way to have a colored shadow shown at the bottom of the chart where the column would be? I think this would be easier for a viewer to interpret than just a missing column.

I have turned on the feature that shows the values for the columns and that puts 0s where the columns would be, but it doesn't look all that good.

I can email an example picture if anyone wants to see what I'm talking about.

Thanks,
Don

David Gilbert

Re: 3D Bar chart with 0 value

Post by David Gilbert » Wed Dec 04, 2002 11:27 am

Hi Don,

The method that needs modifying is the drawItem method in the VerticalBarRenderer3D class. I can see a test in there for rectHeight!=0.0 which prevents the bar from being drawn...but in that case, you probably still want to draw the bar3dTop shape.

I haven't got time to look at it more right now, but I'll add it to the to-do list...

Regards,

DG

Michael Jacobs

Re: 3D Bar chart with 0 value

Post by Michael Jacobs » Thu Dec 05, 2002 5:09 am

Don,

I had this same problem, and I solved it by changing all 0.0 values to 0.1. This causes a minimal representation without too much rewrite of the code. The other thing I had to do was add a "minimum axis height" so that if ALL values were 0, that the 0.1 didn't go to the top of the chart. I set my minimum height to 10, for example, and things worked quite well.

I think the other suggestion,to change the draw method is the way to go, however.

Michael

Locked