通过highchart中的配置禁用系列 [英] Disable series through configuration in highcharts

查看:94
本文介绍了通过highchart中的配置禁用系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个系列的折线图。当一次查看图表时,图表很混乱,所以我想最初隐藏某些系列。



我知道我可以以编程方式关闭系列,但有没有办法在初始化图表时做到这一点?

解决方案

相信这里有一个配置选项。

系列内设置visible = false

图例仍会列出系列,但显示为灰色。



示例配置:

这个系列本身会隐藏在图表中。 系列:[{
名称:'HiddenByDefault',
legendIndex:1,
visible:false,
颜色:'#4572A7',
类型:'spline',
data:[a,b,c],
tooltip:{
valueSuffix:'¥'
}

}


I have a line chart with several series. When viewed all at once the chart is confusing, so I would like to have certain series hidden initially.

I know I can programmatically turn off series, but is there a way to do this when initializing the chart?

解决方案

Believe there is a configuration option for this.

Within Series, set "visible = false"

The legend will still list the series but greyed out. And the series itself will be hidden in the chart upon initial display.

Example configuration:

series: [{
            name: 'HiddenByDefault',
            legendIndex: 1,
            visible: false,
            color: '#4572A7',
            type: 'spline',
            data: [a, b, c],
            tooltip: {
                valueSuffix: ' ¥'
            }

        }

这篇关于通过highchart中的配置禁用系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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