如何限制 chartIQ 库中的最小和最大缩放

How to limit min and max zoom in chartIQ library

我使用 chartIQ 库:https://www.chartiq.com 我的目标是限制最小和最大图表缩放。 我该怎么做?

要设置最小缩放比例,您可以设置 ChartEngine.minimumZoomTicks 字段。

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

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

恐怕没有反映缩小功能的字段,但是您可以通过使用前置注入功能并将 zoomOutSpeed 设置为 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
    }
});

如果您有任何其他问题,请直接通过 support@chartiq.com 联系 ChartIQ。