简体   繁体   中英

Disable pinch to zoom in highstock/highcharts

With the new update for highcharts came support for pinch to zoom on the iPad/iPhone, however this doesn't work how I expected. I presumed that the chart would actually zoom into the date range, instead it just literally zooms into the chart lines and markers, rendering the functionality a bit pointless.

Is it possible to disable this?

There is a chart.zoomType and chart.pinchType property that take the same values (x,y,xy,none). By default chart.pinchType is null and reverts to chart.zoomType. If you want only zooming on the x-axis for pinching, you would do:

chart : {
  pinchType : 'x'
  ...
}

Or set chart.pinchType to 'none' to completely disable. Or leave it null and set your chart.zoomType to either of these.

http://api.highcharts.com/highcharts#chart.pinchType

http://api.highcharts.com/highcharts#chart.zoomType

Looks like setting pinchType to anything doesn't work. Until we set zoomType to null charts are still being zoomed by tough gestures on iOS Safari. Plus, we looked into the source code and the property doesn't seem to be implemented. We have Highcharts JS v.4.1.7.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM