Nativescript plugin for Charts
    Preparing search index...

    View that represents a pie chart. Draws cake like slices.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    animator: ChartAnimator

    object responsible for animations

    centerText: string

    variable for the text that is drawn in the center of the pie-chart

    centerTextRadiusPercent: number

    the rectangular radius of the bounding box for the center text, as a percentage of the pie hole default 1.f (100%)

    chartTouchListener: PieRadarChartTouchListener
    circleBox: RectF

    rect object that represents the bounds of the piechart, needed for drawing the circle

    customRenderer: CustomRenderer
    defaultValueFormatter: DefaultValueFormatter

    the default IValueFormatter that has been determined by the chart considering the provided minimum and maximum values, number of digits depends on provided chart-data

    descPaint: Paint

    palet object used for drawing the description text in the bottom right corner of the chart

    disableScrollEnabled: boolean

    Wether to disable scroll while touching the chart. Default to true

    doubleTapGestureOptions: TapGestureHandlerOptions & { gestureTag?: number }
    dragDecelerationEnabled: boolean

    If set to true, chart continues to scroll after touch up

    dragDecelerationFrictionCoef: number

    Deceleration friction coefficient in [0 ; 1] interval, higher values indicate that speed will decrease slowly, for example if it set to 0, it will stop immediately. value must be < 1.0

    drawCenterText: boolean

    if enabled, centertext is drawn

    drawEntryLabels: boolean

    flag indicating if entry labels should be drawn or not

    drawHighlight: boolean
    drawHoleEnabled: boolean

    if true, the white hole inside the chart will be drawn

    drawMarkersEnabled: boolean

    if set to true, the marker view is drawn when a value is clicked

    drawRoundedSlices: boolean

    if true, the slices of the piechart are rounded

    drawSlicesUnderHoleEnabled: boolean

    if true, the hole will see-through to the inner tips of the slices

    extraBottomOffset: number
    extraLeftOffset: number
    extraRightOffset: number
    extraTopOffset: number

    Extra offsets to be appended to the viewport

    highlighter: IHighlighter
    highlightsFilterByAxis: boolean

    Wether to filter highlights by axis. Default is true

    indicesToHighlight: Highlight<Entry>[]

    array of Highlight objects that reference the highlighted slices in the chart

    jobs: any[]

    tasks to be done after the view is setup

    legendRenderer: LegendRenderer

    Gesture listener for custom callbacks when making gestures on the chart.

    marker: IMarker

    the view that represents the marker

    maxHighlightDistance: number

    The maximum distance in dp away from an entry causing it to highlight.

    mData: PieData

    object that holds all data that was originally set for the chart, before it was modified or any filtering algorithms had been applied

    mDescription: Description

    the object responsible for representing the description text

    mDisallowInterceptTouchEvent: boolean
    mHighlightPerTapEnabled: boolean

    Flag that indicates if highlighting per tap (touch) is enabled

    mInfoPaint: Paint

    palet object for drawing the information text when there are no values in the chart

    minOffset: number

    Sets the minimum offset (padding) around the chart, defaults to 0

    mLegend: Legend

    the legend object containing all data associated with the legend

    mMaxAngle: number
    mRotateEnabled: boolean

    flag that indicates if rotation is enabled or not

    noComputeAutoScaleOnNextDraw: boolean

    let the chart know it does not need to compute autoScale (it can used the cached ones)

    noComputeAxisOnNextDraw: boolean

    let the chart know it does not need to compute axis and legends (it can used the cached ones)

    noDataText: any

    text that is displayed when the chart is empty

    offsetsCalculated: any

    flag that indicates if offsets calculation has already been done or not

    panGestureOptions: PanGestureHandlerOptions & { gestureTag?: number }
    pinchGestureOptions: PinchGestureHandlerOptions & { gestureTag?: number }

    object responsible for rendering the data

    rotationGestureOptions: RotationGestureHandlerOptions & { gestureTag?: number }
    tapGestureOptions: TapGestureHandlerOptions & { gestureTag?: number }
    transparentCircleRadiusPercent: number

    the radius of the transparent circle that is drawn next to the hole in the piechart in percent of the maximum radius (max = the radius of the whole chart), default 55% -> means 5% larger than the center-hole by

    usePercentValues: boolean

    if true, the values inside the piechart are drawn as percent values

    viewPortHandler: ViewPortHandler

    object that manages the bounds and drawing constraints of the chart

    xAxis: XAxis

    the object representing the labels on the x-axis

    Accessors

    • get absoluteAngles(): number[]

      returns the absolute angles of the different chart slices (where the slices end)

      Returns number[]

    • get center(): { x: number; y: number }

      Returns a recyclable MPPointF instance. Returns the center polet of the chart (the whole View) in pixels.

      Returns { x: number; y: number }

    • get centerCircleBox(): MPPointF

      Returns the center of the circlebox

      Returns MPPointF

    • get centerOffsets(): { x: number; y: number }

      Returns a recyclable MPPointF instance. Returns the center of the chart taking offsets under consideration. (returns the center of the content rectangle)

      Returns { x: number; y: number }

    • get centerOfView(): { x: number; y: number }

      Returns a recyclable MPPointF instance.

      Returns { x: number; y: number }

    • get centerTextColor(): any

      Returns any

    • set centerTextColor(color: any): void

      Sets the color of the center text of the PieChart.

      Parameters

      • color: any

      Returns void

    • get centerTextOffset(): MPPointF

      Returns the offset on the x- and y-axis the center text has in dp.

      Returns MPPointF

    • set centerTextOffset(__namedParameters: { x: number; y: number }): void

      Sets the offset the center text should have from it's original position in dp. Default x = 0, y = 0

      Parameters

      • __namedParameters: { x: number; y: number }

      Returns void

    • get centerTextSize(): number

      Returns number

    • set centerTextSize(sizeDp: number): void

      Sets the size of the center text of the PieChart in dp.

      Parameters

      • sizeDp: number

      Returns void

    • get centerTextTypeface(): Font

      Returns Font

    • set centerTextTypeface(t: Font): void

      Sets the typeface for the center-text paint

      Parameters

      • t: Font

      Returns void

    • get chartBitmap(): any

      Returns the bitmap that represents the chart.

      Returns any

    • get contentRect(): RectF

      Returns the rectangle that defines the borders of the chart-value surface (into which the actual values are drawn).

      Returns RectF

    • get data(): T

      Returns the ChartData object that has been set for the chart.

      Returns T

    • set data(data: T): void

      Sets a new data object for the chart. The data object contains all values and information needed for displaying.

      Parameters

      • data: T

      Returns void

    • get description(): Description

      Returns the animator responsible for animating chart values.

      Returns Description

    • get diameter(): number

      returns the diameter of the pie- or radar-chart

      Returns number

    • get drawAngles(): number[]

      returns an integer array of all the different angles the chart slices have the angles in the returned array determine how much space (of 360°) each slice takes

      Returns number[]

    • set entryLabelColor(color: any): void

      Sets the color the entry labels are drawn with.

      Parameters

      • color: any

      Returns void

    • set entryLabelTextSize(size: any): void

      Sets the size of the entry labels in dp. Default: 13dp

      Parameters

      • size: any

      Returns void

    • set entryLabelTypeface(tf: any): void

      Sets a custom font for the drawing of the entry labels.

      Parameters

      • tf: any

      Returns void

    • set extraOffsets(value: [number, number, number, number]): void

      Sets extra offsets (around the chart view) to be appended to the auto-calculated offsets.

      Parameters

      • value: [number, number, number, number]

      Returns void

    • get hasValuesToHighlight(): boolean

      Returns true if there are values to highlight, false if there are no values to highlight. Checks if the highlight array is null, has a length of zero or if the first object is null.

      Returns boolean

    • get highlighted(): Highlight<Entry>[]

      Returns the array of currently highlighted values. This might a null or empty array if nothing is highlighted.

      Returns Highlight<Entry>[]

    • get highlightPerTapEnabled(): boolean

      Returns boolean

    • set highlightPerTapEnabled(enabled: boolean): void

      Parameters

      • enabled: boolean

      Returns void

    • get holeColor(): any

      Returns any

    • set holeColor(color: any): void

      Sets the color for the hole that is drawn in the center of the PieChart (if enabled).

      Parameters

      • color: any

      Returns void

    • get holeRadius(): number

      Returns the size of the hole radius in percent of the total radius.

      Returns number

    • set holeRadius(percent: number): void

      sets the radius of the hole in the center of the piechart in percent of the maximum radius (max = the radius of the whole chart), default 50%

      Parameters

      • percent: number

      Returns void

    • get infoPaint(): Paint

      Returns Paint

    • set lastHighlighted(highs: any): void

      Sets the last highlighted value for the touchlistener.

      Parameters

      • highs: any

      Returns void

    • get legend(): Legend

      Returns the Legend object of the chart. This method can be used to get an instance of the legend in order to customize the automatically generated Legend.

      Returns Legend

    • get length(): boolean

      Returns true if the chart is empty (meaning it's data object is either null or contains no entries).

      Returns boolean

    • get maxAngle(): number

      Returns number

    • set maxAngle(maxangle: number): void

      Sets the max angle that is used for calculating the pie-circle. 360 means it's a full PieChart, 180 results in a half-pie-chart. Default: 360

      Parameters

      • maxangle: number

        min 90, max 360

      Returns void

    • get maxVisibleValueCount(): number

      Returns number

    • get minAngleForSlices(): number

      The minimum angle slices on the chart are rendered with, default is 0.

      Returns number

      minimum angle for slices

    • set minAngleForSlices(minAngle: number): void

      Set the angle to set minimum size for slices, you must call #notifyDataSetChanged() and #invalidate() when changing this, only works if there is enough room for all slices to have the minimum angle.

      Parameters

      • minAngle: number

        minimum 0, maximum is half of #setMaxAngle

      Returns void

    • set noDataTextColor(color: any): void

      Sets the color of the no data text.

      Parameters

      • color: any

      Returns void

    • set noDataTextTypeface(tf: Font): void

      Sets the typeface to be used for the no data text.

      Parameters

      • tf: Font

      Returns void

    • get radius(): number

      Returns the radius of the chart in pixels.

      Returns number

    • get rawRotationAngle(): number

      gets the raw version of the current rotation angle of the pie chart the returned value could be any value, negative or positive, outside of the 360 degrees. this is used when working with rotation direction, mainly by gestures and animations.

      Returns number

    • get requiredBaseOffset(): number

      Returns the base offset needed for the chart without calculating the legend size.

      Returns number

    • get requiredLegendOffset(): number

      Returns the required offset for the chart legend.

      Returns number

    • get rotationAngle(): number

      gets a normalized version of the current rotation angle of the pie chart, which will always be between 0.0 < 360.0

      Returns number

    • set rotationAngle(angle: number): void

      Set an offset for the rotation of the RadarChart in degrees. Default 270 --> top (NORTH)

      Parameters

      • angle: number

      Returns void

    • get rotationEnabled(): boolean

      Returns true if rotation of the chart by touch is enabled, false if not.

      Returns boolean

    • set rotationEnabled(enabled: boolean): void

      Set this to true to enable the rotation / spinning of the chart by touch. Set it to false to disable it. Default: true

      Parameters

      • enabled: boolean

      Returns void

    • set transparentCircleAlpha(alpha: any): void

      Sets the amount of transparency the transparent circle should have 0 = fully transparent, 255 = fully opaque. Default value is 100.

      Parameters

      • alpha: any

        0-255

      Returns void

    • set transparentCircleColor(color: any): void

      Sets the color the transparent-circle should have.

      Parameters

      • color: any

      Returns void

    • get viewPortScaleX(): number

      Returns number

    • get viewPortScaleY(): number

      Returns number

    • get xChartMax(): number

      Returns the maximum x value of the chart, regardless of zoom or translation.

      Returns number

    • get xChartMin(): number

      Returns the minimum x value of the chart, regardless of zoom or translation.

      Returns number

    • get xRange(): number

      Returns number

    • get yChartMax(): number

      Returns the maximum y value of the chart, regardless of zoom or translation.

      Returns number

    • get yChartMin(): number

      Returns the minimum y value of the chart, regardless of zoom or translation.

      Returns number

    • get yMax(): number

      returns the current y-max value across all DataSets

      Returns number

    • get yMin(): number

      returns the current y-min value across all DataSets

      Returns number

    Methods

    • Called in android when native view is dettached from window.

      Returns void

    • Parameters

      • arg: string | GestureTypes
      • callback: (data: EventData) => void
      • OptionalthisArg: any

      Returns void

    • Either posts a job immediately if the chart has already setup it's dimensions or adds the job to the execution queue.

      Parameters

      Returns void

    • Animates the rendering of the chart on the x-axis with the specified animation time. If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart. ANIMATIONS ONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.

      Parameters

      • durationMillis: any
      • Optionaleasing: EasingFunction

        a custom easing function to be used on the animation phase

      Returns void

    • Animates the drawing / rendering of the chart on both x- and y-axis with the specified animation time. If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart. ANIMATIONS ONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.

      Parameters

      • durationMillisX: any
      • durationMillisY: any
      • OptionaleasingX: EasingFunction

        a custom easing function to be used on the animation phase

      • OptionaleasingY: EasingFunction

        a custom easing function to be used on the animation phase

      Returns void

    • Animates the rendering of the chart on the y-axis with the specified animation time. If animate(...) is called, no further calling of invalidate() is necessary to refresh the chart. ANIMATIONS ONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.

      Parameters

      • durationMillis: any
      • Optionaleasing: EasingFunction

        a custom easing function to be used on the animation phase

      Returns void

    • Calculates the y-min and y-max value and the y-delta and x-delta value

      Returns void

    • Calculates the offsets of the chart to the border depending on the position of an eventual legend or depending on the length of the y-axis and x-axis labels and their position

      Returns void

    • Clears the chart from all data (sets it to null) and refreshes it (by calling invalidate()).

      Returns void

    • Removes all DataSets (and thereby Entries) from the chart. Does not set the data object to null. Also refreshes the chart by calling invalidate().

      Returns void

    • disables intercept touchevents

      Returns void

    • Clean up references to the native view.

      Returns void

    • Returns the distance of a certain polet on the chart to the center of the chart.

      Parameters

      • x: number
      • y: number

      Returns number

    • Parameters

      • canvas: Canvas

      Returns void

    • Draws the description text in the bottom right corner of the chart (per default)

      Parameters

      • c: Canvas

      Returns void

    • draws all MarkerViews on the highlighted positions

      Parameters

      • canvas: Canvas

      Returns void

    • enables intercept touchevents

      Returns void

    • Returns the angle relative to the chart center for the given polet on the chart in degrees. The angle is always between 0 and 360°, 0° is NORTH, 90° is EAST, ...

      Parameters

      • x: any
      • y: any

      Returns number

    • Returns the index of the DataSet this x-index belongs to.

      Parameters

      • xIndex: number

      Returns number

    • Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch polet inside the Line-, Scatter-, or CandleStick-Chart.

      Parameters

      • x: any
      • y: any

      Returns Highlight<Entry>

    • Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch polet inside the Line-, Scatter-, or CandleStick-Chart.

      Parameters

      • xValue: any

      Returns Highlight<Entry>[]

    • Returns the Highlights (contains x-index and DataSet index) of the selected value at the given touch polet inside the Line-, Scatter-, or CandleStick-Chart.

      Parameters

      • x: any
      • y: any

      Returns Highlight<Entry>[]

    • Returns the xIndex for the given angle around the center of the chart. Returns -1 if not found / outofbounds.

      Parameters

      • angle: number

      Returns number

    • Returns all jobs that are scheduled to be executed after onSizeChanged(...).

      Returns any[]

    • Returns the actual position in pixels of the MarkerView for the given Highlight object.

      Parameters

      Returns number[]

    • Returns a recyclable MPPointF instance. Calculates the position around a center point, depending on the distance from the center, and the angle of the position around the center.

      Parameters

      • center: MPPointF
      • dist: number
      • angle: number

        in degrees, converted to radians internally

      • OptionaloutputPoint: MPPointF

      Returns MPPointF

    • Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a callback to the OnChartValueSelectedListener.

      Parameters

      Returns void

    • Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a callback to the OnChartValueSelectedListener.

      Parameters

      • highs: Highlight<Entry>[]
      • OptionalcallListener: boolean

        call the listener

      Returns void

    • Highlights any y-value at the given x-value in the given DataSet. Provide -1 as the dataSetIndex to undo all highlighting.

      Parameters

      • x: any

        The x-value to highlight

      • y: any

        The y-value to highlight. Supply NaN for "any"

      • dataSetIndex: any

        The dataset index to search in

      • OptionalcallListener: boolean

        Should the listener be called for this change

      Returns void

    • Highlights the values at the given indices in the given DataSets. Provide null or an empty array to undo all highlighting. This should be used to programmatically highlight values. This method will not call the listener.

      Parameters

      • highs: any

      Returns void

    • initialize all paints and stuff

      Returns void

    • Initializes properties/listeners of the native view.

      Returns void

    • Checks if the given index is set to be highlighted.

      Parameters

      • index: number

      Returns boolean

    • Lets the chart know its underlying data has changed and performs all necessary recalculations. It is crucial that this method is called everytime data is changed dynamically. Not calling this method can lead to crashes or unexpected behaviour.

      Returns void

    • Parameters

      • canvas: Canvas

      Returns void

    • Called from layout when this view should assign a size and position to each of its children. Derived classes with children should override this method and call layout on each of their children.

      Parameters

      • left: number

        Left position, relative to parent

      • top: number

        Top position, relative to parent

      • right: number

        Right position, relative to parent

      • bottom: number

        Bottom position, relative to parent

      Returns void

    • Parameters

      • w: number
      • h: number

      Returns void

    • Parameters

      • w: number
      • h: number
      • oldw: number
      • oldh: number

      Returns void

    • Parameters

      • arg: string | GestureTypes
      • Optionalcallback: any
      • OptionalthisArg: any

      Returns void

    • RESET PERFORMANCE TRACKING FIELDS

      Returns void

    • Sets extra offsets (around the chart view) to be appended to the auto-calculated offsets.

      Parameters

      • left: any
      • top: any
      • right: any
      • bottom: any

      Returns void

    • Calculates the required number of digits for the values that might be drawn in the chart (if enabled), and creates the default-value-formatter

      Parameters

      • min: any
      • max: any

      Returns void