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 chart1 = 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}
12
]);
13
chart1.labels({position: 'inside'});
14
chart1.legend(false);
15
chart1.bounds(0, 20, '50%', '100%');
16
chart1.fill(function () {
17
return 'rgba(135,' + (40 * (this.index + 1) - 10) + ', 248, 0.6)';
18
});
19
chart1.container(stage);
20
chart1.draw();
21
22
// Get fill.
23
var fill = chart1.fill();
24
25
var chart2 = anychart.funnel([10, 3, 7, 10, 5]);
26
chart2.labels({position: 'inside'});
27
chart2.legend(false);
28
chart2.bounds('50%', 20, '50%', '100%');
29
chart2.fill(fill);
30
chart2.container(stage);
31
chart2.draw();
32
33
var customTitle = anychart.standalones.title();
34
customTitle.text('Get and use chart fill');
35
customTitle.container(stage);
36
customTitle.draw();
37
});