Skip to content

Commit ad4db9c

Browse files
committed
Added Multi-Series Chart Example
1 parent c8b1e68 commit ad4db9c

File tree

3 files changed

+112
-32
lines changed

3 files changed

+112
-32
lines changed

examples/Example 2.html

Lines changed: 66 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,77 @@
22
<head>
33
<script type="text/javascript">
44
window.onload = function() {
5-
var chart = new CanvasJS.Chart("chartContainer", {
6-
theme: "light2", // "light1", "dark1", "dark2"
7-
animationEnabled: true,
8-
title: {
9-
text: "Basic Column Chart"
10-
},
11-
data: [{
12-
// Change type to "bar", "area", "spline", "pie",etc.
13-
type: "column",
14-
dataPoints: [{
15-
label: "apple",
16-
y: 10
17-
}, {
18-
label: "orange",
19-
y: 15
20-
}, {
21-
label: "banana",
22-
y: 25
23-
}, {
24-
label: "mango",
25-
y: 30
26-
}, {
27-
label: "grape",
28-
y: 28
29-
}]
30-
}]
31-
});
32-
chart.render();
33-
//CanvasJSDataAsCSV(chart, ["Filename"]); //Filename is optional - defaults to "chart-data"
34-
CanvasJSDataAsCSV(chart, "Chart Data");
5+
var chart = new CanvasJS.Chart("chartContainer", {
6+
theme: "light2", // "light1", "dark1", "dark2"
7+
animationEnabled: true,
8+
zoomEnabled: true,
9+
exportEnabled: true,
10+
title: {
11+
text: "Exporting Multi-Series Chart as CSV"
12+
},
13+
data: [{
14+
type: "line",
15+
dataPoints: [
16+
{ x: 10, y: 21 },
17+
{ x: 20, y: 25 },
18+
{ x: 30, y: 20 },
19+
{ x: 40, y: 25 },
20+
{ x: 50, y: 27 },
21+
{ x: 60, y: 28 },
22+
{ x: 70, y: 28 },
23+
{ x: 80, y: 24 },
24+
{ x: 90, y: 26 }
25+
]
26+
}, {
27+
type: "line",
28+
dataPoints: [
29+
{ x: 10, y: 31 },
30+
{ x: 20, y: 35 },
31+
{ x: 30, y: 30 },
32+
{ x: 40, y: 35 },
33+
{ x: 50, y: 35 },
34+
{ x: 60, y: 38 },
35+
{ x: 70, y: 38 },
36+
{ x: 80, y: 34 },
37+
{ x: 90, y: 44 }
38+
]
39+
}, {
40+
type: "line",
41+
dataPoints: [
42+
{ x: 10, y: 45 },
43+
{ x: 20, y: 50 },
44+
{ x: 30, y: 40 },
45+
{ x: 40, y: 45 },
46+
{ x: 50, y: 45 },
47+
{ x: 60, y: 48 },
48+
{ x: 70, y: 43 },
49+
{ x: 80, y: 41 },
50+
{ x: 90, y: 28 }
51+
]
52+
}, {
53+
type: "line",
54+
dataPoints: [
55+
{ x: 10, y: 71 },
56+
{ x: 20, y: 55 },
57+
{ x: 30, y: 50 },
58+
{ x: 40, y: 65 },
59+
{ x: 50, y: 95 },
60+
{ x: 60, y: 68 },
61+
{ x: 70, y: 28 },
62+
{ x: 80, y: 34 },
63+
{ x: 90, y: 14 }
64+
]
65+
}]
66+
});
67+
chart.render();
68+
//CanvasJSDataAsCSV(chart, ["Filename"]); //Filename is optional - defaults to "chart-data"
69+
CanvasJSDataAsCSV(chart, "Chart Data");
3570
}
3671
</script>
3772
</head>
3873

3974
<body>
40-
<div id="chartContainer" style="height: 400px; width: 60%;margin: auto;"></div>
75+
<div id="chartContainer" style="height: 360px; width: 60%;margin: auto;"></div>
4176
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"> </script>
4277
<script src="../dist/canvasjsascsv.min.js"> </script>
4378
</body>

examples/Example 3.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
var chart = new CanvasJS.Chart("chartContainer", {
66
theme: "light2", // "light1", "dark1", "dark2"
77
animationEnabled: true,
8-
zoomEnabled: true,
98
title: {
109
text: "Basic Column Chart"
1110
},

examples/Example 4.html

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<html>
2+
<head>
3+
<script type="text/javascript">
4+
window.onload = function() {
5+
var chart = new CanvasJS.Chart("chartContainer", {
6+
theme: "light2", // "light1", "dark1", "dark2"
7+
animationEnabled: true,
8+
zoomEnabled: true,
9+
title: {
10+
text: "Basic Column Chart"
11+
},
12+
data: [{
13+
// Change type to "bar", "area", "spline", "pie",etc.
14+
type: "column",
15+
dataPoints: [{
16+
label: "apple",
17+
y: 10
18+
}, {
19+
label: "orange",
20+
y: 15
21+
}, {
22+
label: "banana",
23+
y: 25
24+
}, {
25+
label: "mango",
26+
y: 30
27+
}, {
28+
label: "grape",
29+
y: 28
30+
}]
31+
}]
32+
});
33+
chart.render();
34+
//CanvasJSDataAsCSV(chart, ["Filename"]); //Filename is optional - defaults to "chart-data"
35+
CanvasJSDataAsCSV(chart, "Chart Data");
36+
}
37+
</script>
38+
</head>
39+
40+
<body>
41+
<div id="chartContainer" style="height: 400px; width: 60%;margin: auto;"></div>
42+
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"> </script>
43+
<script src="../dist/canvasjsascsv.min.js"> </script>
44+
</body>
45+
46+
</html>

0 commit comments

Comments
 (0)