<head>
<title>Bar Chart</title>
<script src="../Chart.js"></script>
- <meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
- <style>
- canvas{
- }
- </style>
</head>
<body>
- <canvas id="canvas" height="450" width="600"></canvas>
+ <div style="width: 50%">
+ <canvas id="canvas" height="450" width="600"></canvas>
+ </div>
<script>
+ var randomScalingFactor = function(){ return Math.round(Math.random()*100)};
+
+ var barChartData = {
+ labels : ["January","February","March","April","May","June","July"],
+ datasets : [
+ {
+ fillColor : "rgba(220,220,220,0.5)",
+ strokeColor : "rgba(220,220,220,0.8)",
+ highlightFill: "rgba(220,220,220,0.75)",
+ highlightStroke: "rgba(220,220,220,1)",
+ data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
+ },
+ {
+ fillColor : "rgba(151,187,205,0.5)",
+ strokeColor : "rgba(151,187,205,0.8)",
+ highlightFill : "rgba(151,187,205,0.75)",
+ highlightStroke : "rgba(151,187,205,1)",
+ data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
+ }
+ ]
- var barChartData = {
- labels : ["January","February","March","April","May","June","July"],
- datasets : [
- {
- fillColor : "rgba(220,220,220,0.5)",
- strokeColor : "rgba(220,220,220,1)",
- data : [65,59,90,81,56,55,40]
- },
- {
- fillColor : "rgba(151,187,205,0.5)",
- strokeColor : "rgba(151,187,205,1)",
- data : [28,48,40,19,96,27,100]
- }
- ]
-
- }
+ }
+ window.onload = function(){
+ var ctx = document.getElementById("canvas").getContext("2d");
+ window.myBar = new Chart(ctx).Bar(barChartData, {
+ responsive : true
+ });
+ }
- var myLine = new Chart(document.getElementById("canvas").getContext("2d")).Bar(barChartData);
-
</script>
</body>
</html>
<head>
<title>Doughnut Chart</title>
<script src="../Chart.js"></script>
- <meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<style>
- canvas{
+ body{
+ padding: 0;
+ margin: 0;
+ }
+ #canvas-holder{
+ width:30%;
}
</style>
</head>
<body>
- <canvas id="canvas" height="450" width="450"></canvas>
+ <div id="canvas-holder">
+ <canvas id="chart-area" width="500" height="500"/>
+ </div>
<script>
var doughnutData = [
{
- value: 30,
- color:"#F7464A"
+ value: 300,
+ color:"#F7464A",
+ highlight: "#FF5A5E",
+ label: "Red"
},
{
- value : 50,
- color : "#46BFBD"
+ value: 50,
+ color: "#46BFBD",
+ highlight: "#5AD3D1",
+ label: "Green"
},
{
- value : 100,
- color : "#FDB45C"
+ value: 100,
+ color: "#FDB45C",
+ highlight: "#FFC870",
+ label: "Yellow"
},
{
- value : 40,
- color : "#949FB1"
+ value: 40,
+ color: "#949FB1",
+ highlight: "#A8B3C5",
+ label: "Grey"
},
{
- value : 120,
- color : "#4D5360"
+ value: 120,
+ color: "#4D5360",
+ highlight: "#616774",
+ label: "Dark Grey"
}
-
+
];
- var myDoughnut = new Chart(document.getElementById("canvas").getContext("2d")).Doughnut(doughnutData);
-
+ window.onload = function(){
+ var ctx = document.getElementById("chart-area").getContext("2d");
+ window.myDoughnut = new Chart(ctx).Doughnut(doughnutData, {responsive : true});
+ };
+
+
+
</script>
</body>
</html>
<head>
<title>Line Chart</title>
<script src="../Chart.js"></script>
- <meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
- <style>
- canvas{
- }
- </style>
</head>
<body>
- <canvas id="canvas" height="450" width="600"></canvas>
+ <div style="width:30%">
+ <div>
+ <canvas id="canvas" height="450" width="600"></canvas>
+ </div>
+ </div>
<script>
-
+ var randomScalingFactor = function(){ return Math.round(Math.random()*100)};
var lineChartData = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
{
- fillColor : "rgba(220,220,220,0.5)",
+ 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",
- data : [65,59,90,81,56,55,40]
+ pointHighlightFill : "#fff",
+ pointHighlightStroke : "rgba(220,220,220,1)",
+ data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
},
{
- fillColor : "rgba(151,187,205,0.5)",
+ label: "My Second dataset",
+ fillColor : "rgba(151,187,205,0.2)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
- data : [28,48,40,19,96,27,100]
+ pointHighlightFill : "#fff",
+ pointHighlightStroke : "rgba(151,187,205,1)",
+ data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
}
]
-
+
}
- var myLine = new Chart(document.getElementById("canvas").getContext("2d")).Line(lineChartData);
-
+ window.onload = function(){
+ var ctx = document.getElementById("canvas").getContext("2d");
+ window.myLine = new Chart(ctx).Line(lineChartData, {
+ responsive: true
+ });
+ }
+
+
</script>
</body>
</html>
<!doctype html>
<html>
<head>
- <title>Radar Chart</title>
+ <title>Pie Chart</title>
<script src="../Chart.js"></script>
- <meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
- <style>
- canvas{
- }
- </style>
</head>
<body>
- <canvas id="canvas" height="450" width="450"></canvas>
+ <div id="canvas-holder">
+ <canvas id="chart-area" width="300" height="300"/>
+ </div>
<script>
var pieData = [
{
- value: 30,
- color:"#F38630"
+ value: 300,
+ color:"#F7464A",
+ highlight: "#FF5A5E",
+ label: "Red"
},
{
- value : 50,
- color : "#E0E4CC"
+ value: 50,
+ color: "#46BFBD",
+ highlight: "#5AD3D1",
+ label: "Green"
},
{
- value : 100,
- color : "#69D2E7"
+ value: 100,
+ color: "#FDB45C",
+ highlight: "#FFC870",
+ label: "Yellow"
+ },
+ {
+ value: 40,
+ color: "#949FB1",
+ highlight: "#A8B3C5",
+ label: "Grey"
+ },
+ {
+ value: 120,
+ color: "#4D5360",
+ highlight: "#616774",
+ label: "Dark Grey"
}
-
+
];
- var myPie = new Chart(document.getElementById("canvas").getContext("2d")).Pie(pieData);
-
+ window.onload = function(){
+ var ctx = document.getElementById("chart-area").getContext("2d");
+ window.myPie = new Chart(ctx).Pie(pieData);
+ };
+
+
+
</script>
</body>
</html>
--- /dev/null
+<!doctype html>
+<html>
+ <head>
+ <title>Polar Area Chart</title>
+ <script src="../Chart.js"></script>
+ </head>
+ <body>
+ <div id="canvas-holder" style="width:30%">
+ <canvas id="chart-area" width="300" height="300"/>
+ </div>
+
+
+ <script>
+
+ var polarData = [
+ {
+ value: 300,
+ color:"#F7464A",
+ highlight: "#FF5A5E",
+ label: "Red"
+ },
+ {
+ value: 50,
+ color: "#46BFBD",
+ highlight: "#5AD3D1",
+ label: "Green"
+ },
+ {
+ value: 100,
+ color: "#FDB45C",
+ highlight: "#FFC870",
+ label: "Yellow"
+ },
+ {
+ value: 40,
+ color: "#949FB1",
+ highlight: "#A8B3C5",
+ label: "Grey"
+ },
+ {
+ value: 120,
+ color: "#4D5360",
+ highlight: "#616774",
+ label: "Dark Grey"
+ }
+
+ ];
+
+ window.onload = function(){
+ var ctx = document.getElementById("chart-area").getContext("2d");
+ window.myPolarArea = new Chart(ctx).PolarArea(polarData, {
+ responsive:true
+ });
+ };
+
+
+
+ </script>
+ </body>
+</html>
</style>
</head>
<body>
- <canvas id="canvas" height="450" width="450"></canvas>
+ <div style="width:30%">
+ <canvas id="canvas" height="450" width="450"></canvas>
+ </div>
<script>
+ var radarChartData = {
+ labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
+ 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: [65,59,90,81,56,55,40]
+ },
+ {
+ label: "My Second dataset",
+ fillColor: "rgba(151,187,205,0.2)",
+ strokeColor: "rgba(151,187,205,1)",
+ pointColor: "rgba(151,187,205,1)",
+ pointStrokeColor: "#fff",
+ pointHighlightFill: "#fff",
+ pointHighlightStroke: "rgba(151,187,205,1)",
+ data: [28,48,40,19,96,27,100]
+ }
+ ]
+ };
- var radarChartData = {
- labels : ["Eating","Drinking","Sleeping","Designing","Coding","Partying","Running"],
- datasets : [
- {
- fillColor : "rgba(220,220,220,0.5)",
- strokeColor : "rgba(220,220,220,1)",
- pointColor : "rgba(220,220,220,1)",
- pointStrokeColor : "#fff",
- data : [65,59,90,81,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 : [28,48,40,19,96,27,100]
- }
- ]
-
- }
+ window.onload = function(){
+ window.myRadar = new Chart(document.getElementById("canvas").getContext("2d")).Radar(radarChartData, {
+ responsive: true
+ });
+ }
- var myRadar = new Chart(document.getElementById("canvas").getContext("2d")).Radar(radarChartData,{scaleShowLabels : false, pointLabelFontSize : 10});
-
</script>
</body>
</html>