hochileo / achartengine

Automatically exported from code.google.com/p/achartengine
0 stars 0 forks source link

Null values on TimeChart does not rendere #214

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If the timechart contains null values the chart is not draw.
Here it is a dataset used in GeneratedChartDemo for the TimeChart example.

private XYMultipleSeriesDataset getDateDemoDataset() {
    XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
    final int nr = 10;
    long value = new Date().getTime() - 3 * TimeChart.DAY;
    Random r = new Random();
    for (int i = 0; i < SERIES_NR; i++) {
      TimeSeries series = new TimeSeries("Demo series " + (i + 1));
      for (int k = 0; k < nr; k++) {
          Date date = new Date(value + k * TimeChart.DAY / 4);
          Double num=(double) (r.nextInt()%100);
          if (num>50){
              num=MathHelper.NULL_VALUE;
          }
        series.add(date, num);
      }
      dataset.addSeries(series);
    }
    return dataset;
  }

The result of using this kind of dataset is a blank chart.
I'm facing this problem with the achartengine 1.0.0

Original issue reported on code.google.com by fantasia...@gmail.com on 15 May 2012 at 8:33

GoogleCodeExporter commented 9 years ago
It is actually working. You just need to set the visible maximum Y value:
renderer.setYAxisMax(100);

Original comment by dandrome...@gmail.com on 18 May 2012 at 3:04

GoogleCodeExporter commented 9 years ago
Why do i need to set YAxisMax?

Original comment by fantasia...@gmail.com on 19 May 2012 at 8:01

GoogleCodeExporter commented 9 years ago
The problem is that when initializing the range (XYSeries.updateRange), null 
values are not excluded, so you get a max of NULL_VALUE. Should be an easy fix. 

Original comment by NoSuchL...@gmail.com on 5 Sep 2013 at 3:56

GoogleCodeExporter commented 9 years ago
It definitely seems like the right thing to do would be to ignore NULL_VALUE 
when computing min/max ranges.

Original comment by kjo...@peaksware.com on 27 Oct 2013 at 2:00

GoogleCodeExporter commented 9 years ago
Fantasia, you're my hero today!  Simple concise answer in the form of a 
question.  YAxisMax was exactly the clue I needed 

Original comment by kendallm...@gmail.com on 1 Mar 2015 at 4:35

GoogleCodeExporter commented 9 years ago
NoSuchL is right on the money too!

Original comment by kendallm...@gmail.com on 1 Mar 2015 at 4:37