Volume Series with all zero values

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
cdn
Newbie
Newbie
Posts: 29
Joined: Wed Sep 19, 2007 12:00 am

Volume Series with all zero values

Post by cdn » Fri Oct 05, 2007 10:45 am

Hi:

We have some datasets with 0 as the value for volume. When we draw volume series for these values, we are getting horizontal axis drawn in the middle of the custom axis. But, what we would like to have is nothing drawn if all the values are ZERO. Is this possible? Any inputs are appreciated. Thank you.

best regards,
vasu[/img]

tom
Advanced
Posts: 211
Joined: Mon Dec 01, 2003 5:00 am
Contact:

Post by tom » Tue Oct 09, 2007 12:40 am

Hi,

(There are several ways).

You can set the visibility of the series to false, if all values are 0. There are several methods which can give you an idea if the series contains only 0 values, among the getMaxYValue() and getMinYValue().

Code: Select all

if (volumeSeries.getMaxYValue()==0 && volumeSeries.getMinYValue()==0) {
   volumeSeries.setVisible(false); 
}
Depending on your code on how you fill the series, you can use an event to call the above code. As example (but far from optimal and recommended not to be used) the following will check the volumeSeries each time just before the chart will be painted:

Code: Select all

        myChart.addChartPaintListener( new ChartPaintAdapter() {
            public void chartPainting(ChartDrawEvent e) {
                if (volumeSeries.getMaxYValue()==0 && volumeSeries.getMinYValue()==0) {
                    volumeSeries.setVisible(false); 
                };
            };
        };
Regards,
tom

Post Reply