-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
The DataSet class
Philipp Jahoda edited this page Mar 27, 2015
·
6 revisions
The DataSet class is the baseclass of all data-set classes (subclasses), like LineDataSet, BarDataSet, ... and so on.
public class DataSet extends LineDataSet { ...The DataSet class represents one group or type of entries (Entry) in the Chart that belong together. It is designed to logically separate different groups of values inside the Chart (e.g. the values for a specific line in the LineChart, or the values of a specific group of bars in the BarChart).
The following mentioned methods are implemented in the DataSet 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 thisDataSetobject. -
setValueTextSize(float size): Sets the size (in dp) of the value-text for thisDataSetobject. -
setValueTypeface(Typeface tf): Sets theTypefacefor all value-labels for thisDataSetobject. -
setValueFormatter(ValueFormatter f): Sets a customValueFormatterfor thisDataSetobject. -
setDrawValues(boolean enabled): Enables / disables drawing values (value-text) for thisDataSetobject.
If all values in your whole data object (not data-set) should e.g. have the same color, you can simply call one of the above mentioned on the ChartData object.
Getters / Convenience
-
contains(Entry entry): Checks if thisDataSetobject contains the specifiedEntry. Returns true if so, false if not. NOTE: Performance is pretty bad on this one, do not over-use in performance critical situations.