I am trying to create a chart builder. I have custom inputs for the title and location of the legend. I want the user to type the title and when the click (blur) of the chart is updated with what they typed.
The problem is that the chart is being displayed for the first time, however I can never display the char again. Here is a brief description of the code.
$('#legendlocation-select').blur(function updateChartLegend(){
console.log($('#legendlocation-select').val());
if($('#legendlocation-select').val()==='none'){
chartData.legend.enabled = 'false';
}else{
chartData.legend.enabled = 'true';
chartData.legend.align = $('#legendlocation-select').val();
}
renderChart();
});
function renderChart(){
if(chart == undefined){
console.log("First Draw");
chart = new Highcharts.Chart(chartData);
}else{
console.log("Redraw");
chart.destroy();
chart = new Highcharts.Chart(chartData);
chart.redraw();
}
};
The chart displays the first time, and then only the empty white area a second time. Any ideas? chartData is a variable with all parameters that display correctly.
here is a JSFiddle that shows the problem http://jsfiddle.net/zVjrb/3/
source
share