Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HighCharts Hide Series Name from the Legend

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

like image 401
gotqn Avatar asked Feb 28 '12 09:02

gotqn


People also ask

How do I delete a series in Highcharts?

get('idofseriestoremove'). remove(). This only removes the series but is not removing the associated dotted lines.

How do I disable Highcharts credits?

credits: { enabled: false }, that will remove the "Highcharts.com" text from the bottom of the chart. @philfreo 'Credits: false' could produce a undefined error if highcharts didn't do proper checking.

What is Highchart legend?

The legend is a box containing a symbol and name for each series item or point item in the chart. Each series (or points in case of pie charts) is represented by a symbol and its name in the legend. It is possible to override the symbol creator function and create custom legend symbols.

How do I change the legend position in Highcharts?

Set legend's layout, align and verticalAlign options as follows: legend: { layout: 'vertical', align: 'right', verticalAlign: 'middle', itemMarginTop: 10, itemMarginBottom: 10 }, By itemMarginTop/Bottom you can control the padding between the legend items.

How to hide a series from the legend in a chart?

How to hide a series from the legend? Highcharts.extend (options, Highcharts.merge (options, { series: [ { index: 2, showInLegend: "false" } ] })); results in a blank chart. In 'Custom code' section create a chart using options from 'Genereated options' section, add showInLegend property and set it to false in series with index 2.

How to set showinlegend property to false in Highcharts?

Highcharts.extend (options, Highcharts.merge (options, { series: [ { index: 2, showInLegend: "false" } ] })); results in a blank chart. In 'Custom code' section create a chart using options from 'Genereated options' section, add showInLegend property and set it to false in series with index 2.

What is a legend in highmaps?

The legend is a box containing a symbol and name for each series item or point item in the chart. Each series (or points in case of pie charts) is represented by a symbol and its name in the legend. It is possible to override the symbol creator function and create custom legend symbols. A Highmaps legend by default contains one legend item per...

What is the legend of a chart?

The legend is a box containing a symbol and name for each series item or point item in the chart. Each series (or points in case of pie charts) is represented by a symbol and its name in the legend. It is possible to override the symbol creator function and create custom legend symbols. Accessibility options for the legend.


1 Answers

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.

  • legend options

  • other chart options

like image 121
vkGunasekaran Avatar answered Oct 08 '22 09:10

vkGunasekaran