-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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 allDataSetsthis data object contains. -
setValueTextSize(float size): Sets the size (in dp) of the value-text for allDataSetsthis data object contains. -
setValueTypeface(Typeface tf): Sets theTypefacefor all value-labels for allDataSetsthis data object contains. -
setValueFormatter(ValueFormatter f): Sets a customValueFormatterfor allDataSetsthis data object contains. -
setDrawValues(boolean enabled): Enables / disables drawing values (value-text) for allDataSetsthis data object contains.
Getters / Convenience
-
getDataSetByIndex(int index): Returns theDataSetobject at the given index in the data-objectsDataSetlist. -
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.