show method

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

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

*x and y - x & y pixels/values at which the trackball 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']) {
  final RenderBehaviorArea? parent = parentBox as RenderBehaviorArea?;
  if (parent == null) {
    return;
  }

  assert(x != null);
  assert(!y.isNaN);
  if (coordinateUnit == 'point') {
    _position = rawValueToPixelPoint(
      x,
      y,
      parent.xAxis,
      parent.yAxis,
      parent.isTransposed,
    );
  } else if (coordinateUnit == 'pixel') {
    if (x is num) {
      _position = Offset(x.toDouble(), y);
    } else {
      _position = Offset(
        rawValueToPixelPoint(
          x,
          y,
          parent.xAxis,
          parent.yAxis,
          parent.isTransposed,
        ).dx,
        y,
      );
    }
  }

  _show(parent);
}