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
// create a chart and set the data
4
var chart = anychart.pyramid([
5
{name: "Fantasy", value: 637166, custom_field: "info 1"},
6
{name: "Science Fiction", value: 721630, custom_field: "info 1"},
7
{name: "Detective", value: 148662, custom_field: "info 1"},
8
{name: "Classics", value: 78662, custom_field: "info 1"},
9
{name: "Textbooks", value: 90000, custom_field: "info 1"}
10
]);
11
12
// configure labels
13
chart.labels().format("{%name}: {%yPercentOfTotal}%");
14
15
// configure tooltips
16
chart.tooltip().format("{%yPercentOfTotal}% ({%value})\n{%custom_field}");
17
18
// draw chart
19
chart.container("container");
20
chart.draw();
21
});