copyWith method

ChartContext copyWith({
  1. ChartConfig? config,
  2. ChartTheme? theme,
  3. ChartBounds? bounds,
  4. ChartViewport? viewport,
  5. CoordinateTransformer? transformer,
  6. PaintCache? paintCache,
  7. double? animationValue,
  8. ChartHitResult? hoveredHit,
  9. ChartHitResult? selectedHit,
  10. Offset? crosshairPosition,
  11. ZoomPanController? zoomPan,
  12. bool clearHover = false,
  13. bool clearSelection = false,
  14. bool clearCrosshair = false,
})

Implementation

ChartContext copyWith({
  ChartConfig? config,
  ChartTheme? theme,
  ChartBounds? bounds,
  ChartViewport? viewport,
  CoordinateTransformer? transformer,
  PaintCache? paintCache,
  double? animationValue,
  ChartHitResult? hoveredHit,
  ChartHitResult? selectedHit,
  Offset? crosshairPosition,
  ZoomPanController? zoomPan,
  bool clearHover = false,
  bool clearSelection = false,
  bool clearCrosshair = false,
}) {
  return ChartContext(
    config: config ?? this.config,
    theme: theme ?? this.theme,
    bounds: bounds ?? this.bounds,
    viewport: viewport ?? this.viewport,
    transformer: transformer ?? this.transformer,
    paintCache: paintCache ?? this.paintCache,
    animationValue: animationValue ?? this.animationValue,
    hoveredHit: clearHover ? null : (hoveredHit ?? this.hoveredHit),
    selectedHit: clearSelection ? null : (selectedHit ?? this.selectedHit),
    crosshairPosition: clearCrosshair
        ? null
        : (crosshairPosition ?? this.crosshairPosition),
    zoomPan: zoomPan ?? this.zoomPan,
  );
}