PointAnnotation class

A point annotation that marks a specific data point with a custom marker.

Example:

PointAnnotation(
  id: 'peak',
  seriesId: 'temperature',
  dataPointIndex: 42,
  markerShape: MarkerShape.star,
  markerSize: 12.0,
  markerColor: Colors.red,
)

id is force-excluded from the fluent surface: an annotation id is a JOIN KEY — selection state, hit-testing and artifact documents bind to it — so a verb that rewrites it mid-chain silently detaches the annotation from everything that references it. Construct the annotation with the id it should carry.

Inheritance
Available extensions
Annotations
  • @ChartSurface.new(excluded: ['id'])

Constructors

PointAnnotation({String? id, String? label, AnnotationStyle style = const AnnotationStyle(), bool allowDragging = false, bool allowEditing = false, int zIndex = 0, required String seriesId, required int dataPointIndex, Offset offset = Offset.zero, MarkerShape markerShape = MarkerShape.circle, double markerSize = 8.0, Color markerColor = Colors.blue, double labelMargin = 4.0})
Creates a point annotation.

Properties

allowDragging bool
Whether this annotation can be dragged by the user.
finalinherited
allowEditing bool
Whether this annotation can be edited by the user.
finalinherited
dataPointIndex int
The index of the data point within the series (must be >= 0).
final
hashCode int
The hash code for this object.
no setterinherited
id String
Unique identifier for this annotation.
getter/setter pairinherited
label String?
Optional label for this annotation.
finalinherited
labelMargin double
The spacing between the marker edge and the label container edge.
final
markerColor Color
The fill color of the marker.
final
markerShape MarkerShape
The shape of the marker to draw.
final
markerSize double
The size of the marker in logical pixels.
final
offset Offset
Optional offset from the data point position.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
seriesId String
The ID of the series containing the data point to annotate.
final
snapIncrement double
The increment to snap to when snapToValue is enabled.
finalinherited
snapToValue bool
Whether to snap annotation values to nearest data point values when dragging.
finalinherited
style AnnotationStyle
Visual style configuration for this annotation.
finalinherited
zIndex int
Rendering order for this annotation.
finalinherited

Methods

clearLabel() PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Clears PointAnnotation.label to null.
copyWith({String? id, String? label, AnnotationStyle? style, bool? allowDragging, bool? allowEditing, int? zIndex, String? seriesId, int? dataPointIndex, Offset? offset, MarkerShape? markerShape, double? markerSize, Color? markerColor, double? labelMargin, bool clearLabel = false}) PointAnnotation
Creates a copy with modified properties.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this annotation to JSON.
toString() String
A string representation of this object.
inherited
updateStyle(AnnotationStyle update(AnnotationStyle current)) PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Rebuilds PointAnnotation.style from its current value.
withAllowDragging(bool value) PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Replaces PointAnnotation.allowDragging with value.
withAllowEditing(bool value) PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Replaces PointAnnotation.allowEditing with value.
withDataPointIndex(int value) PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Replaces PointAnnotation.dataPointIndex with value.
withLabel(String value) PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Replaces PointAnnotation.label with value.
withLabelMargin(double value) PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Replaces PointAnnotation.labelMargin with value.
withMarkerColor(Color value) PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Replaces PointAnnotation.markerColor with value.
withMarkerShape(MarkerShape value) PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Replaces PointAnnotation.markerShape with value.
withMarkerSize(double value) PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Replaces PointAnnotation.markerSize with value.
withOffset(Offset value) PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Replaces PointAnnotation.offset with value.
withSeriesId(String value) PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Replaces PointAnnotation.seriesId with value.
withStyle(AnnotationStyle value) PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Replaces PointAnnotation.style with value.
withZIndex(int value) PointAnnotation

Available on PointAnnotation, provided by the PointAnnotationFluent extension

Replaces PointAnnotation.zIndex with value.

Operators

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