score:16
Well just setting the showInLegend
doesn't do the trick, there are some more hooks that need to be taken care of
Refer Halvor Strand's answer for a more recent way
Old trick but still works
To Add
item.options.showInLegend = true;
chart.legend.renderItem(item);
chart.legend.render();
To Remove
item.options.showInLegend = false;
item.legendItem = null;
chart.legend.destroyItem(item);
chart.legend.render();
where, item can be a point or series
var item = chart.series[1];
Add Remove Legend Dynamically | Highchart & Highstock @ jsFiddle
score:6
You can set showInLegend
as false
when you create the chart.
{
name: 'Tokyo',
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],
showInLegend: false
}
If you want to update it dynamically you can do the following.
options.series[1].showInLegend = false;
chart = new Highcharts.Chart(options);
You forgot to force chart to redraw.
Or chart.legend.allItems[1].destroy();
to remove the first one.
score:6
This can now be solved without any hacks through the Series.update
method (API). For example:
chart.series[0].update({ showInLegend: false });
See this JSFiddle demonstration. The method signature is:
update(Object options, [Boolean redraw])
Where options
are options for any regular Series
object. You can optionally halt redrawing to change multiple options before redrawing.
Source: stackoverflow.com
Related Query
- Filtering legend of a Highcharts by only visible series
- Filtering legend of a Highcharts by only visible series only in Export
- Highcharts barchart - legend is only hiding first and last series, others stay visible on X-axis
- Highcharts legend position same as tooltip position or make tooltip still visible after hiden series
- how to enable only 1 out of 2 column column graph by default when page loads in highcharts and the 2nd one gets visible when toggled in the legend
- HighCharts Hide Series Name from the Legend
- Hiding a Highcharts series without using the legend
- Add series total to legend in Highcharts
- Highcharts - get visible series name dynamically
- Highcharts hide series without change legend color
- Highcharts - Gray out only title in legend
- How to color series legend in highcharts when colorbypoint is set to true
- Showing HighCharts series name on x-axis and in legend
- Highcharts solidgauge legend symbol not taking series color
- $.each only shows one series highcharts
- Adding different style to a series in legend in Highcharts
- highcharts chart showing only last element in series
- How to keep the highcharts legend "on" while hiding the series
- Highcharts legend custom css style / format using only highcharts options
- Series for tooltip only in highcharts
- Highcharts change crosshairs color by number of visible series
- Highcharts no longer animates and readjusts/rescales chart upon addition and removal of series in legend after upgrading to jQuery 1.10
- Highcharts - Adding tooltip to ONLY certain dynamically added series
- Treemap in highcharts display series name and value in treemap only
- How to show only one pair of linked Highcharts series at a time
- Highcharts JS: barchart select the only selected bar without the rest in series
- HighCharts - Enable the markers for the series which has only single data point?
- Highcharts polar : series appear over others when toggle to visible
- Highcharts Export Renderer Image - Only SVG visible
- Get only visible x axis dates when zooming in highcharts
More Query from same tag
- HighChart for PHP 5.1 lower
- HighCharts OHLC - Can I provide color-information for each point with JSON-Data?
- Flexdashboards and Leaflet and marker click with Highcharts
- How to create such a `No Data` greyed out design pattern on Highcharts?
- Rescale Y-axis in Highcharts after zoom while maintaining zoomType=x behavior
- How to generate PDF Files based on a HTML+CSS+jQuery page containt
- Highcharts adding integer instead of date
- How to do a data overlap independently column in Highcharts
- Customize Stacked column chart in highChart
- How to hide empty column in column hightcharts with multiple series
- AMChart implementation for "DateTime" AxisType?
- Setting a four hour range in highcharts
- Highcharts Legend error: "typeError: a.legendItem.bBox is undefined"
- How can I create a specific Json output for use with Highcharts?
- How to hide 0 values in multi chart in highcharts?
- Highchart navigator data format
- use jquery function in a highcharts
- How can set a width to a single column in Highcharts
- In Highcharts, how can we separatedly set up the border color of each block in a Pyramid chart
- Highcharts: zero-align y-axes angular 6
- Change the zoom Type dynamically?
- How can I specify custom end markers in a scatter series with Highcharts 9?
- Highcharts - Issue with negative values when displaying multiple axes
- HighStock Depthchart is updating the data strangely
- Displaying max value in bottom of the pie chart - highcharts
- Combination of ohlc and line plot in highchart
- Ember Js, Ember-Highcharts not updating changes to chartData
- How do I know if currently displayed chart data is grouped?
- How to auto adjust Y axis plot lines in live high chart
- Trying to iterate over json string