Created
April 7, 2015 14:19
-
-
Save tbpgr/304782f57b6f0a0fb8e7 to your computer and use it in GitHub Desktop.
Chart.js LineChart Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Line Chart Test</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script> | |
<script language="JavaScript"><!-- | |
function displayLineChart() { | |
var data = { | |
labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | |
datasets: [ | |
{ | |
label: "Prime and Fibonacci", | |
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: [2, 3, 5, 7, 11, 13, 17, 19, 23, 29] | |
}, | |
{ | |
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: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] | |
} | |
] | |
}; | |
var ctx = document.getElementById("lineChart").getContext("2d"); | |
var options = { }; | |
var lineChart = new Chart(ctx).Line(data, options); | |
} | |
--></script> | |
</head> | |
<body onload="displayLineChart();"> | |
<div class="box"> | |
<canvas id="lineChart" height="450" width="800"></canvas> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment