score:1
Accepted answer
you can add some flag to avoid looping through the first chart.
$.each(highcharts.charts, function(i, chrt) {
//
// flag to avoid looping through the first chart
//
if (i !== 0) {
$.each(chrt.series, function(j, serie) {
let tmp_key = serie.name.replace(/[\s,-]/g, '');
if (!object.keys(listed).includes(tmp_key)) {
legend.append(
'<div class="item ' + tmp_key + '"><div class="symbol" style="background-color:' +
serie.color +
'"></div><div class="seriename" id="">' +
serie.name +
'</div></div>'
);
listed[tmp_key] = [serie];
} else {
listed[tmp_key].push(serie);
}
});
}
});
score:0
a jsfiddle would be nice. do notice though that
if (serie.visible) serie.setvisible(false);
else serie.setvisible(true);
can be simplified to serie.setvisible(!serie.visible)
Source: stackoverflow.com
Related Query
- How to make Highcharts legends focus on the chart that it belongs to?
- How to make a HighCharts drilldown column/bar chart that does not hide the non-drilldown categories
- How can I make milestone lines with a GANTT chart using the highcharts library?
- How to modify the code so that Highcharts graph does not cover fixed navigation bar at the top of the page?
- How to display legend in Highcharts Waterfall Chart and make the sum column of waterfall appear in multiple colors?
- How to draw a chart from one array of data and make labels on the chart from another array of data? Highcharts v.4.0.4
- How to make the highcharts generated chart be scalable or responsive
- How to display the value instead of percentage in a pie chart using jquery Highcharts
- HighCharts - Make the pie chart 100% of the div
- How do you increase the performance of highcharts chart creation and rendering
- HighCharts - How to create dynamic chart that exports EVERYTHING
- Highcharts Bar Chart - How to set the minimum bar width/length
- How to make a pie chart from highcharts responsive
- Highcharts Bubble Chart - How to move an individual point's data label (dataLabel) to the front/top
- How to let user know that a Highcharts chart is clickable?
- How To Dynamically Truncate The Y-Axis Title On Chart Resize/Reflow In Highcharts
- highcharts- stacked bar, how can I make the chart cover the width 100%?
- How do I make the label in polar chart not get split automatically?
- Highcharts : How do I keep the marker formatting and make the click event fire with a 5K+ point scatter plot?
- Make highcharts fullscreen also fullscreen the div wrapping the chart
- How to show Legends for all the series data in stacked column chart Highcharts?
- how to display 2 same highcharts without duplicate the code
- How to re-create the same chart in Highcharts as seen on the mock?
- How to update the highcharts.js to make the export server to my own ipaddress,instead of connect to the highcharts server?
- Highcharts Gantt - how to make the horizontal rows / lanes taller?
- Highcharts - how to do a responsive pie chart when the texts of the labels are long
- How to Make a Dashed Bar Chart Border in Highcharts
- Highcharts how to create legends based on the value of points
- How do I make a Tornado Chart using Highcharts
- Highcharts Bubble Chart - How to get the size of the point
More Query from same tag
- Highlight multiple series in Highcharts
- Highcharts- show all the days of the particular month
- Why is enzyme failing to test react highcharts?
- how to sort and select top 5 elements in a json array using angular JS
- Bar chart creating gap in timeline
- Add null values to Array Javascript
- How-to Dynamic update a chart via socket.io and slide chart view as a sliding window?
- Highcharts - Skip date in series
- Highcharts conditional data labels
- Cannot find type definition file for 'highcharts'
- Highcharts add point to line chart with json
- Highcharts pie chart slice animation only works when an error is thrown
- How do you add to tooltip, a series in HighCharts?
- Highcharts Dynamic Updated Highstock Charts doesn't display along with Bar Chart
- high charts - lost animation when pie chart sliced is programmatically set
- Highcharts. Series have same color after drilldown
- Highchart the horizontal gradline below the 0 axis
- Is it possible to center the labels and data points between the ticks in a datetime xAxis for Highcharts?
- Highcharts - how do I position categories aligned with tick marks as separations between columns?
- Highcharts - How to prevent long title with line break from overflowing subtitle
- Set a custom rangeSelector and disable xAxis label on chart and on Navigator with Highstock
- Highcharts Highmaps display tooltip of bubbles under datalabels
- Combine two arrays in js or have highcharts working with other data format
- Setting yaxis as logarithmic with Highcharts cakephp plugin
- Population density and Circles (to represent earthquakes) on the same Map
- DotNet HighCharts , Populates a pie with the result of a query
- Formatting Highcharts plot via rCharts
- Filename not assigned to csv export in HighCharts on Mac
- Displaying excess number of columns in heat map in highcharts
- building a custom histogram with highcharts.js