从图例隐藏系列名称

我几次试图解决这个问题,最后都放弃了。现在,当我再次见到他时,我决定寻求一些帮助。

我为我的传奇准备了这个代码:

legend:
{
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 0,
    

    

    

labelFormatter: function()
{
if(this.name!='Series 1')
{
return this.name;
}
else
{
return 'Legend';
}
}
}

如果我将返回结果从“ Legend”更改为“文本没有显示,但仍然在图例的顶部有一个“破折号”。如果我不使用标签格式化器函数,我有’系列1’+’破折号’像第一行在我的图例。怎么藏?

请注意,我的版本是: 海图 -2.0.5

这是我的图例和我想移除的破折号的一个简单视图:

Sample Image

150647 次浏览

Looks like HighChart 2.2.0 has resolved this issue. I tried it here with the same code you have, and the first series is hidden now. Could you try it with HighChart 2.2.0?

If you don't want to show the series names in the legend you can disable them by setting showInLegend:false.

example:

series: [{
showInLegend: false,
name: "<b><?php echo $title; ?></b>",
data: [<?php echo $yaxis; ?>],
}]

You get other options here.

Replace return 'Legend' by return ''

Set showInLegend to false.

series: [{
showInLegend: false,
name: 'Series',
data: value
}]

showInLegend is a series-specific option that can hide the series from the legend. If the requirement is to hide the legends completely then it is better to use enabled: false property as shown below:

legend: { enabled: false }

More information about legend is here