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
anychart.onDocumentReady(function () {
2
var stage = anychart.graphics.create("container");
3
4
var chart = anychart.line();
5
chart.line([10, 4, 17, 20, 16, 35, 6, 15]);
6
chart.left("5%");
7
chart.title("Save chart as PDF file.");
8
chart.container(stage);
9
chart.draw();
10
11
var customLabel = anychart.standalones.label();
12
customLabel.background({fill: "#9E9E9E"});
13
customLabel.text("Save image");
14
customLabel.fontColor("#fff");
15
customLabel.padding(5);
16
customLabel.offsetX(5);
17
customLabel.listen("click", function () {
18
19
// Saves into PDF file.
20
chart.saveAsPdf("a4", true, 100, 50);
21
22
});
23
customLabel.container(stage);
24
customLabel.draw();
25
});