Change grid based on current zoom in amCharts

偶尔善良 提交于 2019-12-11 04:36:29

问题


Let consider my question on a sample from amCharts site: https://www.amcharts.com/demos/area-with-time-based-data/

So, after page loading, chart is zoomed between 03:30 and 6:00 (based on X-axis values) and vertical grid step (difference between two vertical grid lines) is 0:30.

Now, I grab left slider at the top and move it right, so that minimal X value is 04:00. And there's still 0:30 step. It will switch to 0:10 at ~04:05.

My question is - how can I manually "speed up" this process of zooming? I mean, I'd like to switch to more narrow grid at 03:45 for example.

There's a possibility to attach a listener to zoom event and calculate time difference in current zoomed area, but I wasn't able to make vertical grid more narrow.

Thanks in advance for any help.


回答1:


You can use the minHorizontalGap property. The chart will try to size the grid accordingly to this value. If you decrease it (default value is 75), the grid will be tighter in general.

I hope this fits your needs. Heres a demo.



来源:https://stackoverflow.com/questions/38745789/change-grid-based-on-current-zoom-in-amcharts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!