-
-
Notifications
You must be signed in to change notification settings - Fork 9k
The DataSet class
Philipp Jahoda edited this page Feb 11, 2016
·
6 revisions
The DataSet
class is the baseclass of all data-set classes (subclasses), like LineDataSet
, BarDataSet
, ... and so on.
public class LineDataSet extends DataSet { ...
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 thisDataSet
object. -
setValueTextColors(List colors)
: Sets a list of colors to be used as value colors. -
setValueTextSize(float size)
: Sets the size (in dp) of the value-text for thisDataSet
object. -
setValueTypeface(Typeface tf)
: Sets theTypeface
for all value-labels for thisDataSet
object. -
setValueFormatter(ValueFormatter f)
: Sets a customValueFormatter
for thisDataSet
object, more on theValueFormatter
here. -
setDrawValues(boolean enabled)
: Enables / disables drawing values (value-text) for thisDataSet
object.
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.
Highlighting
-
setHighlightEnabled(boolean enabled)
: Set this to true to allow highlighting via touch for this specificDataSet
. -
setDrawVerticalHighlightIndicator(boolean enabled)
: Enables / disables the vertical highlight-indicator-line. If disabled, the indicator is not drawn. -
setDrawHorizontalHighlightIndicator(boolean enabled)
: Enables / disables the horizontal highlight-indicator-line. If disabled, the indicator is not drawn.
Getters / Convenience
-
contains(Entry entry)
: Checks if thisDataSet
object 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.