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
3
var chart = anychart.pyramid([
4
{name: "Fantasy", value: 637166},
5
{name: "Science Fiction", value: 721630},
6
{name: "Detective", value: 148662},
7
{name: "Classics", value: 78662},
8
{name: "Textbooks", value: 90000}
9
]);
10
11
// change the labels position
12
chart.labels().position('outsideRight'); // place labels to the right
13
chart.connectorLength(45); // set 45px connectors length
14
15
// format the labels text
16
chart.labels().format("{%name}: {%Value}");
17
18
// draw chart
19
chart.container("container");
20
chart.draw();
21
});