I've been trying to populate my chart with data I get from an ajax request but I can not seem to figure it out. Could anyone help?
var simple_forms;
$.ajax({
type: "GET",
url: url,
data: "user_id="+user_id,
success: function(data){ simple_forms = data; },
error: function(data) { }
});
This is the output from the data
= [1,2,3,4,5,6,7]
var weekly_line_data = {
labels : ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
datasets : [
{
label: "Simple Forms",fillColor : "transparent",strokeColor : "#53A3EB",pointColor : "#53A3EB",pointStrokeColor : "#fff",pointHighlightFill : "#2980b9",pointHighlightStroke : "#2980b9",
data : simple_forms
}]
}
var ctx = document.getElementById("weekly_line_data").getContext("2d");
window.myLine = new Chart(ctx).Line(weekly_line_data, {responsive: true,scaleShowGridLines : true,scaleGridLineWidth : 1,datasetStrokeWidth : 1,pointDotRadius : 5});