Java Code Examples for com.jjoe64.graphview.GraphView#removeAllSeries()
The following examples show how to use
com.jjoe64.graphview.GraphView#removeAllSeries() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From ssj with GNU General Public License v3.0 | 5 votes |
public void onStartPressed(View v) { Button btn = (Button) findViewById(R.id.btn_start); btn.setAlpha(0.5f); btn.setEnabled(false); getCacheDir().getAbsolutePath(); AssetManager am = getApplicationContext().getAssets(); getAssets(); TextView text = (TextView) findViewById(R.id.txt_ssj); if(_pipe == null || !_pipe.isRunning()) { text.setText(_ssj_version + " - starting"); GraphView graph = (GraphView) findViewById(R.id.graph); graph.removeAllSeries(); // graph.getSecondScale().removeAllSeries(); //not implemented in GraphView 4.0.1 GraphView graph2 = (GraphView) findViewById(R.id.graph2); graph2.removeAllSeries(); // graph2.getSecondScale().removeAllSeries(); //not implemented in GraphView 4.0.1 GraphView graphs[] = new GraphView[]{graph, graph2}; _pipe = new PipelineRunner(this, graphs); _pipe.setExceptionHandler(this); _pipe.start(); } else { text.setText(_ssj_version + " - stopping"); _pipe.terminate(); } }
Example 2
Source File: SettingsFragment.java From BackPackTrackII with GNU General Public License v3.0 | 4 votes |
private void showStepGraph(GraphView graph) { SharedPreferences prefs = getPreferenceScreen().getSharedPreferences(); boolean data = false; long maxTime = 0; int maxSteps = 10000; long now = new Date().getTime(); int history = Integer.parseInt(prefs.getString(PREF_GRAPH_HISTORY, DEFAULT_GRAPH_HISTORY)); Cursor cursor = db.getSteps(now - history * DAY_MS, now, true); int colTime = cursor.getColumnIndex("time"); int colCount = cursor.getColumnIndex("count"); LineGraphSeries<DataPoint> seriesStep = new LineGraphSeries<DataPoint>(); while (cursor.moveToNext()) { data = true; long time = cursor.getLong(colTime); if (time > maxTime) maxTime = time; int count = cursor.getInt(colCount); if (count > maxSteps) maxSteps = count; seriesStep.appendData(new DataPoint(new Date(time), count), true, Integer.MAX_VALUE); } if (data) { graph.removeAllSeries(); graph.getViewport().setXAxisBoundsManual(true); graph.getViewport().setMinX(maxTime - 7 * DAY_MS); graph.getViewport().setMaxX(maxTime); graph.getViewport().setYAxisBoundsManual(true); graph.getViewport().setMinY(0); graph.getViewport().setMaxY(maxSteps); graph.getViewport().setScrollable(true); graph.getViewport().setScalable(true); graph.getGridLabelRenderer().setLabelFormatter( new DateAsXAxisLabelFormatter(getActivity(), SimpleDateFormat.getDateInstance(SimpleDateFormat.SHORT))); graph.getGridLabelRenderer().setNumHorizontalLabels(3); graph.addSeries(seriesStep); graph.setVisibility(View.VISIBLE); } else graph.setVisibility(View.GONE); }