HTMLcopy
1
<div id="container"></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.line([
4
{x: 'Swimming', value: 1},
5
{x: 'Cycling', value: 4},
6
{x: 'Run', value: 2},
7
{x: 'Hiking', value: 5},
8
]);
9
10
// Use the 'chartDraw' event to determine when the chart has been rendered
11
// and to start saving it as JPG at that point
12
// Set event type.
13
chart.listen('chartDraw', function () {
14
if (confirm('Do you really want to save the chart as JPG?')) {
15
chart.saveAsJpg()}
16
});
17
18
chart.title('ChartDraw type');
19
chart.container('container');
20
chart.draw('container');
21
});