hide method

void hide()

Hides the crosshair if it is displayed.

Implementation

void hide() {
  final SfCartesianChartState chartState = _chartState!;
  final CrosshairBehaviorRenderer crosshairBehaviorRenderer =
      chartState._crosshairBehaviorRenderer;
  if (crosshairBehaviorRenderer._crosshairPainter != null) {
    crosshairBehaviorRenderer._crosshairPainter!.canResetPath = false;
    ValueNotifier<int>(crosshairBehaviorRenderer
        ._crosshairPainter!.chartState._crosshairRepaintNotifier.value++);
    crosshairBehaviorRenderer._crosshairPainter!.timer?.cancel();
    if (!chartState._isTouchUp) {
      crosshairBehaviorRenderer
          ._crosshairPainter!.chartState._trackballRepaintNotifier.value++;
      crosshairBehaviorRenderer._crosshairPainter!.canResetPath = true;
    } else {
      if (!shouldAlwaysShow) {
        final double duration = (hideDelay == 0 &&
                crosshairBehaviorRenderer
                    ._crosshairPainter!.chartState._enableDoubleTap)
            ? 200
            : hideDelay;
        crosshairBehaviorRenderer._crosshairPainter!.timer =
            Timer(Duration(milliseconds: duration.toInt()), () {
          crosshairBehaviorRenderer._crosshairPainter!.chartState
              ._crosshairRepaintNotifier.value++;
          crosshairBehaviorRenderer._crosshairPainter!.canResetPath = true;
        });
      }
    }
  }
}