问题
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