简体   繁体   中英

How to limit min and max zoom in chartIQ library

I work with chartIQ library: https://www.chartiq.com My target is to limit minimum and maximum chart zoom. How can i do it?

To set the minimum zoom you can set ChartEngine.minimumZoomTicks field.

http://documentation.chartiq.com/CIQ.ChartEngine.html#minimumZoomTicks

stxx.minimumZoomTicks=5; // when zoomed all the way in only 5 bars will show

There isn't a field that mirrors that functionality for zooming out I'm afraid, but what you are trying to accomplish can be achieved by utilizing the prepend injection functionality along with setting the zoomOutSpeed to 1.

http://documentation.chartiq.com/tutorial-Using%20the%20Injection%20API.html

http://documentation.chartiq.com/CIQ.ChartEngine.html#preferences%5B%60zoomOutSpeed%60%5D

var stxx = yourChartInstance;
stxx.preferences.zoomOutSpeed=1;
stxx.prepend("zoomOut", function() {
    for(var chartName in stxx.charts){
        var chart=stxx.charts[chartName];
        chart.maxTicks=20; // this will set the maximum number of bars on the screen, along with zoomOutSpeed
    }
});

If you have any other questions please contact ChartIQ directly at support@chartiq.com.

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