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 pyramidChart = anychart.pyramid([
5
{x: "Physical", value: 125},
6
{x: "Data Link", value: 125},
7
{x: "Network", value: 125},
8
{x: "Transport", value: 125},
9
{x: "Session", value: 125},
10
{x: "Presentation", value: 125},
11
{x: "Application", value: 390, label: {anchor: "centerTop"}}
12
]);
13
pyramidChart.labels({position: "inside"});
14
pyramidChart.legend(false);
15
pyramidChart.bounds(0, 20, "50%", "100%");
16
pyramidChart.fill(function () {
17
return "rgba(135," + (40 * (this.index + 1) - 10) + ", 248, 0.6)";
18
});
19
pyramidChart.container(stage);
20
pyramidChart.draw();
21
22
var funnelChart = anychart.funnel([10, 3, 7, 10, 5]);
23
funnelChart.labels({position: "inside"});
24
funnelChart.legend(false);
25
funnelChart.bounds("50%", 20, "50%", "100%");
26
27
// Get fill.
28
var pieChartFill = pyramidChart.fill();
29
30
funnelChart.fill(pieChartFill);
31
funnelChart.container(stage);
32
funnelChart.draw();
33
34
var customTitle = anychart.standalones.title();
35
customTitle.text("Get and use chart fill.");
36
customTitle.container(stage);
37
customTitle.draw();
38
});