I am trying to determine the correct way to reload the canvas each time the user selects a new chart Type in ChartJS, right now it wont change the chart type:
chartJs.js
var ctx = document.getElementById("myChart").getContext("2d");
ctx.canvas.width = 600;
ctx.canvas.height = 200;
var determineChart = document.getElementById("chartType");
if( determineChart = "line") {
var myChart = new Chart(ctx).Line(data, options);
myChart.destroy();
}
else if (determineChart = "column"){
var myChart = new Chart(ctx).Bar(data, options);
}
index.html
<select id="chartType">
<option value="line">Line</option>
<option value="column">Column</option>
<option value="area">Area</option>
<option value="areaspline">Area Spline</option>
<option value="pie">Pie(Test)</option>
</select>