系列标记在线上禁用并在图表中启用图例 [英] Series markers disable on lines and enable on legend in Highchart

查看:101
本文介绍了系列标记在线上禁用并在图表中启用图例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Highchart中有超过10个系列的折线图。当图表绘制了多于两个月的数据并启用了系列标记时,图表看起来拥塞并且没有意义,因此我禁用了系列标记。当系列标记禁用时,图例中的标记也消失。我想要的只是在系列中禁用标记,并在图例中启用标记。我怎样才能做到这一点?任何人都可以帮助我吗?



谢谢,
Rocky。

解决方案您有两种选择:


  • 启用整个系列的标记,但禁用每个点
  • 使用两个系列,一个用于数据,一个用于图例,并通过ID将它们连接在一起。



示例:

  var chart = new Highcharts.Chart({
图表:{
renderTo:'container'
} ,
plotOptions:{
series:{
marker:{
enabled:false
}
}
},
series :[{
data:[],
name:'test',
id:'id-1',
color:'red',
marker: {
enabled:true
}
},{
linkedTo:'id-1',
color:'red',
data:[29.9 ,71.5,106.4,129.2,144.0,176.0] b $ b}]
});


I have a line chart in Highchart with more than 10 series. When the chart is plotted for more that 2 months data with series marker enabled, the chart looks congested and makes no sense so I disabled series markers. When series marker is disabled, the markers in the legends also disappeared. What I want is to disable the markers only in the series and enable markers in legends. How can I achieve this? Can anybody please help me this?

Thanks, Rocky.

解决方案

You have two options:

  • enable marker for whole series, but disable for each point
  • use two series, one for data, one for legend and link them together by ID

Example:

var chart = new Highcharts.Chart({
    chart: {
        renderTo: 'container'
    },
    plotOptions: {
        series: { 
            marker: {
                enabled: false
            }
        }
    },
    series: [{
        data: [],
        name: 'test',
        id: 'id-1',
        color: 'red',
        marker: {
            enabled: true
        }
    }, {
        linkedTo: 'id-1',
        color: 'red',
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0]        
    }]
});

这篇关于系列标记在线上禁用并在图表中启用图例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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