chartnew.js
Version:
Simple HTML5 Charts using the canvas element
50 lines (46 loc) • 1.4 kB
HTML
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
<SCRIPT src='../mathFunctions.js'></script>
<!--[if lte IE 8]><SCRIPT src='source/excanvas.js'></script><![endif]--><SCRIPT src='../ChartNew.js'></script>
</head>
<body>
<canvas id="mycanvas" height="600" width="800"></canvas>
<script>
var LineData = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
{
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
data : [56,55,-59,58,55,55,54],
title : "First data"
},
{
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : [52,58,50,59,56,-57,50],
title : "Second data"
}
]
}
var opts = {
legend : true,
datasetFill: false,
legendBlockSize: 20,
legendColorIndicatorStrokeWidth: 7,
drawXScaleLine: [{position:"bottom",lineWidth:1,lineColor:"black"},{position:"0",lineWidth:1,lineColor:"red"}],
scaleLineWidth: 1,
scaleLineColor: "black"
}
window.onload = function() {
var Line = new Chart(document.getElementById("mycanvas").getContext("2d")).Line(LineData,opts);
}
</script>
</body>
</html>