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
// We do that for the demo purposes only.
5
var palette = ['divot', 'grid', 'vertical', 'horizontal', 'confetti', 'diagonal-cross', 'zig-zag'];
6
7
var chart1 = anychart.pyramid([
8
{x: 'Physical', value: 125},
9
{x: 'Data Link', value: 125},
10
{x: 'Network', value: 125},
11
{x: 'Transport', value: 125},
12
{x: 'Session', value: 125},
13
{x: 'Presentation', value: 125},
14
{x: 'Application', value: 390, label: {anchor: 'center-top'}}
15
]);
16
17
chart1.labels({position: 'inside'}).bounds(0, 20, '50%', '100%');
18
chart1.hatchFill(true).legend(false);
19
chart1.hatchFillPalette(palette);
20
chart1.container(stage);
21
chart1.draw();
22
23
// Get hatch fill palette.
24
var hatchFillPalette = chart1.hatchFillPalette();
25
26
var chart2 = anychart.pie([7, 7, 7, 7, 7, 7, 7]);
27
chart2.hatchFill(true).legend(false);
28
chart2.bounds('50%', 20, '50%', '100%');
29
chart2.hatchFillPalette(hatchFillPalette);
30
chart2.container(stage);
31
chart2.draw();
32
33
var customTitle = anychart.standalones.title();
34
customTitle.text('Get and use chart hatch fill palette');
35
customTitle.container(stage);
36
customTitle.draw();
37
});