PieChart class
A pie or donut chart widget.
Renders values as proportional angular slices within a circular area of width×height cells. Terminal cell aspect ratio is compensated by cellAspect.
PieChart(
values: [30, 20, 50],
width: 20,
height: 10,
donut: true,
sliceStyles: [
UvStyle(bg: UvColor.rgb(230, 57, 70)),
UvStyle(bg: UvColor.rgb(42, 157, 143)),
UvStyle(bg: UvColor.rgb(233, 196, 106)),
],
)
- Inheritance
Constructors
-
PieChart({required List<
double> values, int? width, int? height, List<UvStyle> ? sliceStyles, bool useBackground = true, bool donut = false, double innerRadiusRatio = 0.45, double cellAspect = 2.0, String glyph = ' ', List<ChartLegendEntry> ? legendEntries, int legendColumns = 1, int legendRowGap = 0, ChartLegendPosition legendPosition = ChartLegendPosition.topRight, int legendPadding = 1, int? crosshairX, int? crosshairY, UvStyle? crosshairStyle, Key? key}) - Creates a PieChart with the given data and display options.
Properties
- cellAspect → double
-
Width-to-height ratio of terminal cells for circle compensation.
final
-
children
→ List<
Widget> -
Child widgets that receive forwarded messages.
no setterinherited
- crosshairStyle → UvStyle?
-
Style for the crosshair lines.
final
- crosshairX → int?
-
X coordinate for crosshair overlay, or null to hide.
final
- crosshairY → int?
-
Y coordinate for crosshair overlay, or null to hide.
final
- debugRenderObjectPassthrough → bool
-
Whether this widget is intentionally transparent to render-object layouts.
no setterinherited
- donut → bool
-
Whether to cut out an inner circle (donut mode).
final
- focusable → bool
-
Whether this widget can receive keyboard focus.
no setterinherited
- glyph → String
-
Character rendered in background mode.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → int?
-
The chart height in terminal rows, or null to fill available space.
final
- id → String
-
Unique identifier for this widget.
no setterinherited
- innerRadiusRatio → double
-
Inner radius as a fraction of outer radius in donut mode.
final
- key → Key?
-
Key for preserving widget identity.
finalinherited
- legendColumns → int
-
Number of legend columns.
final
-
legendEntries
→ List<
ChartLegendEntry> ? -
Optional legend entries rendered inside chart bounds.
final
- legendPadding → int
-
Inner padding from chart edges to legend area.
final
- legendPosition → ChartLegendPosition
-
Legend placement within chart bounds.
final
- legendRowGap → int
-
Empty rows inserted between legend rows.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sliceStyles
→ List<
UvStyle> ? -
Per-slice styles. If null, default empty styles are used.
final
- theme → Theme
-
Access the current theme.
no setterinherited
- useBackground → bool
-
If true, slices are rendered as coloured backgrounds.
final
-
values
→ List<
double> -
The slice sizes (proportional, not normalised).
final
- width → int?
-
The chart width in terminal columns, or null to fill available space.
final
Methods
-
buildCachedView<
T> (T builder(), Object? cacheKey) → T -
Returns a cached view if the cache key matches.
inherited
-
createRenderObject(
) → RenderObject -
override
-
didUnmountRenderObject(
RenderObject renderObject) → void -
inherited
-
handleInit(
) → Cmd? -
Override this instead of init for widget-specific initialization.
inherited
-
handleIntercept(
Msg msg) → (Widget, Cmd?) -
Override this to handle messages before they reach children.
inherited
-
handleUpdate(
Msg msg) → (Widget, Cmd?) -
Override this to handle messages specific to this widget.
inherited
-
init(
) → Cmd? -
Called once when the widget is first mounted.
inherited
-
invalidateCachedView(
) → void -
Clears any cached view for this widget.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
Msg msg) → (Model, Cmd?) -
Handles messages by forwarding to children then calling handleUpdate.
inherited
-
updateRenderObject(
RenderObject renderObject) → void -
override
-
view(
) → Object -
Renders the widget to a string or View.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited