I am trying to create a chart builder. I have a user inputs for Title and location of the legend. I want a user to type in a title and when the click off (blur) the chart
Figured out the Issue. Detailed here: http://highslide.com/forum/viewtopic.php?f=12&t=15255
Basically the Highcharts.charts function clears the series data from the original options object.
This is my working code:
var chart;
var chartData = { /* you chart data goes here */ };
$('#legendlocation-select').blur(function updateChartLegend(){
console.log($('#legendlocation-select').val());
if($('#legendlocation-select').val()==='none'){
chart.options.legend.enabled = false;
}else{
chart.options.legend.enabled = true;
chart.options.legend.align = $('#legendlocation-select').val();
}
renderChart();
});
function renderChart(){
//console.log(chartData);
if(chart == undefined){
console.log("First Draw");
chart = new Highcharts.Chart(chartData);
}else{
console.log("Redraw");
chart.options.chart.animation = false;
chart = new Highcharts.Chart(chart.options);
chart.render();
}
};