运行时是否可以在导航器中隐藏导航器? [英] Is it possible to hide the navigator in highcharts at runtime?

查看:90
本文介绍了运行时是否可以在导航器中隐藏导航器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个highcharts项目,我们需要在运行时显示/隐藏导航器,具体取决于屏幕过滤器的值。



我们已经添加/显示/隐藏各种数据系列 - 但我找不到一个API调用,这将允许我在运行时动态隐藏导航器?有人知道这样做 - 我不愿意重新加载整个图表,除非必须。



谢谢大家!

解决方案

您可以通过hide()函数隐藏所有特定的SVG导航器元素。

http://jsfiddle.net/dJbZT/1

  $('#btn')。toggle(function(){
chart.scroller.xAxis.labelGroup.hide();
chart.scroller.xAxis.gridGroup.hide ();
chart.scroller.series.hide();
chart.scroller.scrollbar.hide();
chart.scroller.scrollbarGroup.hide();
图表();
$ .each(chart.scroller.elementsToDestroy, },function(){
chart.scroller.xAxis.labelGroup.show();
chart.scroller.xAxis.gr idGroup.show();
chart.scroller.series.show();
chart.scroller.navigatorGroup.show();
chart.scroller.scrollbar.show();
chart.scroller.scrollbarGroup.show();
$ .each(chart.scroller.elementsToDestroy,function(i,elem){
elem.show();
})
});


I am working on a highcharts project where we have a requirement to show/hide the navigator at runtime, depending on the value of an on screen filter.

We already add/show/hide various series of data - but I cannot find an api call which will allow me to dynamically hide the navigator at runtime? Does anyone know of a way to do this - I am reluctant to reload the whole chart unless I have to.

Thanks folks!

解决方案

You can hide all particular SVG navigator elements by hide() function.

http://jsfiddle.net/dJbZT/1

$('#btn').toggle(function () {
            chart.scroller.xAxis.labelGroup.hide();
            chart.scroller.xAxis.gridGroup.hide();
            chart.scroller.series.hide();
            chart.scroller.scrollbar.hide();
            chart.scroller.scrollbarGroup.hide();
            chart.scroller.navigatorGroup.hide();
            $.each(chart.scroller.elementsToDestroy, function (i, elem) {
                elem.hide();
            })
        }, function () {
            chart.scroller.xAxis.labelGroup.show();
            chart.scroller.xAxis.gridGroup.show();
            chart.scroller.series.show();
            chart.scroller.navigatorGroup.show();
            chart.scroller.scrollbar.show();
            chart.scroller.scrollbarGroup.show();
            $.each(chart.scroller.elementsToDestroy, function (i, elem) {
                elem.show();
            })
        });

这篇关于运行时是否可以在导航器中隐藏导航器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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