score:17
1) is this the right way to destroy and rebuild the chart, or is there a better method?
That's the only way and Highcharts is smart enough so that you don't have to worry about any memory leaks.
2) if this is the way to do it, then how do I get my show/hide/check/uncheck functions to continue to work afterward?
You are recreating the chart but not assigning it to the variable chart
again.
$('#resetChart').click(function(){
chart1.destroy();
chart1 = new Highcharts.Chart(optionsChart1,highlightSer);
chart = chart1; // <-------- Add this line here.
});
score:3
Is there a reason for assigning the chart to a new variable here?
var chart = chart1;
chart
will not point to a graph anymore after you have destroyed it. If you just use chart1
, which you re–assign, everything seems to work just fine. Or am I missing something?
Source: stackoverflow.com
Related Query
- Highcharts / jQuery - destroy and rebuild chart with original options
- Highcharts - best way to handle and display zero (or negative) values in a line chart series with logarithmic Y axis
- Highcharts blank chart with x and y axis
- Highcharts connecting scatter chart and pie chart with single legend
- Highcharts v3.0.1 problems with rotating data labels in IE8 and jQuery v1.7.1
- Highcharts 3.0, area chart with stacked and unstacked series - how to fix?
- Highcharts - Global configuration with common code and unique data & Headings
- Simple bar chart in jQuery HighCharts and MVC 2 application?
- Highcharts - Area Chart - Stacking with series containing negative and positive values
- Change chart type and redraw with multiple series in Highcharts
- Highcharts bar chart with fixed bar widths and gaps
- Tooltip in chart with line- and scatter plot in highcharts 3.0.7
- Highcharts - bubble chart with titles at x- and y-Axis - Error #14
- How to have a highcharts chart in a container of a fixed width, and with a horizontal scrollbar?
- Highcharts no longer animates and readjusts/rescales chart upon addition and removal of series in legend after upgrading to jQuery 1.10
- Column chart with negative values and categories on xAxis in HighCharts
- (Horizontal) bar and line chart with Highcharts
- Can't disconnect line chart with [null,null] and irregular intervals in Highcharts
- Render to same Container with multiple chart types and options
- Highcharts single horizontal stacked bar chart with data names (labels) and %-ages always shown and data numbers and series name shown on mousehover
- highcharts with only javascript and no jquery
- Javascript Highcharts High buttons and calender with jquery
- How to display only last point on highcharts and that point should travel with chart line?
- invalid character error with jquery and highcharts SCRIPT1014: Invalid character
- Highcharts Angular - How to set chart width and height with percentages?
- PIE CHART - Data Visualization With DataTables and Highcharts
- Dynamic column based highcharts feeding data with jquery and php
- Highcharts Angular update chart with new options - including linked series
- Find and fill intersection of line chart with plot line in highcharts
- Why does highcharts sankey chart sometimes combine multiple nodes with same node name but different Id into one and hide the lines?
More Query from same tag
- Highcharts with angular2 and SystemJS Setup
- Show Marker symbol on the newest data in HightChart
- Highcharts plot markers move behind spline graph animation
- Highcharts: Context Menu Button, onclick function
- How to load custom JSON data into Highcharts mapbubble?
- HighCharts: columns not centered when multi series
- highchart datalabel one value is missing in label
- Highchart yAxis.ceiling not working properly
- highcharts - log axis not working
- Show Gridline on Y axis for 0 point only
- Highcharts stacking side by side comparison
- MSSQL Server to PHP Array to JSON Encode to Highcharts
- Parsing MySQL output to JSON extracting field names
- Highcharts - line between two categories
- Change plotBands options after chart creation
- Highcharts pie chart annotations are not centering
- jQuery hide/show a div containing Highcharts
- Highcharts: How to add an arrow head at the tip of a connector in a pie chart?
- Is there anyway to center the Column Chart on the xAxis
- Javascript - How to display a specific index of an array on Highcharts?
- How to put value on highcharts compare option in R
- HighStock CandleStick type does not printed in Chrome
- Export highcharts animation as video
- how to stop ajax call in live highcharts when no new data
- Rendering HighCharts in AngularJS from Json Object
- how to implement polling in below mentioned code. I want to poll data every 60 sec from the specified url. how can i do it?
- save chart button of stock tool chart not working in highcharts
- Loading json data to highcharts with multiple series
- Highcharts: Dual axis line and column with multiple series
- How to draw Highchart points on a JPG image