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 data
4
var data = [
5
{name: "Total Market", value: 232000, custom_field: "info 1"},
6
{name: "Prospects", value: 94480, custom_field: "info 2"},
7
{name: "Leads", value: 47390, custom_field: "info 3"},
8
{name: "Sales", value: 22181, custom_field: "info 4"}
9
];
10
11
// create a chart and set the data
12
var chart = anychart.funnel(data);
13
14
// configure labels
15
chart.labels().format("{%x}: {%yPercentOfTotal}%");
16
17
// configure tooltips
18
chart.tooltip().format("{%yPercentOfTotal}% ({%value})\n\n{%custom_field}");
19
20
// set the container id
21
chart.container("container");
22
23
// initiate drawing the chart
24
chart.draw();
25
});