简体   繁体   English

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

[英]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. 我使用chartIQ库: https ://www.chartiq.com我的目标是限制最小和最大图表缩放。 How can i do it? 我该怎么做?

To set the minimum zoom you can set ChartEngine.minimumZoomTicks field. 要设置最小缩放,可以设置ChartEngine.minimumZoomTicks字段。

http://documentation.chartiq.com/CIQ.ChartEngine.html#minimumZoomTicks 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. 恐怕没有一个字段可以反映该缩小功能,但是您可以通过利用prepend注入功能以及将zoomOutSpeed设置为1来实现您要完成的任务。

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

http://documentation.chartiq.com/CIQ.ChartEngine.html#preferences%5B%60zoomOutSpeed%60%5D 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. 如果您还有其他疑问,请直接发送电子邮件至support@chartiq.com与ChartIQ联系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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