zoomAt method

GraphViewport zoomAt(
  1. double px,
  2. double factor,
  3. double width, {
  4. double min = 0.5,
  5. double max = 80,
})

Zoomed by factor with the position under px (from the plot's left) staying under it.

Implementation

GraphViewport zoomAt(double px, double factor, double width, {double min = 0.5, double max = 80}) {
  final next = (barSpacing * factor).clamp(min, max);
  final right = width - px;
  return GraphViewport(barSpacing: next, rightOffset: rightOffset - right / barSpacing + right / next);
}