Suppressing display of zero values with XYStepRenderer

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jahjeremy
Posts: 31
Joined: Tue Sep 25, 2012 2:49 am
antibot: No, of course not.

Suppressing display of zero values with XYStepRenderer

Post by jahjeremy » Sat Mar 23, 2013 12:36 am

Hello,

I was wondering if anyone could give me some advice on this.

I am using the XYStepRenderer to display an outline of histogram data, as shown here:

Image

This is ALMOST looking how I want but as you can see there are lines being drawn at zero, with small error bars, which appears kind of strange.

I am wondering if there is a way to draw the data such that zero values would be ignored. I don't think simply leaving out of the dataset would work because I need to have the bars extend down to zero rather than connect the next point. (Does this make sense?)

I may end up writing my own renderer here to simply skip the display of zero values. It would probably be pretty straightforward to extend the XYStepRenderer or copy the code in order to do it, but I'm wondering if there is a more straightforward way. This would also need to be done for the errors.

i think if I used a plain JFree bar chart or histogram, then skipping the zero values in the dataset would work. But for the step renderer, it is a lot more complicated, as I do a kind of conversion from binned histogram data to points expected by the XYStepRenderer, e.g. at the bin edges. I also don't think it is possible to have "breaks" in the data with the step renderer. It will just draw them all using a continuous set of connected lines.

If you have any suggestions about this or need clarification, please let me know.

Thanks.

--Jeremy

Locked