-
-
Notifications
You must be signed in to change notification settings - Fork 9k
The ChartData class
Philipp Jahoda edited this page Mar 29, 2015
·
14 revisions
This wiki entry is intended to provide better insight into the data model behind MPAndroidChart.
The ChartData
class is the baseclass of all data classes (subclasses), like LineData
, BarData
, ... and so on. It is used to provide data for the Chart
via the setData(...)
method of the chart.
public class LineData extends ChartData { ...
The following mentioned methods are implemented in the ChartData
class and can therefore be used for all subclasses.
Styling data
-
setValueTextColor(int color)
: Sets the color of the value-text (color in which the value-labels are drawn) for allDataSets
this data object contains. -
setValueTextSize(float size)
: Sets the size (in dp) of the value-text for allDataSets
this data object contains. -
setValueTypeface(Typeface tf)
: Sets theTypeface
for all value-labels for allDataSets
this data object contains. -
setValueFormatter(ValueFormatter f)
: Sets a customValueFormatter
for allDataSets
this data object contains. -
setDrawValues(boolean enabled)
: Enables / disables drawing values (value-text) for allDataSets
this data object contains.
Getters / Convenience
-
getDataSetByIndex(int index)
: Returns theDataSet
object at the given index in the data-objectsDataSet
list. -
contains(Entry entry)
: Checks if this data object contains the specified Entry. Returns true if so, false if not. NOTE: Performance is pretty bad on this one, do not over-use in performance critical situations. -
contains(T dataSet)
: Returns true if this data object contains the providedDataSet
, false if not.
Clearing
-
clearValues()
: The data object of allDataSet
objects and thereby allEntries
. Does not remove the provided x-values.