HTMLcopy
1
<button onclick="csv()">CSV</button>
2
<button onclick="xlsx()">XLSX</button>
3
<div id="container"></div>
CSScopy
15
1
html, body {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
7
button {
8
margin: 10px 0 0 10px;
9
}
10
#container {
11
position: absolute;
12
width: 100%;
13
top: 35px;
14
bottom: 0;
15
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// data
4
var data = [
5
["Chocolate paste", 5],
6
["White honey", 2],
7
["Strawberry jam", 2],
8
["Condensed milk", 1]
9
];
10
11
// set chart type
12
chart = anychart.column(data);
13
14
// set chart title
15
chart.title("Export Data Sample");
16
17
// display a chart
18
chart.container("container").draw();
19
});
20
21
// save chart data in csv format
22
function csv() {
23
chart.saveAsCsv();
24
};
25
26
// save chart data in xlsx format
27
function xlsx() {
28
chart.saveAsXlsx();
29
};