PieRadarChartBase<T extends ChartData<IDataSet<Entry>>> class abstract

Base class of the round charts, PieChart and RadarChart. It adds rotation by touch and the angle and distance helpers around the chart center. Angles are in degrees, 0 at 3 o'clock, increasing clockwise.

T is the ChartData type this chart displays, fixed by each subclass.

Inheritance
Implementers

Constructors

PieRadarChartBase()

Properties

afterDrawListeners → List<void Function()>
Called at the end of every onDraw, in list order: after the markers, or after the empty state.
finalinherited
animator ↔ ChartAnimator
Runs the animations: the x and y phases of animateX, animateY and animateXY, and the value animations.
getter/setter pairinherited
center → MPPointF
Center of the whole chart in pixels, ignoring offsets. See centerOffsets for the content center.
no setterinherited
centerOffsets → MPPointF
Center of the content rectangle in pixels, as a fresh MPPointF.
no setterinherited
centerOfView → MPPointF
Center of the whole chart view in pixels, as a fresh MPPointF.
no setterinherited
chartTouchListener ↔ ChartTouchListener<Chart<ChartData<IDataSet<Entry>>>>
Handles touch events for this chart. Replace it to customize gestures; isTouchEnabled must stay true.
getter/setter pairinherited
contentRect → MutableRect
Rectangle in pixels in which the data is drawn, the view minus axis, legend and extra offsets.
no setterinherited
data ↔ T?
The data this chart displays, or null when nothing has been set.
getter/setter pairinherited
defaultValueFormatter → IValueFormatter
Formatter the chart computed from its data, used by data sets that have no formatter of their own.
no setterinherited
defaultValueFormatterInternal → DefaultValueFormatter
Formatter used for data sets without their own. Its digit count follows the y range of the data.
finalinherited
description ↔ Description
The description text drawn in the bottom right corner by default.
getter/setter pairinherited
descriptionPaint ↔ ChartPaint
Paint used for the description text.
getter/setter pairinherited
diameter → double
Largest circle diameter in pixels that fits the content area after the extra offsets.
no setter
dragDecelerationFrictionCoef ↔ double
How slowly a deceleration scroll loses speed, between 0 (stops at once) and 0.999. Values outside that range are clamped. Default 0.9.
getter/setter pairinherited
extraBottomOffset ↔ double
Extra space in dp added below the content area on top of the calculated offsets.
getter/setter pairinherited
extraLeftOffset ↔ double
Extra space in dp added left of the content area on top of the calculated offsets.
getter/setter pairinherited
extraRightOffset ↔ double
Extra space in dp added right of the content area on top of the calculated offsets.
getter/setter pairinherited
extraTopOffset ↔ double
Extra space in dp added above the content area on top of the calculated offsets.
getter/setter pairinherited
gestureListeners → List<OnChartGestureListener>
Additional gesture listeners, notified after onChartGestureListener in list order.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
height ↔ double
Height of the chart in logical pixels, View.getHeight(). Set by onSizeChanged.
getter/setter pairinherited
highlighted ↔ List<Highlight>
The values currently highlighted. Empty, never null, when nothing is highlighted.
getter/setter pairinherited
highlighter ↔ IHighlighter
Turns a touch position into the Highlight of the nearest value.
getter/setter pairinherited
host ↔ ChartHost?
What shows this chart on screen and receives its redraw, post and scroll requests, or null. The widget layer's render object assigns itself here while it is attached.
getter/setter pairinherited
infoPaint ↔ ChartPaint
Paint used for the no-data text.
getter/setter pairinherited
isAnimating → bool
True while any animation runs: animateX, animateY, animateXY, a spin, animateValue or animateDataChange.
no setterinherited
isChartTouchListenerInitialized → bool
Whether chartTouchListener has been assigned, Kotlin's ::chartTouchListener.isInitialized.
no setterinherited
isDragDecelerationEnabled ↔ bool
Whether the chart keeps scrolling after the finger is lifted.
getter/setter pairinherited
isDrawMarkersEnabled ↔ bool
Whether the marker is drawn at highlighted values.
getter/setter pairinherited
isEmpty → bool
True when there is no data or the data holds no entries.
no setterinherited
isHighlightPerTapEnabled ↔ bool
Whether a tap highlights the nearest value. Values can still be highlighted by drag or in code.
getter/setter pairinherited
isLoading ↔ bool
Whether the data is on its way. While true and the chart has nothing to draw, the empty state shows loadingText and its icon pulses. Data that arrives is drawn as usual, so this can stay true until then.
getter/setter pairinherited
isLogEnabled ↔ bool
Prints chart internals with debugPrint while true. Slows down drawing, so keep it off in production.
getter/setter pairinherited
isNoDataIconEnabled ↔ bool
Whether the empty state draws an icon above its text: noDataIcon, or a small outline of this chart type.
getter/setter pairinherited
isRendererInitialized → bool
Whether renderer has been assigned, Kotlin's ::renderer.isInitialized.
no setterinherited
isRotationEnabled ↔ bool
Whether the chart can be rotated by dragging. Default true.
getter/setter pair
isTouchEnabled ↔ bool
Whether the chart reacts to touch at all. False disables tapping, dragging, scaling and rotating.
getter/setter pairinherited
isUnbindEnabled ↔ bool
Kept for API parity; it has no effect. On Android it releases the background drawable and the child views when the chart leaves the window; a Flutter chart has neither.
getter/setter pairinherited
jobs → List<void Function()>
Viewport jobs waiting for the chart to get a size. They run once in onSizeChanged.
finalinherited
legend ↔ Legend
The legend component. It is filled from the data sets unless a custom legend is set on it.
getter/setter pairinherited
legendLabelPaint ↔ ChartPaint
Paint used for legend labels.
getter/setter pairinherited
legendRenderer ↔ LegendRenderer
Draws the legend.
getter/setter pairinherited
loadingText ↔ String
Text of the empty state while isLoading is true.
getter/setter pairinherited
marker ↔ IMarker?
Marker drawn at each highlighted value, or null for none. A MarkerView or MarkerImage is attached to this chart when set.
getter/setter pairinherited
maxHighlightDistance ↔ double
Farthest distance in dp a touch may be from a value and still highlight it. Default 500.
getter/setter pairinherited
maxVisibleCount → int
The number of entries of the data, or 0 without data.
no setteroverride
minOffset ↔ double
Smallest space in dp between the view edge and the chart on every side. Default 0.
getter/setter pair
noDataIcon ↔ ChartDrawable?
Icon drawn above the empty state text instead of the outline of this chart type, or null for the outline.
getter/setter pairinherited
noDataIconColor ↔ Color
Color of the chart type outline in the empty state. Default a faint slate that reads on light and dark backgrounds.
getter/setter pairinherited
noDataText ↔ String
Text of the empty state, drawn while the chart has no data or data without entries. An empty string draws only the icon.
getter/setter pairinherited
noDataTextAlignment ↔ PaintAlign
Horizontal alignment of the empty state: at the left edge, in the center or at the right edge of the chart.
getter/setter pairinherited
noDataTextColor ↔ Color
Color of noDataText and loadingText.
getter/setter pairinherited
noDataTextSize ↔ double
Size of noDataText and loadingText in dp. Default 13.
getter/setter pairinherited
noDataTextTypeface ↔ Typeface
Typeface of noDataText and loadingText; null sets the default. Default sans serif medium.
getter/setter pairinherited
onChartGestureListener ↔ OnChartGestureListener?
Single listener told about gestures such as tap, double tap, drag, scale and fling.
getter/setter pairinherited
onChartValueSelectedListener ↔ OnChartValueSelectedListener?
Single listener told when a value is selected or the selection is cleared.
getter/setter pairinherited
radius → double
Radius of the drawn chart in pixels.
no setter
rawRotationAngle → double
The last value given to rotationAngle before normalizing, in degrees, which may be negative or above 360. Default 270.
no setter
renderer ↔ DataRenderer
Draws the data. Each chart type installs its own renderer; replace it for custom drawing.
getter/setter pairinherited
requiredBaseOffset → double
Space in pixels the chart needs left and right of itself before the legend is considered.
no setter
requiredLegendOffset → double
Space in pixels the legend needs between itself and the chart.
no setter
requiredVerticalBaseOffset → double
Space in pixels the chart needs above and below itself before the legend is considered. The same as requiredBaseOffset unless a chart needs less room there, as a radar chart does: its labels reach as far sideways as they are wide, but only as far up and down as they are tall.
no setter
rotationAngle ↔ double
Angle in degrees at which the first slice or entry starts, normalized to 0 (inclusive) until 360 (exclusive). Default 270, the top of the chart. Setting it also stores the unnormalized value in rawRotationAngle.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showsEmptyState → bool
Whether the chart has no data or no entries and draws its empty state instead of the data.
no setterinherited
valueSelectedListeners → List<OnChartValueSelectedListener>
Additional listeners, notified after onChartValueSelectedListener in list order. Meant for observers that must not replace the app's own listener, such as a widget's chart controller.
finalinherited
viewPortHandler ↔ ViewPortHandler
Holds the chart size, the content rectangle and the zoom and drag matrix.
getter/setter pairinherited
width ↔ double
Width of the chart in logical pixels, View.getWidth(). Set by onSizeChanged.
getter/setter pairinherited
xAxis ↔ XAxis
The x axis component: its labels, range, grid lines and position.
getter/setter pairinherited
xChartMax → double
Largest x value of the x axis, independent of zoom and drag.
no setterinherited
xChartMin → double
Smallest x value of the x axis, independent of zoom and drag.
no setterinherited
xRange → double
Difference between xChartMax and xChartMin.
no setterinherited
yChartMax → double
Always 0: a round chart has no y axis.
no setteroverride
yChartMin → double
Always 0: a round chart has no y axis.
no setteroverride
yMax → double
Largest y value across all data sets, or 0 without data.
no setterinherited
yMin → double
Smallest y value across all data sets, or 0 without data.
no setterinherited

Methods

addViewportJob(void job()) → void
Runs a viewport job once the chart has a size: posted right away when it already has one, otherwise stored in jobs until onSizeChanged. The zoom and move functions use this, passing a job's run. At most 64 jobs wait, because only the last position matters and a chart that never gets a size would otherwise collect them forever.
inherited
animateDataChange(T newData, int durationMillis, {EasingFunction easing = Easing.Linear, void onEnd() = _noop}) → void
Sets newData and animates every entry from the value it replaces to its own value. Entries are paired by data set index and entry index; entries past the old end grow from 0, entries past the new end are gone at once. Stacked bars animate each stack value, candles open, high, low and close, bubbles their size and pie slices their value. The axis ranges follow on every frame and highlights stay on their x value.
inherited
animateValue(Entry entry, double toY, int durationMillis, {EasingFunction easing = Easing.Linear, void onEnd() = _noop}) → void
Animates the y value of one entry to toY. The axis ranges follow the value on every frame. Works for line, bar, scatter, bubble, pie and radar entries. A running animation of the same entry is cancelled first and the new one starts from the current value. Setting data ends the animation with the entry at toY.
inherited
animateX(int durationMillis, {EasingFunction easing = Easing.Linear, void onEnd() = _noop}) → void
Animates the drawing of the data along the x axis. The chart redraws itself while animating. A running x animation is cancelled first.
inherited
animateXY(int durationMillisX, int durationMillisY, {EasingFunction easingX = Easing.Linear, EasingFunction? easingY, void onEnd() = _noop}) → void
Animates the drawing of the data along both axes. The chart redraws itself while animating. Running x and y animations are cancelled first.
inherited
animateY(int durationMillis, {EasingFunction easing = Easing.Linear, void onEnd() = _noop}) → void
Animates the drawing of the data along the y axis. The chart redraws itself while animating. A running y animation is cancelled first.
inherited
calcMinMax() → void
Computes the axis ranges from the data.
override
calculateOffsets() → void
Computes the content rectangle from the legend, the offsets the chart requires, the extra offsets and minOffset.
override
clear() → void
Sets data to null, clears the highlight and redraws, which shows noDataText.
inherited
clearAllViewportJobs() → void
Drops all jobs waiting in jobs.
inherited
clearValues() → void
Removes all data sets from data but keeps the data object, then redraws. Does nothing without data.
inherited
computeScroll() → void
Advances the rotation deceleration of the chartTouchListener by one frame.
override
disableScroll() → void
Keeps the current gesture with the chart, so an enclosing scrollable does not take it over (requestDisallowInterceptTouchEvent(true) on Android).
inherited
distanceToCenter(double x, double y) → double
Distance in pixels between the pixel position (x, y) and the content center.
drawDescription(Canvas c) → void
Draws the description text at its position, or in the bottom right corner when it has none.
inherited
drawEmptyState(Canvas canvas) → void
Draws the empty state: the icon and noDataText, or loadingText while isLoading, as one block centered vertically and placed horizontally by noDataTextAlignment. Override it to draw an empty state of your own.
inherited
drawMarkers(Canvas canvas) → void
Draws the marker at every highlighted value that lies inside the content area.
inherited
drawNoDataIcon(Canvas canvas, MutableRect bounds, ChartPaint paint) → void
Draws the outline of this chart type that the empty state shows above its text, inside bounds, with paint in noDataIconColor. The default draws three bars; line, pie, radar, scatter and bubble charts draw their own shape.
inherited
enableScroll() → void
Lets an enclosing scrollable take over gestures again (requestDisallowInterceptTouchEvent(false) on Android).
inherited
getAngleForPoint(double x, double y) → double
Angle in degrees of the pixel position (x, y) around the content center: 0 at 3 o'clock, 90 at 6 o'clock, 180 at 9 o'clock, 270 at 12 o'clock; from 0 (inclusive) to 360 (exclusive) for a finite position. The center itself yields 90.
getHighlightByTouchPoint(double x, double y) → Highlight?
Finds the value nearest to a touch position.
inherited
getIndexForAngle(double angle) → int
Index of the entry lying under angle around the center, taking rotationAngle into account.
getMarkerPosition(Highlight high) → Float32List
Pixel position where the marker for high is drawn, as [x, y].
inherited
getPosition(MPPointF center, double dist, double angle, [MPPointF? outputPoint]) → MPPointF
Pixel position at the distance dist in pixels and the angle angle in degrees (0 at 3 o'clock, increasing clockwise) from the point center in pixels.
highlightValue(double x, int dataSetIndex, {double y = double.nan, int dataIndex = -1, int stackIndex = -1, bool callListener = true}) → void
Highlights the entry closest to the given x value (and, when y is a number, closest to y among entries with the same x) in one data set and redraws.
inherited
highlightValueOf(Highlight? highlight, {bool callListener = true}) → void
Highlights the value described by highlight and redraws. This is what a tap calls. Null, or a highlight that matches no entry, clears the highlight instead.
inherited
highlightValues(List<Highlight> highs) → void
Highlights all the given values at once and redraws. The list is taken as is, without checking that the entries exist, and no listener is called. An empty list clears the highlight.
inherited
init() → void
Creates the components, paints and animator. Subclasses add their renderer, highlighter and touch listener.
override
invalidate() → void
Requests a redraw from the host, View.invalidate(). Does nothing without a host.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyAfterDraw() → void
Calls each of afterDrawListeners. onDraw calls it once at its very end; a chart type that overrides onDraw and draws after super.onDraw calls it at the end of its own onDraw instead, as BarLineChartBase, PieChart and RadarChart do.
inherited
notifyDataSetChanged() → void
Refreshes the data, recalculates axis ranges, legend and offsets and redraws. Call it after changing entries or data sets in place. Does nothing while data is null.
override
onDetachedFromWindow() → void
Also stops a running rotation deceleration, whose ticker runs on the host's vsync.
override
onDraw(Canvas canvas) → void
Draws the chart onto canvas, whose origin is the top left corner of the chart, View.onDraw.
inherited
onHostVsyncChanged() → void
Also stops a running rotation deceleration, whose ticker runs on the previous vsync. Not in Kotlin.
override
onSizeChanged(double w, double h) → void
Sets the chart size to w x h, View.onSizeChanged: the host calls it when the laid out size changes.
inherited
onTouchEvent(ChartTouchEvent event) → bool
Passes event to the chartTouchListener while isTouchEnabled is true and a listener is assigned, and returns what it returns; otherwise consumes nothing.
override
onValueSelected(void onValueSelected(Entry entry, Highlight highlight), {void onNothingSelected() = _noop}) → void
Replaces onChartValueSelectedListener with functions.
inherited
post(void job()) → void
Runs job after the current frame through the host, View.post(Runnable), or at once without a host.
inherited
removeViewportJob(void job()) → void
Removes a job from jobs before it has run.
inherited
setExtraOffsets(double left, double top, double right, double bottom) → void
Sets all four extra offsets in dp at once. They apply on the next offset calculation.
inherited
setLastHighlighted(List<Highlight>? highs) → void
Tells the touch listener which highlight a tap must toggle off next.
inherited
setupDefaultFormatter(double min, double max) → void
Sets the digit count of the default value formatter from the value range.
inherited
spin(int durationMillis, double fromAngle, double toAngle, {EasingFunction easing = Easing.Linear, void onEnd()?}) → void
Animates rotationAngle from one angle to another and redraws on every step. A running spin is cancelled first.
stopAnimations() → void
Ends every running animation at once at its final state: the drawing is complete, a spin stands at its end angle and animated values hold their targets. Each onEnd runs. Leaving the window does the same.
inherited
toImage({int? width, int? height, double pixelRatio = 1.0}) → Future<Image>
Draws the chart into a new image, over white. Kotlin's toBitmap.
inherited
toPngBytes({int? width, int? height, double pixelRatio = 1.0}) → Future<Uint8List>
Draws the chart like toImage and encodes the image as PNG.
inherited
toString() → String
A string representation of this object.
inherited
valuesToHighlight() → bool
True when at least one value is highlighted.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited