HTMLcopy
1
<div id="container"></div>
2
<div style="position: absolute; top: 28px; right: 15px; width: 10%;">
3
<input style="margin-bottom: 10px;" type="button" value="csv" onclick="csv()">
4
<textarea style="width: 100%;" rows="5" cols="70" id="csv"></textarea>
5
</div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
var chart;
2
anychart.onDocumentReady(function () {
3
chart = anychart.scatter();
4
chart.line([
5
{x: 1, value: 0},
6
{x: 2, value: 20},
7
{x: 3, value: 10},
8
{x: 4, value: 30},
9
{x: 5, value: 20},
10
{x: 6, value: 40},
11
{x: 7, value: 30},
12
{x: 8, value: 50},
13
{x: 9, value: 40},
14
{x: 1, value: 0}
15
]);
16
chart.title('Get chart data as CSV with parameters using function');
17
chart.container('container');
18
chart.draw();
19
});
20
21
function csv(){
22
// Get chart data as CSV with parameters using function
23
var value = chart.toCsv('default');
24
25
var csv = document.getElementById('csv');
26
csv.value = value;
27
}