score:6
Accepted answer
$('#resetChart').on("click", function(e){
e.preventDefault();
while(chart.series.length > 0) chart.series[0].remove(true);
chart = new Highcharts.Chart(options);
});
score:4
When you create your chart for the first time you pass some options thrue the parameter, you can save them into an var and when you want to create again you use the same options like the following code.
var defaultOptions = {
// your options
};
function drawDefaultChart() {
chart = new Highcharts.Chart(defaultOptions);
}
drawDefaultChart();
$('#resetChart').on("click", function(e){
e.preventDefault();
chart.destroy();
drawDefaultChart();
});
You can see it working here.
Source: stackoverflow.com
Related Query
- Resetting Highcharts to initial state
- Highcharts Resetting Drilldown (three layers) to Initial state
- Hide line in default state in Highcharts
- Highcharts - Dyanmic graph with no initial data
- Highcharts - Updating a chart's option after initial render
- 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
- set initial graphs on highcharts
- Customise Highcharts Pie Chart Selection State so that slice does not animate out when selected
- HighCharts : Highlight entire series when hover and restore state when out
- HighCharts Stock Chart error code 18
- Animation behave differently between initial load and dynamic data series replacement in Highcharts
- highcharts change rendered image source on click
- How do i add mouse wheel code in Angular2 highcharts in typescript
- how to display 2 same highcharts without duplicate the code
- Use of DotNet HighCharts dll to make charts in code behind
- Highcharts - export current state of a chart
- How to edit tooltip in Highcharts C# code
- what means ${demo.css} in example files of highcharts ? That piece of code seems to be literal
- passing json values to highcharts from .net code behind
- how to use highcharts tooltip formatter in python code
- HighCharts not updating when the state changes in React
- passing formatting JavaScript code to HighCharts with JSON
- Highcharts -- how to change line width programmatically and prevent resetting line width?
- How can you speed up the Highcharts network graph initial animation?
- Adding data to Highcharts after initial rendering
- Highcharts - Scatterplot Marker Hover State lasts too long
- Disabling inactive state in Highcharts styled mode
- Highcharts update pointRange, pointWidth after initial render
- Highcharts display label for pie chart using html table as data source
More Query from same tag
- HighCharts range area plot not working when plot is inverted
- Not all Tooltips and crosshairs not fading from synchronised charts when the mouse leaves a chart
- Using LINQ to generate Highchart column table data
- highcharts - changing color of area depending on y-value
- Correctly plot time series in Highcharts/Highstock
- Using Highcharts JS in native mobile application
- How to send other variables in x-axis of ReactHighCharts?
- highcharts column labels
- Highmaps hover effect/mouseout color change
- Highcharts navigator error: Invalid negative value for <rect> attribute width
- Graphing data from mysql
- Highcharts don't show data after remove
- Chartkick w/ Highcharts column_chart, specify visibility by series
- Highcharts - remove times between dates on a datetime xaxis type
- why highchart boundbox doesn't indicate axis label overlap?
- Inserting Highcharts bar graph into sharepoint 2013 page
- Multi Color dataLabel in Bar Highchart
- 'How to read a file content until 'n' occurrences of a character and write it into a variable", using javascript?
- Multiple xAxis line on Highcharts
- High charts - Increasing the space between chart and title
- HighCharts - display heart rate?
- import data from localhost(phpmyadmin) to a web page"Highcharts"(as a project in phpmyadmin)
- JasperReports: HTML5 high chart X Axis label font size
- How to use for loop array to add series dynamically for line chart
- highcharter both nominal and percentage values
- Can't display x-axis value in Highcharts title
- Dynamically change startAngle value in HighCharts
- Highchart wrapping category labels
- jsPDF addHTML method not working with no error message
- Highcharts value bars with full height background bars