Nativescript plugin for Charts
    Preparing search index...

    Class representing the legend of the chart. The legend will contain one entry per color and DataSet. Multiple colors in one DataSet are grouped together. The legend object is NOT available before setting data to the chart.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    calculatedLabelBreakPoints: any[]
    calculatedLabelSizes: any[]
    calculatedLineSizes: any[]
    direction: LegendDirection

    the text direction for the legend

    drawInside: boolean
    enabled: boolean

    flag that indicates if this axis / legend is enabled or not

    ensureVisible: boolean

    Defines if the renderer should ensure we always see the component fully

    entries: LegendEntry[]

    The legend entries array

    extraEntries: LegendEntry[]

    Entries that will be appended to the end of the auto calculated entries after calculating the legend. (if the legend has already been calculated, you will need to call notifyDataSetChanged() to let the changes take effect)

    the shape/form the legend colors are drawn in

    formLineDashEffect: DashPathEffect

    Line dash path effect used for shapes that consist of lines.

    formLineWidth: number

    the size of the legend forms/shapes

    formSize: number

    the size of the legend forms/shapes

    formToTextSpace: number

    the space between the legend entries on a vertical axis, default 2f private float this.mYEntrySpace = 2f; /** the space between the form and the actual label/text

    horizontalAlignment: LegendHorizontalAlignment
    maxSizePercent: number

    The maximum relative size out of the whole chart view. / If the legend is to the right/left of the chart, then this affects the width of the legend. / If the legend is to the top/bottom of the chart, then this affects the height of the legend. / If the legend is the center of the piechart, then this defines the size of the rectangular bounds out of the size of the "hole". / default: 0.95f (95%)

    mIsLegendCustom: boolean

    Are the legend labels/colors a custom value or auto calculated? If false, then it's auto, if true, then custom. default false (automatic legend)

    mNeededHeight: number

    the total height of the legend (needed height space)

    mNeededWidth: number

    the total width of the legend (needed width space)

    mTextHeightMax: number
    mTextSize: number

    the text size of the labels

    mTextWidthMax: number
    orientation: LegendOrientation
    stackSpace: number

    the space that should be left between stacked forms

    textColor: string

    the text color to use for the labels

    typeface: Font

    the typeface used for the labels

    verticalAlignment: LegendVerticalAlignment
    wordWrapEnabled: boolean

    Should the legend word wrap? / this is currently supported only for: BelowChartLeft, BelowChartRight, BelowChartCenter. / note that word wrapping a legend takes a toll on performance. / you may want to set maxSizePercent when word wrapping, to set the point where the text wraps. / default: false

    xEntrySpace: number

    the space between the legend entries on a horizontal axis, default 6f

    xOffset: number

    the offset in pixels this component has on the x-axis

    yEntrySpace: number

    the space between the legend entries on a vertical axis, default 5f

    yOffset: number

    the offset in pixels this component has on the Y-axis

    Accessors

    • get font(): Font

      returns the Typeface used for the labels, returns null if none is set

      Returns Font

      Font

    • set font(tf: Font): void

      sets a specific Typeface for the labels

      Parameters

      • tf: Font

      Returns void

    • get textSize(): number

      returns the text size that is currently set for the labels, in pixels

      Returns number

    • set textSize(size: number): void

      sets the size of the label text in density pixels min = 6f, max = 24f, default 10

      Parameters

      • size: number

        the text size, in DP

      Returns void

    Methods

    • Calculates the dimensions of the Legend. This includes the maximum width and height of a single entry, as well as the total width and height of the Legend.

      Parameters

      • labelpaint: Paint
      • viewPortHandler: any

      Returns void

    • Returns void

    • returns the maximum height in pixels across all legend labels

      Parameters

      • p: Paint

        the paint object used for rendering the text

      Returns number

    • returns the maximum length in pixels across all legend labels + formsize

      • formtotextspace

      Parameters

      • p: Paint

        the paint object used for rendering the text

      Returns number

    • Returns boolean

      true if a custom legend entries has been set default false (automatic legend)

    • Calling this will disable the custom legend entries (set by setCustom(...)). Instead, the entries will again be calculated automatically (after notifyDataSetChanged() is called).

      Returns void

    • Sets a custom legend's entries array.

      • A null label will start a group. This will disable the feature that automatically calculates the legend entries from the datasets. Call resetCustom() to re-enable automatic calculation (and then notifyDataSetChanged() is needed to auto-calculate the legend again)

      Parameters

      • entries: any

      Returns void

    • Entries that will be appended to the end of the auto calculated entries after calculating the legend. (if the legend has already been calculated, you will need to call notifyDataSetChanged() to let the changes take effect)

      Parameters

      • colors: any
      • labels: any

      Returns void