score:1
Accepted answer
You can store your visible series states in local storage. Example:
const savedStates = localStorage.getItem('seriesStates');
const seriesStates = savedStates ?
JSON.parse(savedStates) : {
A: true,
Ball: false,
C: false,
D: false
};
Highcharts.chart('container', {
series: [{
name: 'A',
data: [1, 2, 3],
visible: seriesStates.A
}, {
name: 'Ball',
data: [2, 2, 2],
visible: seriesStates.Ball
}, {
name: 'C',
data: [3, 3, 3],
visible: seriesStates.C
}, {
name: 'D',
data: [4, 4, 4],
visible: seriesStates.D
}],
plotOptions: {
series: {
events: {
legendItemClick: function() {
seriesStates[this.name] = !this.visible;
localStorage.setItem(
'seriesStates',
JSON.stringify(seriesStates)
);
}
}
}
}
});
Live demo: http://jsfiddle.net/BlackLabel/jkuc50Lf/
Docs: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
Source: stackoverflow.com
Related Query
- Keep selection in highcharts even on page refresh
- HighCharts - Selection Event keep the selection marked in graph
- Error: Data source must be a URL for refresh | console error | javascript | Highcharts
- Decimals on yAxis are not being displayed, even if that same code works on highcharts jsfiddle
- How to make the selection of individual series dynamic in highcharts even after setting max and min?
- Render Highcharts canvas as a PNG on the page
- Highcharts - Keep Zero Centered on Y-Axis with Negative Values
- Highcharts Error #16: charts not showing on the same page
- How to export the whole page or html content with Highcharts not just the chart?
- Highcharts - Force Categories in x-axis to be shown, even without data
- Highcharts - set maximum range for yAxis but keep axis dynamic within that range
- Highcharts - Keep tooltip showing on click
- Custom Highcharts Context Menu Button Appearing in Every Chart on Page
- Highcharts not displaying anything just blank html page
- Highcharts - show at least 5 horizontal grid lines, even when value doesn't change
- Highcharts with reveal.js: Refresh chart with slide?
- How can i keep the color the same in highcharts
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- Highcharts - Global configuration with common code and unique data & Headings
- highcharts pie chart multiple sections selection
- Highcharts x axis date full range even if there is not enough data
- Highcharts clickable column to open another page on same site
- drilldown maps and funnell charts on the same page using highcharts
- Cannot display multiple Highcharts on a single page
- Multiple highcharts charts dynamically created in angular2 on one page
- when printing page with highcharts using javascript this.print() width values in css in @media print seem to be ignored
- Customise Highcharts Pie Chart Selection State so that slice does not animate out when selected
- Using highcharts & highstock together on same page
- How to keep an empty slice area in highcharts after clicking on legendItem
- Using multiple Highcharts in a single page
More Query from same tag
- Why Markers points are not aligned with yAxis in Highcharts?
- Heatmap values are lapsing in Highcharts
- How to insert json within an array into highcharts?
- Highcharts too slow when plotting 4000 bars (rCharts)
- Get x-axis label into the first colomn of the table - highcharts
- How to make sure that highcharts spline graphs stays between 0 and 1?
- rangeSelector: change date beyond zoomed time range
- Stacked Bar And Scatter Alignment
- Highcharts / jQuery - destroy and rebuild chart with original options
- Trying to Fade out all other Columns when a user selects one column
- Adding options to the Highcharts on button click
- Stack line on area / stack area on line in highcharts?
- Use Material UI theme attributes for styling highcharts - React
- Highcharts load data from server ok, but not updating
- Showing only the first custom label. Highcharts
- Combination of Scatter HighChart with Polynomial Chart
- HighCharts : xAxis Categories Date format not working
- I am getting same highchart in pdf using jspdf when I am downloading the pdf with dynamic ids on click
- How to change value with count data
- Php and MySQL with Highchart
- Is there a way to update the legend to the value of a variable within the chart.events?
- Highcharts : Put data labels legend inside columns
- Label Y-Axis stops in Highcharts solid gauges
- Problem in plotting a map graph using highcharter
- HTML5 charts-Customizing tooltip formatting in Jasper Studio
- angular multiple same directives in single controller
- Highcharts Modify Tooltip for One Series
- Additional serires label in highcharts columnrange
- thousands Operator in highcharts
- How to check if the column is empty or not in csv , if column is not empty than print data else print something