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
chart = anychart.pie([
5
{x: 'Cycling', value: 10},
6
{x: 'Swimming', value: 12},
7
{x: 'Run', value: 18},
8
{x: 'Hiking', value: 11},
9
{x: 'Alpinism', value: 9}
10
]);
11
12
var legend = anychart.standalones.legend();
13
legend.title('My custom legend');
14
legend.container(stage);
15
legend.draw();
16
17
// Get remaining bounds.
18
var chartBounds = legend.getRemainingBounds();
19
20
chart.bounds(chartBounds);
21
chart.container(stage);
22
chart.draw();
23
});