I want to add the values which I get from a database.These values from the database are stored in a separate array.So how should I write the code so that I can put values in the data field which can then be plotted. Also I want to change the labels array to the values contained in a separate array.
<body>
<canvas id="myChart" width="1000" height="400" style="border:2px solid green"></canvas>
<script>
var data = {
labels : ["January","February","March","April","May","June","August"],
datasets : [
{
fillColor : "rgba(220,0,220,0.5)",
strokeColor : "rgba(0,0,0,1)",
pointColor : "rgba(220,20,220,1)",
pointStrokeColor : "#fff",
data : [0,9,0,8,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : [100,100,100,19,96,27,100]
}
]
}
var ctx = document.getElementById("myChart").getContext("2d");
var myNewChart = new Chart(ctx).Line(data);
</script>
</body>