简体   繁体   English

单击要显示的图表时使标志可见

[英]Make flag visible when the the plot is clicked to show

Ok, let me explain :) 好的,我来解释一下:)

I have right now one chart with 4 lines, when I open the chart only one of it is by default visible. 我现在有一个包含4行的图表,当我打开图表时,其中只有一行默认可见。

Each of the lines has a flag attached to it, the problem is: when the line is not visible the flag appears at the bottom of the chart. 每条线都附有一个标志,问题是:当线条不可见时,标志出现在图表的底部。

我的图表

I found the command to make the flag visible or not, but the problem is, unlike the lines when I click the line to appear, the flag does not appear with it. 我找到了使标志可见或不可见的命令,但问题是,与单击要显示的行时的行不同,标志不会随之出现。

Is there any way to make them appear together? 有没有办法让它们一起出现? Like then I click to show the 'Camara 4' line the flag appear together. 就像那时我点击显示'Camara 4'线标志一起出现。 And when I click to make the line invisible the flag turn invisible too. 当我点击使线条不可见时,旗帜也会变得不可见。

Is there any function/command for it? 它有任何功能/命令吗?

Thanks :) 谢谢 :)

See this fiddle: http://jsfiddle.net/bBQKv/ 看到这个小提琴: http//jsfiddle.net/bBQKv/

Make use of the show and hide events to trigger the show and hide methods for the flag series. 利用show和hide事件触发show并隐藏flag系列的方法。

plotOptions: {
    series: {
        events: {
            show: function(event) {
                if (this.options.type != 'flags') {
                    series = this.chart.get(this.options.id + 'Flags');
                    series.show();
                }
            },
            hide: function(event) {
                if (this.options.type != 'flags') {
                    series = this.chart.get(this.options.id + 'Flags');
                    series.hide();
                }
            }
        }
    }
},

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM