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, label: {anchor: 'center-top'}}
12
]);
13
14
chart1.labels({position: 'inside'});
15
chart1.bounds(0, 20, '50%', '100%');
16
chart1.palette(anychart.palettes.earth);
17
chart1.container(stage);
18
chart1.draw();
19
20
var chart2 = anychart.column();
21
chart2.addSeries([1, 2, 3, 4], [2, 3, 4, 1], [3, 4, 1, 2], [4, 1, 2, 3]);
22
chart2.bounds('50%', 20, '50%', '100%');
23
24
// Get chart palette.
25
var palette = chart1.palette();
26
27
chart2.palette(palette);
28
chart2.container(stage);
29
chart2.draw();
30
31
var customTitle = anychart.standalones.title();
32
customTitle.text('Get and use chart palette');
33
customTitle.container(stage);
34
customTitle.draw();
35
});