2013-03-18 00:57:50 +01:00
<!doctype html>
< html >
< head >
< title > Line Chart< / title >
2013-03-25 20:25:57 +01:00
< script src = "../Chart.js" > < / script >
2013-03-18 00:57:50 +01:00
< / head >
< body >
2014-06-29 19:36:04 +02:00
< div style = "width:30%" >
< div >
< canvas id = "canvas" height = "450" width = "600" > < / canvas >
< / div >
< / div >
2013-03-18 00:57:50 +01:00
< script >
2014-06-29 19:36:04 +02:00
var randomScalingFactor = function(){ return Math.round(Math.random()*100)};
2013-03-18 00:57:50 +01:00
var lineChartData = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
{
2014-06-29 19:36:04 +02:00
label: "My First dataset",
fillColor : "rgba(220,220,220,0.2)",
2013-03-18 00:57:50 +01:00
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
2014-06-29 19:36:04 +02:00
pointHighlightFill : "#fff",
pointHighlightStroke : "rgba(220,220,220,1)",
data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
2013-03-18 00:57:50 +01:00
},
{
2014-06-29 19:36:04 +02:00
label: "My Second dataset",
fillColor : "rgba(151,187,205,0.2)",
2013-03-18 00:57:50 +01:00
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
2014-06-29 19:36:04 +02:00
pointHighlightFill : "#fff",
pointHighlightStroke : "rgba(151,187,205,1)",
data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
2013-03-18 00:57:50 +01:00
}
]
2014-06-29 19:36:04 +02:00
2013-03-18 00:57:50 +01:00
}
2014-06-29 19:36:04 +02:00
window.onload = function(){
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx).Line(lineChartData, {
responsive: true
});
}
2013-03-18 00:57:50 +01:00
< / script >
< / body >
< / html >