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

时间:2018-11-02 13:30:28

标签: javascript reactjs charts react-redux zooming

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

1 个答案:

答案 0 :(得分:0)

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

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

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

恐怕没有一个字段可以反映该缩小功能,但是您可以通过利用prepend注入功能以及将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联系。