Constraining the zoom level

The zoom level on a Chart that has zooming enabled can be constrained using the scaleExtent property on the ChartConfig. The scaleExtent property is a tuple of numbers of the form [min k, max k], where min k controls how far a Chart can be zoomed out and max k controls how far a Chart can be zoomed in.

let chart = new soda.Chart({
  selector: "#soda-chart",
  axis: true,
  zoomable: true,
  scaleExtent: [0.5, 10]
});

let ann: Soda.Annotation = soda.generateAnnotations({
  n: 10
})

chart.render({
  annotations: ann
})

See the Pen Constraining the zooming on a Chart by Jack Roddy (@jackroddy) on CodePen.