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

Type Parameters

Hierarchy (View Summary)

Constructors

Properties

Accessors

Methods

Constructors

Properties

animator: ChartAnimator

object responsible for animations

chartTouchListener: PieRadarChartTouchListener
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

drawHighlight: boolean
drawMarkersEnabled: boolean

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

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: T

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

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 }
radius: number

Returns the radius of the chart in pixels.

renderer: DataRenderer

object responsible for rendering the data

requiredBaseOffset: number

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

requiredLegendOffset: number

Returns the required offset for the chart legend.

rotationGestureOptions: RotationGestureHandlerOptions & { gestureTag?: number }
tapGestureOptions: TapGestureHandlerOptions & { gestureTag?: number }
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 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 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 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

  • 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 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 maxVisibleValueCount(): number
  • Returns number

  • 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 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 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

  • 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

  • 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

  • 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 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: any

    Returns any

  • 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

  • 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

  • Parameters

    • job: 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