97

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

askedFeb 28, 2012 at 9:27
gotqn's user avatar

5 Answers5

246

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

example:

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

You get other options here.

MrGood's user avatar
MrGood
5455 silver badges21 bronze badges
answeredApr 10, 2012 at 10:15
vkGunasekaran's user avatar
Sign up to request clarification or add additional context in comments.

2 Comments

using "showInLegend: false" really fixed my problem. I wonder if this options only hides the series name, because the legend is still displaying the data (as I want).
Assuming if these options are enabled then it'll give a clear view, so they're enabled by default. if don't need them remove it. that's what you've done here.
23

Set showInLegend to false.

series: [{            showInLegend: false,            name: 'Series',            data: value                        }]
answeredFeb 18, 2016 at 13:43
Milan's user avatar

Comments

8

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

legend: { enabled: false }

More information aboutlegend ishere

answeredApr 15, 2020 at 7:34
Zameer Khan's user avatar

Comments

6

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

answeredFeb 29, 2012 at 15:52
zhongxiao37's user avatar

Comments

0

Replace return 'Legend' by return ''

answeredOct 2, 2014 at 18:26
Fouad's user avatar

Comments

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.