根据当前放大的amCharts更改网格 [英] Change grid based on current zoom in amCharts

查看:99
本文介绍了根据当前放大的amCharts更改网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们考虑一下来自amCharts网站的样本:



现在,我抓住顶部的左侧滑块并向右移动,以便最小X值为04: 00。还有0:30步骤。它将在~04:05切换到0:10。





我的问题是 - 如何手动加速这个缩放过程​​?我的意思是,我想在03:45切换到更窄的网格。



有可能将侦听器附加到缩放事件并计算时差当前缩放区域,但我无法使垂直网格更窄。



提前感谢您的帮助。

解决方案

您可以使用 minHorizo​​ntalGap 属性。
图表将尝试根据此值调整网格大小。如果你减少它(默认值是 75 ),网格通常会更紧。



我希望这个满足您的需求。下面是演示


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.

解决方案

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.

这篇关于根据当前放大的amCharts更改网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆