|
42 | 42 | }); |
43 | 43 |
|
44 | 44 | 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", { |
45 | 107 | theme: "light2", // "light1", "dark1", "dark2" |
46 | 108 | animationEnabled: true, |
47 | 109 | title: { |
|
72 | 134 | }] |
73 | 135 | }); |
74 | 136 |
|
75 | | - var chart3 = new CanvasJS.Chart("chartContainer3", { |
| 137 | + var chart4 = new CanvasJS.Chart("chartContainer4", { |
76 | 138 | theme: "light2", // "light1", "dark1", "dark2" |
77 | 139 | animationEnabled: true, |
78 | 140 | zoomEnabled: true, |
|
107 | 169 | chart1.render(); |
108 | 170 | chart2.render(); |
109 | 171 | chart3.render(); |
| 172 | + chart4.render(); |
110 | 173 | //CanvasJSDataAsCSV(chart [,"Filename"]); //Filename is optional - defaults to "chart-data" |
111 | 174 | //chart.exportAsCSV(["Filename"]); |
112 | 175 | CanvasJSDataAsCSV(chart1, "Chart1 Data"); //chart1.exportAsCSV("Chart1 Data"); |
113 | 176 | CanvasJSDataAsCSV(chart2, "Chart2 Data"); //chart2.exportAsCSV("Chart2 Data"); |
114 | 177 | CanvasJSDataAsCSV(chart3, "Chart3 Data"); //chart3.exportAsCSV("Chart3 Data"); |
| 178 | + CanvasJSDataAsCSV(chart4, "Chart3 Data"); //chart3.exportAsCSV("Chart3 Data"); |
115 | 179 | } |
116 | 180 | </script> |
117 | 181 | </head> |
118 | 182 |
|
119 | 183 | <body> |
120 | 184 | <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> |
122 | 186 | <h2 id="canvasjs">CanvasJS</h2> |
123 | 187 | <p>CanvasJS is an HTML5 & 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> |
124 | 188 | <h4 id="canvasjsfeatures">CanvasJS Features:</h4> |
@@ -154,11 +218,14 @@ <h4>Live Example</h4> |
154 | 218 | <p>Example 1: When exportEnabled property is set to true</p> |
155 | 219 | <div id="chartContainer1" style="height: 360px; width: 60%; border: 1px solid black;"></div> |
156 | 220 | <br/> |
157 | | - <p>Example 2: When exportEnabled property is set to false</p> |
| 221 | + <p>Example 2: Exporting Multi-Series Chart as CSV</p> |
158 | 222 | <div id="chartContainer2" style="height: 360px; width: 60%; border: 1px solid black;"></div> |
159 | 223 | <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> |
161 | 225 | <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> |
162 | 229 | <script src="https://canvasjs.com/assets/script/canvasjs.min.js"> </script> |
163 | 230 | <script src="dist/canvasjsascsv.min.js"> </script> |
164 | 231 | </body> |
|
0 commit comments