Code: Select all
<!DOCTYPE html>
<html>
<head>
<title>TeeChart JavaScript Date Time Chart Example</title>
<!--[if lt IE 9]>
<script src="../../src/excanvas/excanvas_text.js"></script>
<script src="../../src/excanvas/canvas.text.js"></script>
<![endif]-->
<script src="Scripts/TeeChart/teechart.js"></script>
<script src="Scripts/TeeChart/teechart-extras.js"></script>
<script src="Scripts/TeeChart/teechart-animations.js"></script>
<script src="Scripts/TeeChart/date.format.js"></script>
<script type="text/javascript">
var Chart1;
function draw() {
Chart1 = new Tee.Chart("canvas");
Chart1.axes.left.title.text = "Value";
Chart1.axes.bottom.title.text = "Time";
Chart1.title.text = "DateTime X data";
var series = Chart1.addSeries(new Tee.Bar(Chart1)), today = new Date().getTime();
var values = [50, 20, 30, 40, 50, 60, 70, 80, 90, 100];
var minValues = [10, 10, 15, 20, 25, 30, 40, 50, 60, 70];
series.data.x = [];
var msecsInADay = 86400000;
for (var t = 0; t < 10; t++) {
series.data.values[t] = values[t];
series.data.x[t] = new Date(today + t * msecsInADay);
series.marks.visible = false;
series.useOrigin = true;
series.origin = minValues[t];
}
Chart1.axes.bottom.labels.dateFormat = "shortTime";
Chart1.draw();
}
</script>
</head>
<body onload="draw()">
<center>
<br><canvas id="canvas" width="600" height="400">
This browser does not seem to support HTML5 Canvas.
</canvas>
</center>
</body>
</html>