ahmedeng165 / flot-android-chart

Automatically exported from code.google.com/p/flot-android-chart
0 stars 0 forks source link

Realtime updates #16

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a chart using basic_example.java code
2. Update the chart like this in a loop
     mFlotDraw.setData(vSeriesData);
     mFlotDraw.redraw();

What is the expected output? What do you see instead?
The graph updates for a couple of seconds then crashes. Is this how to create a 
realtime graph? This is how i've done it using the javascript version.

What version of the product are you using? On what operating system?
Android 3.1
Flot for android 1.0

Please provide any additional information below.
The workaround is to redraw the entire chart like this

    mFlotDraw = new FlotDraw(vSeriesData, opt, null);

    tv = (FlotChartContainer)this.findViewById(R.id.flotdraw);

    if(tv != null) {
      tv.setDrawData(mFlotDraw);
    }

but the refresh rate is very slow.

Original issue reported on code.google.com by nab...@gmail.com on 23 Jun 2011 at 3:55

GoogleCodeExporter commented 8 years ago
The error seems to be an out of bounds exceptions coming from FlotDraw.29:1298

adding a try/catch around the if statement seems to fix the problem
try {
    if(points.get(i - ps) == null || 
            points.get(i) == null ||
            points.get(i - ps + 1) == null ||
            points.get(i + 1) == null) {
        continue;
    }
}
catch (IndexOutOfBoundsException e)
{
    continue;
}

Original comment by nab...@gmail.com on 23 Jun 2011 at 11:00

GoogleCodeExporter commented 8 years ago
How do I change it since I use .jar instead of source code? 

Original comment by wally...@gmail.com on 19 Feb 2014 at 9:50