|
2 | 2 | <head> |
3 | 3 | <script type="text/javascript"> |
4 | 4 | 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"); |
35 | 70 | } |
36 | 71 | </script> |
37 | 72 | </head> |
38 | 73 |
|
39 | 74 | <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> |
41 | 76 | <script src="https://canvasjs.com/assets/script/canvasjs.min.js"> </script> |
42 | 77 | <script src="../dist/canvasjsascsv.min.js"> </script> |
43 | 78 | </body> |
|
0 commit comments