BaseDataSet<T extends Entry> class
abstract
Styling and bookkeeping shared by every data set: colors, value labels, legend form, axis and visibility.
Entry storage is left to DataSet; the entry related overrides here work through getEntryForIndex.
T is the entry type this set holds.
Kotlin's setColors(colorResIds, context) is not ported (no Android resources). Kotlin's protected
copy(baseDataSet) is copyTo (it would clash with the public DataSet.copy()).
Constructors
- BaseDataSet([String label = 'DataSet'])
-
Creates the styling part of a data set named
label, shown in the legend and usable for lookup viaChartData.getDataSetByLabel.
Properties
- axisDependency ↔ AxisDependency
-
The y axis this data set is plotted against. Default AxisDependency.LEFT.
getter/setter pairoverride
- color ↔ Color
-
The first entry color, or black when colors is empty. Assigning replaces the whole colors list with this one
color.
getter/setter pairoverride-getter
-
colors
↔ List<
Color> -
Colors used to draw the entries, reused from the start when there are more entries than colors.
getter/setter pairoverride-getter
- entryCount → int
-
Number of entries in this data set.
no setterinherited
- form ↔ LegendForm
-
Shape of this set's legend entry. LegendForm.DEFAULT uses the legend's form.
getter/setter pairoverride-getter
- formLineDashEffect ↔ DashPathEffect?
-
Dash effect for this set's legend form when the form is a line. Null uses the legend's dash effect.
getter/setter pairoverride-getter
- formLineWidth ↔ double
-
Line width of this set's legend form in dp when the form is a line. NaN uses the legend's width.
getter/setter pairoverride-getter
- formSize ↔ double
-
Size of this set's legend form in dp. NaN (the default) uses the legend's form size.
getter/setter pairoverride-getter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasNonFiniteY → bool
-
True when an entry's y may not be a finite number, so a renderer has to look for gaps before drawing a
line. The default is true, which is always safe; answer false only when every y is known to be finite.
no setterinherited
- iconsOffset ↔ MPPointF
-
Offset in dp applied to every entry icon. Assigning copies x and y into the existing point.
getter/setter pairoverride
- isDrawIconsEnabled ↔ bool
-
True to draw the entry icons. Default true. Not drawn when more entries are visible than the chart's
maxVisibleCountallows.getter/setter pairoverride - isDrawValuesEnabled ↔ bool
-
True to draw the value labels at the entries. Default true. Not drawn when more entries are visible
than the chart's
maxVisibleCountallows.getter/setter pairoverride - isHighlightEnabled ↔ bool
-
True if entries of this data set can be highlighted by touch or
chart.highlightValue(...). Default true.getter/setter pairoverride - isVisible ↔ bool
-
True if this data set is drawn. Default true. Hidden data sets still count for the axis ranges.
getter/setter pairoverride
- label ↔ String
-
Name shown in the legend for this data set.
getter/setter pairoverride
- needsFormatter → bool
-
True while no custom valueFormatter is assigned, so the chart may apply its own default formatter.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- valueFormatter ↔ IValueFormatter
-
Formatter for the value labels. Returns Utils.defaultValueFormatter until a custom one is assigned.
getter/setter pairoverride
- valueTextColor ↔ Color
-
The first value label color, or black when the list is empty. Assigning replaces the whole valueTextColors
list with this one color.
getter/setter pairoverride
-
valueTextColors
↔ List<
Color> -
Colors used to draw the value labels, reused from the start like colors. Default black.
getter/setter pairoverride
- valueTextSize ↔ double
-
Text size of the value labels in dp. Default 7.
getter/setter pairoverride
- valueTypeface ↔ Typeface?
-
Typeface of the value labels, null for the default.
getter/setter pairoverride
- xMax → double
-
Largest x value in this data set, -
Float.MAX_VALUEwhen empty.no setterinherited - xMin → double
-
Smallest x value in this data set, Kotlin
Float.MAX_VALUEwhen empty.no setterinherited - yMax → double
-
Largest y value in this data set, -
Float.MAX_VALUEwhen empty.no setterinherited - yMin → double
-
Smallest y value in this data set, Kotlin
Float.MAX_VALUEwhen empty.no setterinherited
Methods
-
addColor(
Color color) → void - Appends one color to colors.
-
addEntry(
T e) → bool -
Appends
eat the end of the entry list and updates the min and max values.inherited -
addEntryOrdered(
T e) → void -
Inserts
eat the position matching its x value and updates the min and max values.inherited -
calcMinMax(
) → void -
Recomputes xMin, xMax, yMin and yMax from all entries.
inherited
-
calcMinMaxY(
double fromX, double toX) → void -
Recomputes yMin and yMax from the entries between the x values
fromXandtoXonly. Used when the chart auto scales its y axis to the visible range.inherited -
clear(
) → void -
Removes all entries and resets the min and max values.
inherited
-
contains(
T entry) → bool -
Returns true if
entryis one of this set's entries, compared with==(identity for Entry).override -
copyTo(
covariant BaseDataSet< Entry> baseDataSet) → void -
Copies all styling from this set into
baseDataSet. Color lists and the formatter are shared. -
getColor(
int index) → Color -
Returns the color for the entry at
index, wrapping around colors when there are fewer colors. Black when colors is empty.override -
getEntriesForXValue(
double xValue) → List< T> -
Returns all entries whose x value equals
xValue, or an empty list if there is none.inherited -
getEntryForIndex(
int index) → T -
Returns the entry at position
indexin the entry list.inherited -
getEntryForXValue(
double xValue, [double closestToY = double.nan, Rounding rounding = Rounding.CLOSEST]) → T? -
Returns the entry at
xValue, or the entry at the nearest x value according toroundingif there is none.inherited -
getEntryIndex(
double xValue, [double closestToY = double.nan, Rounding rounding = Rounding.CLOSEST]) → int -
Returns the index of the entry at
xValue, or of the entry at the nearest x value according torounding.inherited -
getEntryIndexOf(
Entry e) → int -
Returns the index of
ein the entry list, or -1 if it is not contained.inherited -
getIndexInEntries(
int xIndex) → int -
Finds the entry whose x equals
xIndexexactly by scanning all entries.override -
getValueTextColor(
int index) → Color -
Returns the value label color for the entry at
index, wrapping around valueTextColors. Black when the list is empty.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyDataSetChanged(
) → void - Recomputes the cached x and y ranges from the entries. Call after changing entries in place.
-
removeEntry(
T e) → bool -
Removes
eand updates the min and max values. Returns false ifeis not contained.inherited -
removeEntryByIndex(
int index) → bool -
Removes the entry at
index.override -
removeEntryByXValue(
double xValue) → bool -
Removes the entry whose x is closest to
xValue, which need not be an exact match.override -
removeFirst(
) → bool -
Removes the first entry. Returns false and does nothing when the set is empty.
override
-
removeLast(
) → bool -
Removes the last entry. Returns false and does nothing when the set is empty.
override
-
resetColors(
) → void - Removes all colors. Add at least one color before the set is drawn; until then getColor returns black.
-
setColor(
Color color, int alpha) → void -
Replaces colors with this one color after applying
alpha. -
setColors(
List< Color> colors, [int? alpha]) → void -
Replaces
colorswith the given colors (Kotlin'ssetColors(vararg colors: Int)), or, withalpha, with the given colors after applyingalpha(0 transparent to 255 opaque) to each of them, ignoring their own alpha (Kotlin'ssetColors(colors: List<Int>, alpha: Int)). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited