onPaint method

  1. @override
void onPaint(
  1. PaintingContext context,
  2. Offset offset,
  3. SfChartThemeData chartThemeData,
  4. ThemeData themeData,
)

Override this method to customize the crosshair tooltips & line rendering.

Implementation

@override
void onPaint(PaintingContext context, Offset offset,
    SfChartThemeData chartThemeData, ThemeData themeData) {
  final RenderBehaviorArea? parent = parentBox as RenderBehaviorArea?;
  if (_position == null || parent == null) {
    return;
  }

  if (parent.paintBounds.contains(_position!)) {
    _drawCrosshairLines(context, _position!, parent, chartThemeData);
    _drawCrosshairTooltip(context, parent);
  }
}