setViewportSettings method

  1. @override
void setViewportSettings(
  1. double viewportScale,
  2. double viewportTranslatePx
)

Configures the zoom and translate.

viewportScale is the zoom factor to use, likely >= 1.0 where 1.0 maps the complete data extents to the output range, and 2.0 only maps half the data to the output range.

viewportTranslatePx is the translate/pan to use in pixel units, likely <= 0 which shifts the start of the data before the edge of the chart giving us a pan.

Implementation

@override
void setViewportSettings(double viewportScale, double viewportTranslatePx) {
  _viewportSettings
    ..scalingFactor = viewportScale
    ..translatePx = viewportTranslatePx
    ..domainExtent = null;
  _scaleReady = false;
}