wangyao5 / achartengine

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

line chart is not updated with the change in database #94

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

I am using achartengine to draw chart which will updated when new value is 
inserted into database. 

I call chart() method when a update is triggered from database. and in that 
time i make mChartView = null; But the problem is that it does not draw the 
updated chart. update is reflected into chart only when if I switch screen 
orientation. whats wrong with my code.
Please provide a source code snippet that we can use to replicate the issue.
chart()
{
if (mChartView == null) {           
            d = new BuildMultipleDataset();         
            db.open();
//code for some database query          
            LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
            mChartView = ChartFactory.getLineChartView(this,                    d.datasetbuilder(cursor1,cursor2), d.render());
            layout.addView(mChartView, new LayoutParams(
                    LayoutParams.FILL_PARENT, chartHeight));
            flag = 0;       
            db.close();     
        } else {
            mChartView.repaint();
        }

}

What version of the product binary library are you using?

Please provide any additional information below.

Original issue reported on code.google.com by fhaque.c...@gmail.com on 6 Jul 2011 at 9:10

GoogleCodeExporter commented 9 years ago
Man, you rebuild all the UI whenever you get something from the DB. This way, 
there is no way the app to be smooth. When you get a new value, just add it to 
the dataset and repaint the chart, don't build anything from scratch.

Let's please use the AChartEngine google group for questions. Please don't use 
the issue tracker for such things!

Original comment by dandrome...@gmail.com on 6 Jul 2011 at 12:52