show method
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']) {
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();
}