HighCharts从图例中隐藏系列名称 [英] HighCharts Hide Series Name from the Legend

查看:612
本文介绍了HighCharts从图例中隐藏系列名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试多次解决这个问题并放弃。现在,当我再次见到他时,我决定寻求一些帮助。



我的图例代码如下:

 图例:
{
布局:'vertical',
align:'right',
verticalAlign:'top' ,
x:-10,
y:100,
borderWidth:0,



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



code
$ b如果我改变回报率'Legend'to''文字没有显示,但图例顶部仍然有'破折号'。如果我不使用标签formater功能,我有'系列1'+'短划线'就像我的传说中的第一行。如何隐藏它们?

请注意我的版本是:Highcharts-2.0.5

这是一个简单的看我的传奇和我想删除的破折号:

样品图片http://img72.imageshack.us/img72/8305/45167805.png

解决方案

如果您不想在图例中显示系列名称,则可以通过设置showInLegend:false来禁用它。 ex:

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

您可以在此处获得其他选项。


I try to solve this problem several times and give up. Now, when I have met him again, I decided to ask for some help.

I have this code for my Legend:

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';
        }
    }
}

If I change the return from 'Legend' to '' the text is not shown but still there is a 'dash' on the top of the legend. If I do not use label formater function I have 'Series 1' + 'dash' like a first row in my legend. How to hide them?

Please, note my version is : Highcharts-2.0.5

This is a simple view of my legend and the dash I want to remove:

Sample Image http://img72.imageshack.us/img72/8305/45167805.png

解决方案

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

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

You get other options here.

这篇关于HighCharts从图例中隐藏系列名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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