Repository navigation
Expand file tree
/
Copy pathcanvasJSexample.html
More file actions
55 lines (51 loc) · 1.65 KB
/
Copy pathcanvasJSexample.html
File metadata and controls
55 lines (51 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE HTML>
<html> <!-- canvasJSexample.html -->
<head>
<style>
body {
font-family: arial;
}
</style>
<script type='text/javascript' src="https://canvasjs.com/assets/script/canvasjs.min.js"> </script>
<script type='text/javascript' src='https://www.brython.info/src/brython.js'></script>
<script type='text/python' src='canvasJSexample.py'></script>
<script type="text/javascript">
function doChart(cTitle, cTheme, cType, cAnim, cLabels, cPoints) {
try {
dp = [];
for (var n=0; n<cLabels.length; n++) {
dp[n] = { label: cLabels[n], y: cPoints[n] };
}
var chart = new CanvasJS.Chart("chartContainer", {
theme: cTheme,
animationEnabled: cAnim,
title:{text: cTitle},
data: [ { type: cType, dataPoints: dp } ]
});
chart.render();
} catch (err) {
alert('doChart() Exception: ' + err.message);
}
}
</script>
</head>
<body onload='brython(1)'>
<table>
<tr>
<td style='width: 100px'>
<div>
<table>
<tr><td>Chart Type</td></tr>
<tr><td><input type="radio" id="type0" name="type" checked>Column</td></tr>
<tr><td><input type="radio" id="type1" name="type">Bar</td></tr>
<tr><td><input type="radio" id="type2" name="type">Pie</td></tr>
<tr><td><input type="radio" id="type3" name="type">Spline</td></tr>
<tr><td><input type="radio" id="type4" name="type">Area</td></tr>
</table>
</div>
</td>
<td style='width: 90%'><div id="chartContainer" style="height: 370px; width: 100%;"></div></td>
</tr>
</table>
</body>
</html>