ChartDrawing class

Represents a persistent interactive user drawing on the chart canvas.

Constructors

ChartDrawing({required String id, required DrawingTool tool, required List<DrawingPoint> points, Color color = const Color(0xFF2962FF), double strokeWidth = 1.8, bool isLocked = false, bool isSelected = false, Map<String, dynamic> properties = const {}, String label = ''})
const
ChartDrawing.fromJson(Map<String, dynamic> json)
factory

Properties

color → Color
final
hashCode → int
The hash code for this object.
no setterinherited
id → String
final
isLocked → bool
final
isSelected → bool
final
label → String
Text content for DrawingTool.textLabel drawings.
final
points → List<DrawingPoint>
final
properties → Map<String, dynamic>
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
strokeWidth → double
final
tool → DrawingTool
final

Methods

copyWith({String? id, DrawingTool? tool, List<DrawingPoint>? points, Color? color, double? strokeWidth, bool? isLocked, bool? isSelected, Map<String, dynamic>? properties, String? label}) → ChartDrawing
getHandleCursor(int handleIndex) → MouseCursor
Returns the appropriate MouseCursor when hovering over a handle.
getHandleOffsets(Rect bounds, PriceRange priceRange, CoordinateConverter converter) → List<Offset>
Returns pixel positions of all interactive handles for this drawing.
hitTest(Offset pos, Rect bounds, PriceRange priceRange, CoordinateConverter converter, {double threshold = 8.0}) → bool
Checks if pos hits this drawing (near line, inside box, or near handles).
hitTestHandle(Offset pos, Rect bounds, PriceRange priceRange, CoordinateConverter converter, {double threshold = 12.0}) → int?
Checks if pos falls within threshold pixels of any handle on this drawing.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

distanceToSegment(Offset p, Offset a, Offset b) → double
Calculates perpendicular distance from point p to segment between a and b.