调用setExtremes后,Highcharts“重置缩放" [英] Highcharts 'Reset Zoom' after calling setExtremes
问题描述
我正在使用setExtremes放大图表中的详细信息,并允许用户通过在图表中进行选择来放大"x,y".当用户缩放时,他们会看到一个重置缩放"按钮,但是当我调用setExtremes时,却没有.
I am using setExtremes to zoom in on detail in a chart, as well as allowing the user to zoom 'x,y' by selecting in the chart. When the user zooms, they get a 'reset zoom' button, however when I call setExtremes, I don't.
我是否可以强制以编程方式显示重置缩放"按钮?
Is there a way for me to force the 'reset zoom' button to appear programatically ?
更新:
通话
if( !chart.resetZoomButton ) {
chart.showResetZoom();
}
在afterSetExtremes事件处理程序内部使该按钮出现,但是单击该按钮不会执行任何操作.
inside the afterSetExtremes event handler makes the button appear, but clicking it doesn't do anything.
更新:
我没有打电话给setExtremes,而是改为打电话给
Rather than calling setExtremes, I've changed to calling
chart.xaxis [0] .zoom(minx,maxx);chart.yaxis [0] .zoom(miny,maxy);chart.redraw();
chart.xaxis[0].zoom(minx, maxx); chart.yaxis[0].zoom(miny, maxy); chart.redraw();
这与用户通过在图表上进行选择来放大具有相同的作用.
This has the same affect as the user zoomin in by selecting on the chart.
推荐答案
只看了一眼HighCharts源代码,看起来这可能对您有用:
Just had a look around the HighCharts source code, it looks like this may work out for you:
chart.showResetZoom();
此外,为了使按钮正常工作,您应该使用axis.zoom而不是设置极限值:
Also, in order for the button to work correctly, you should use axis.zoom instead of setting the extremes:
axis.zoom(newMin,newMax);
让我知道它是否有效!
这篇关于调用setExtremes后,Highcharts“重置缩放"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!