Back to project page line-chart-view.
The source code is released under:
MIT License
If you think the Android project line-chart-view listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.hogel.android.linechartviewdemo; //from www .j a v a 2 s . co m import android.app.Activity; import android.os.Bundle; import android.view.View; import org.hogel.android.linechartview.LineChartView; import java.util.ArrayList; import java.util.List; public class LineChartActivity extends Activity { private static final double MAX_Y = 100; private LineChartView chartView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chart); chartView = (LineChartView) findViewById(R.id.chart_view); chartView.setManualMinY(0); View nextButton = findViewById(R.id.next_data); nextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { nextChartData(); } }); } private void nextChartData() { List<LineChartView.Point> points = new ArrayList<>(); for (int i = 0; i < 5; i++) { int y = (int) (Math.random() * MAX_Y); points.add(new LineChartView.Point(i, y)); } chartView.setPoints(points); } }