Skip to content

Commit b9133b8

Browse files
committed
Added Multi-Series Chart Support
1 parent bc8434b commit b9133b8

File tree

1 file changed

+71
-4
lines changed

1 file changed

+71
-4
lines changed

index.html

Lines changed: 71 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,68 @@
4242
});
4343

4444
var chart2 = new CanvasJS.Chart("chartContainer2", {
45+
theme: "light2", // "light1", "dark1", "dark2"
46+
animationEnabled: true,
47+
exportEnabled: true,
48+
title: {
49+
text: "Exporting Multi-Series Chart Data as CSV"
50+
},
51+
data: [{
52+
type: "line",
53+
dataPoints: [
54+
{ x: 10, y: 21 },
55+
{ x: 20, y: 25 },
56+
{ x: 30, y: 20 },
57+
{ x: 40, y: 25 },
58+
{ x: 50, y: 27 },
59+
{ x: 60, y: 28 },
60+
{ x: 70, y: 28 },
61+
{ x: 80, y: 24 },
62+
{ x: 90, y: 26 }
63+
]
64+
}, {
65+
type: "line",
66+
dataPoints: [
67+
{ x: 10, y: 31 },
68+
{ x: 20, y: 35 },
69+
{ x: 30, y: 30 },
70+
{ x: 40, y: 35 },
71+
{ x: 50, y: 35 },
72+
{ x: 60, y: 38 },
73+
{ x: 70, y: 38 },
74+
{ x: 80, y: 34 },
75+
{ x: 90, y: 44 }
76+
]
77+
}, {
78+
type: "line",
79+
dataPoints: [
80+
{ x: 10, y: 45 },
81+
{ x: 20, y: 50 },
82+
{ x: 30, y: 40 },
83+
{ x: 40, y: 45 },
84+
{ x: 50, y: 45 },
85+
{ x: 60, y: 48 },
86+
{ x: 70, y: 43 },
87+
{ x: 80, y: 41 },
88+
{ x: 90, y: 28 }
89+
]
90+
}, {
91+
type: "line",
92+
dataPoints: [
93+
{ x: 10, y: 71 },
94+
{ x: 20, y: 55 },
95+
{ x: 30, y: 50 },
96+
{ x: 40, y: 65 },
97+
{ x: 50, y: 95 },
98+
{ x: 60, y: 68 },
99+
{ x: 70, y: 28 },
100+
{ x: 80, y: 34 },
101+
{ x: 90, y: 14 }
102+
]
103+
}]
104+
});
105+
106+
var chart3 = new CanvasJS.Chart("chartContainer3", {
45107
theme: "light2", // "light1", "dark1", "dark2"
46108
animationEnabled: true,
47109
title: {
@@ -72,7 +134,7 @@
72134
}]
73135
});
74136

75-
var chart3 = new CanvasJS.Chart("chartContainer3", {
137+
var chart4 = new CanvasJS.Chart("chartContainer4", {
76138
theme: "light2", // "light1", "dark1", "dark2"
77139
animationEnabled: true,
78140
zoomEnabled: true,
@@ -107,18 +169,20 @@
107169
chart1.render();
108170
chart2.render();
109171
chart3.render();
172+
chart4.render();
110173
//CanvasJSDataAsCSV(chart [,"Filename"]); //Filename is optional - defaults to "chart-data"
111174
//chart.exportAsCSV(["Filename"]);
112175
CanvasJSDataAsCSV(chart1, "Chart1 Data"); //chart1.exportAsCSV("Chart1 Data");
113176
CanvasJSDataAsCSV(chart2, "Chart2 Data"); //chart2.exportAsCSV("Chart2 Data");
114177
CanvasJSDataAsCSV(chart3, "Chart3 Data"); //chart3.exportAsCSV("Chart3 Data");
178+
CanvasJSDataAsCSV(chart4, "Chart3 Data"); //chart3.exportAsCSV("Chart3 Data");
115179
}
116180
</script>
117181
</head>
118182

119183
<body>
120184
<h1 id="exportcanvasjschartdataascsv">Export CanvasJS Chart Data as CSV</h1>
121-
<p>This plugin allows you to export and save CanvasJS Chart's data as CSV.</p>
185+
<p>This plugin allows you to export and save CanvasJS Chart's data as CSV. Check out <a href="https://github.com/vishwas-r/Export-CanvasJS-Chart-Data-as-CSV">Github Repository</a> for more info / examples.</p>
122186
<h2 id="canvasjs">CanvasJS</h2>
123187
<p>CanvasJS is an HTML5 &amp; JavaScript based Charting Library that runs on all modern devices including iPhone, Android, Desktops, etc. Charts are beautiful and API is very simple to use.</p>
124188
<h4 id="canvasjsfeatures">CanvasJS Features:</h4>
@@ -154,11 +218,14 @@ <h4>Live Example</h4>
154218
<p>Example 1: When exportEnabled property is set to true</p>
155219
<div id="chartContainer1" style="height: 360px; width: 60%; border: 1px solid black;"></div>
156220
<br/>
157-
<p>Example 2: When exportEnabled property is set to false</p>
221+
<p>Example 2: Exporting Multi-Series Chart as CSV</p>
158222
<div id="chartContainer2" style="height: 360px; width: 60%; border: 1px solid black;"></div>
159223
<br/>
160-
<p>Example 3: When exportEnabled property is set to false and zoomEnabled is set to true</p>
224+
<p>Example 3: When exportEnabled property is set to false</p>
161225
<div id="chartContainer3" style="height: 360px; width: 60%; border: 1px solid black;"></div>
226+
<br/>
227+
<p>Example 2: When exportEnabled property is set to false and zoomEnabled is set to true</p>
228+
<div id="chartContainer4" style="height: 360px; width: 60%; border: 1px solid black;"></div>
162229
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"> </script>
163230
<script src="dist/canvasjsascsv.min.js"> </script>
164231
</body>

0 commit comments

Comments
 (0)