show method

void show(
  1. dynamic x,
  2. double y, [
  3. String coordinateUnit = 'point'
])

Displays the crosshair at the specified x and y-positions.

x & y - x and y values/pixel where the crosshair needs to be shown.

coordinateUnit - specify the type of x and y values given. pixel or point for logical pixel and chart data point respectively.

Defaults to point.

Implementation

void show(dynamic x, double y, [String coordinateUnit = 'point']) {
  assert(x != null);
  assert(!y.isNaN);
  if (coordinateUnit == 'point') {
    final RenderBehaviorArea? parent = parentBox as RenderBehaviorArea?;
    if (parent != null) {
      _position = rawValueToPixelPoint(
          x, y, parent.xAxis, parent.yAxis, parent.isTransposed);
    }
  } else if (coordinateUnit == 'pixel') {
    _position = Offset(x.toDouble(), y);
  }
  (parentBox as RenderBehaviorArea?)?.invalidate();
}