Nativescript plugin for Charts
    Preparing search index...

    Class BaseDataSet<T>Abstract

    Created by Philipp Jahoda on 21/10/15. This is the base dataset of all DataSets. It's purpose is to implement critical methods provided by the IDataSet interface.

    Type Parameters

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    • Constructor with label.

      Type Parameters

      Parameters

      • label: any
      • OptionalxProperty: any
      • OptionalyProperty: any

      Returns BaseDataSet<T>

    Properties

    axisDependency: AxisDependency

    this specifies which axis this DataSet should be plotted against

    color: string | Color
    colors: (string | Color)[]

    List representing all colors that are used for this DataSet

    drawIconsEnabled: boolean

    if true, y-icons are drawn on the chart

    drawValuesEnabled: boolean

    if true, y-values are drawn on the chart

    entryCount: number

    Returns the number of y-values this DataSet represents -> the size of the y-values array -> yvals.length

    fillShader: any

    the shader to be used for filling the line surface

    The form to draw for this dataset in the legend.

    Return `DEFAULT` to use the default legend form.

    formLineDashEffect: any

    The line dash path effect used for shapes that consist of lines.

    Return `null` to use the default legend form line dash effect.

    formLineWidth: number

    The line width for drawing the form of this dataset in the legend

    Return `Float.NaN` to use the default legend form line width.

    formSize: number

    The form size to draw for this dataset in the legend.

    Return `Float.NaN` to use the default legend form size.

    highlightEnabled: boolean

    if true, value highlightning is enabled

    iconProperty: string

    property to access the "icon" value of an entry for this set

    iconsOffset: { x: number; y: number }

    the offset for drawing icons (in dp)

    label: string

    label that describes the DataSet or the data the DataSet represents

    spaceBottom: number

    data space from the smallest value to the bottom in percent of the total axis range

    spaceTop: number

    data space from the highest value to the top in percent of the total axis range

    valueColors: (string | Color)[]

    List representing all colors that are used for drawing the actual values for this DataSet

    valueFormatter: ValueFormatter

    custom formatter that is used instead of the auto-formatter if set

    values: T[] | ObservableArray<T>

    getEntryYValue

    Returns the values that belong to DataSet.

    valuesOffset: { x: number; y: number }

    the offset for drawing values (in dp)

    valueTextSize: number

    the size of the value-text labels

    valueTypeface: Font

    the typeface used for the value text

    visible: boolean

    flag that indicates if the DataSet is visible or not

    xMax: number

    returns the maximum x-value this DataSet holds

    xMin: number

    returns the minimum x-value this DataSet holds

    xProperty: string

    property to access the "x" value of an entry for this set

    yMax: number

    returns the maximum y-value this DataSet holds

    yMin: number

    returns the minimum y-value this DataSet holds

    yProperty: string

    property to access the "y" value of an entry for this set

    Accessors

    • get needsFormatter(): boolean

      Returns boolean

    • set valueTextColor(color: any): void

      Sets the color the value-labels of this DataSet should have.

      Parameters

      • color: any

      Returns void

    • set valueTextColors(colors: any): void

      Sets a list of colors to be used as the colors for the drawn values.

      Parameters

      • colors: any

      Returns void

    Methods

    • Adds a new color to the colors array of the DataSet.

      Parameters

      • value: string | Color

      Returns void

    • Adds an Entry to the DataSet dynamically. Entries are added to the end of the list. This will also recalculate the current minimum and maximum values of the DataSet and the value-sum.

      Parameters

      Returns boolean

    • Adds an Entry to the DataSet dynamically. Entries are added to their appropriate index in the values array respective to their x-position. This will also recalculate the current minimum and maximum values of the DataSet and the value-sum.

      Parameters

      Returns any

    • Calculates the minimum and maximum x and y values (mXMin, this.mXMax, this.mYMin, this.mYMax).

      Returns any

    • Calculates the min and max y-values from the Entry closest to the given fromX to the Entry closest to the given toX value. This is only needed for the autoScaleMinMax feature.

      Parameters

      • fromX: number
      • toX: number

      Returns any

    • Removes all values from this DataSet and does all necessary recalculations.

      Returns any

    • Checks if this DataSet 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.

      Parameters

      Returns boolean

    • Parameters

      • Optionalindex: number

      Returns string | Color

    • Returns all Entry objects found at the given x-value with binary search. An empty array if no Entry object at that x-value. INFORMATION: This method does calculations at runtime. Do not over-use in performance critical situations.

      Parameters

      • xValue: number

      Returns { entry: T; index: number }[]

    • Returns all Entry objects found at the given x-value with binary search. An empty array if no Entry object at that x-value. INFORMATION: This method does calculations at runtime. Do not over-use in performance critical situations.

      Parameters

      • xValue: number

      Returns T[] | ObservableArray<T>

    • Returns the first Entry object found at the given x-value with binary search. If the no Entry at the specified x-value is found, this method returns the Entry at the closest x-value according to the rounding. INFORMATION: This method does calculations at runtime. Do not over-use in performance critical situations.

      Parameters

      • xValue: number

        the x-value

      • closestToY: number

        If there are multiple y-values for the specified x-value,

      • Optionalrounding: Rounding

        determine whether to round up/down/closest if there is no Entry matching the provided x-value

      Returns { entry: T; index: number }

    • Returns the Entry object found at the given index (NOT xIndex) in the values array.

      Parameters

      • index: number

      Returns T

    • Returns the first Entry object found at the given x-value with binary search. If the no Entry at the specified x-value is found, this method returns the Entry at the closest x-value according to the rounding. INFORMATION: This method does calculations at runtime. Do not over-use in performance critical situations.

      Parameters

      • xValue: number

        the x-value

      • closestToY: number

        If there are multiple y-values for the specified x-value,

      • Optionalrounding: Rounding

        determine whether to round up/down/closest if there is no Entry matching the provided x-value

      Returns T

    • Parameters

      Returns any

    • Returns the position of the provided entry in the DataSets Entry array. Returns -1 if doesn't exist.

      Parameters

      Returns number

    • Returns the first Entry index found at the given x-value with binary search. If the no Entry at the specified x-value is found, this method returns the Entry at the closest x-value according to the rounding. INFORMATION: This method does calculations at runtime. Do not over-use in performance critical situations.

      Parameters

      • xValue: number

        the x-value

      • closestToY: number

        If there are multiple y-values for the specified x-value,

      • Optionalrounding: Rounding

        determine whether to round up/down/closest if there is no Entry matching the provided x-value

      Returns number

    • Parameters

      • e: T
      • entryIndex: number

      Returns any

    • Parameters

      Returns number

    • Parameters

      • xIndex: any

      Returns number

    • Parameters

      • Optionalindex: number

      Returns string | Color

    • Initializes DataSet chart data.

      Returns any

    • Use this method to tell the data set that the underlying data has changed.

      Returns void

    • Removes an Entry from the DataSets entries array. This will also recalculate the current minimum and maximum values of the DataSet and the value-sum. Returns true if an Entry was removed, false if no Entry could be removed.

      Parameters

      Returns any

    • Removes the Entry object at the given index in the values array from the DataSet. Returns true if an Entry was removed, false if no Entry could be removed.

      Parameters

      • index: number

      Returns any

    • Removes the Entry object closest to the given x-value from the DataSet. Returns true if an Entry was removed, false if no Entry could be removed.

      Parameters

      • xValue: any

      Returns any

    • Removes the first Entry (at index 0) of this DataSet from the entries array. Returns true if successful, false if not.

      Returns any

    • Removes the last Entry (at index size-1) of this DataSet from the entries array. Returns true if successful, false if not.

      Returns any

    • Resets all colors of this DataSet and recreates the colors array.

      Returns void

    • Sets a color with a specific alpha value.

      Parameters

      • color: string | Color
      • Optionalalpha: number

        from 0-255

      Returns void

    • Sets colors with a specific alpha value.

      Parameters

      • colors: any
      • Optionalalpha: number

      Returns void