I am trying to get the data from my php file then into the chart.js
I have the php working and js working (no errors) but for some reason the chart is not showing...
here is my js
var ctx = $("#salesChart").get(0).getContext("2d");
var data = {
labels: [],
datasets: [
{
label: "My First dataset",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: []
}
]
};
$.getJSON('ajax/sales_chart.php', {id:$('#salesChart').data('storeid')}, function(result){
$.each(result, function(i, field){
data.labels.push(field['month']);
data.datasets[0].data.push(field['sales']);
});
});
var myBarChart = new Chart(ctx).Bar(data);