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
- how to show cross hair in highchart always by default
- How to reduce space of tooltip box in highchart?
- PHP Cache external JSON API in local file - not working
- Background color for multiple Highchart panes, in Vue app
- Toggle Highcharts plotLine with button
- using JS event function twice in shiny R to create a dropdown
- Adding a pattern fill to a black and white column graph in Highcharter
- How to bind dynamic data to highcharts basic area graph
- Highcharts - Change legend index order
- How to make data from ajax become X axis in Highchart?
- modifying Highcharts tool tip with for a bar chart dynamic data
- Highcharts change value out of csv file before plotting as epoch time not in ms so it has to be multiplied by 1000
- HIghcharts Legend
- HighCharts - Hide/Show Label on mouse Events
- Capture right click on column/bar
- HighChart Graph not displaying in Mail
- Dynamically allocating Highcharts.Chart options noData
- highcharts animation multiple charts
- apply new theme without reloading the charts in highcharts
- How to add current price line on hover?
- Delay Loading Highcharts' Chart
- Highcharts, Javascript
- Jquery, highchart: render plot on button click, roll backs
- Highstock tooltip dateTimeLabelFormats for week not working correctly
- Highchart library and responsive design
- Increase the size of container relative to inner chart in HTML while using HighCharts
- Do I need to install anything to run Highchart?
- Force Highcharts to show last x-axis label
- Prevent Absolute positioned Div from overlapping
- it is possible to style HIGHCHARTS like this?