Created
June 24, 2019 10:34
-
-
Save jddeep/8b578c45c589d7aafd85cc9b9ebe9583 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void addEntry() { | |
LineData data = graph.getData(); | |
if (data != null) { | |
ILineDataSet set = data.getDataSetByIndex(0); | |
if (set == null) { | |
set = createSet(); | |
data.addDataSet(set); | |
} | |
data.addEntry(new Entry(set.getEntryCount(), (float) (Math.random() * 40) + 30f), 0); | |
data.notifyDataChanged(); | |
// let the graph know it's data has changed | |
graph.notifyDataSetChanged(); | |
// limit the number of visible entries | |
graph.setVisibleXRangeMaximum(120); | |
// graph.setVisibleYRange(30, AxisDependency.LEFT); | |
// move to the latest entry | |
graph.moveViewToX(data.getEntryCount()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment