-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Dynamic & Realtime Data
Philipp Jahoda edited this page May 21, 2015
·
28 revisions
For adding new data to the chart or removing data dynamically, there are various methods that allow to either add or remove Entry objects to an existing DataSet or DataSet objects to/from an existing ChartData object.
Class DataSet (and all subclasses):
-
addEntry(Entry e): Adds the givenEntryobject to theDataSet.
Class ChartData (and all subclasses):
-
addEntry(Entry e, int dataSetIndex): Adds the givenEntryto theDataSetat the specified dataset index. -
addDataSet(DataSet d): Adds the givenDataSetobject to theChartDataobject.
In addition to that, there are also methods for removing data dynamically.
Class DataSet (and all subclasses):
-
public boolean removeEntry(Entry e): Removes the givenEntryobject from theDataSet. Returns true if successful. -
public boolean removeEntry(int xIndex): Removes theEntryat the given x-index from theDataSet. Returns true if successful.
Class ChartData (and all subclasses):
-
public boolean removeEntry(Entry e, int dataSetIndex): Removes the givenEntryobject from theDataSetwith the given dataset index. Returns true if successful. -
public boolean removeEntry(int xIndex, int dataSetIndex): Removes theEntryat the given x-index from theDataSetwith the given dataset index. Returns true if successful. -
public boolean removeDataSet(DataSet d): Removes the givenDataSetobject from theChartDataobject. Returns true if successful. -
public boolean removeDataSet(int index): Removes theDataSetat the given index from theChartDataobject. Returns true if successful.