I want to use JSON.parse to convert json to an object. I don’t know where I should put this code, in the function makeChart() ? If so, how exactly?
var obj = JSON.parse(response);
(obj.tot1);
(obj.tot2);
(obj.tot3);
Where & how do I use this in this example:
function makeChart() {
var tot1v =
var tot2v =
var tot3v =
var chart = new CanvasJS.Chart("colChartContainer", {
theme: "theme2",
title: {
text: "Coin Toss Results"
},
data: [{
type: "column",
dataPoints: [{
label: "tot3",
y: tot1v
}, {
label: "tot2",
y: tot2v
},{
label: "tot3",
y: tot3v
}]
}]
});
chart.render();
}
I have modified this http://jsfiddle.net/jx9sJ/5/
My code above in a code share http://codeshare.io/aYM2n