PieData class

Represents a segment in a pie or donut chart.

Each segment has a label, a numeric value, and a color for visualization. The percentage is calculated automatically based on the total of all segments.

This is an immutable value class used for pie, donut, pyramid, and funnel charts.

Example

const PieData(
  label: 'Mobile',
  value: 45.0,
  color: Colors.blue,
)

See also:

Constructors

PieData({required String label, double value = 0.0, required Color color, bool showValue = true, bool showLabel = true, double circleSize = 18.0})
Creates a pie chart segment.
const

Properties

circleSize double
width and height
final
color Color
The color used to render this segment.
final
hashCode int
The hash code for this object.
no setteroverride
label String
The label displayed in the legend and tooltips.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showLabel bool
final
showValue bool
Whether to show the value for this segment.
final
value double
The numeric value of this segment.
final

Methods

copyWith({String? label, double? value, Color? color, bool? showValue}) PieData
Creates a copy of this pie data with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override