paragp / achartengine

AChartEngine is a charting library for Android applications. It currently supports the following chart types: line chart area chart scatter chart time chart bar chart pie chart bubble chart doughnut chart range (high-low) bar chart dial chart / gauge combined (any combination of line, cubic line, scatter, bar, range bar, bubble) chart cubic line chart All the above supported chart types can contain multiple series, can be displayed with the X axis horizontally (default) or vertically and support many other custom features. The charts can be built as a view that can be added to a view group or as an intent, such as it can be used to start an activity. The model and the graphing code is well optimized such as it can handle and display huge number of values. AChartEngine is currently at the 1.0.0 release. New chart types will be added in the following releases. Please keep sending your feedback such as we can continually improve this library. Find us on Facebook, too: http://www.facebook.com/achartengine Read a short introduction to AChartEngine here: http://www.javaadvent.com/2012/12/achartengine-charting-library-for.html Another good tutorial can be read here: http://jaxenter.com/effort-free-graphs-on-android-with-achartengine-46199.html
0 stars 1 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