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.pie(getData());
5
chart1.hatchFill(true);
6
chart1.bounds(0, 0, '50%', '100%');
7
chart1.hatchFillPalette(['divot', 'grid', 'vertical', 'horizontal']);
8
chart1.container(stage);
9
chart1.draw();
10
11
var chart2 = anychart.funnel(getData());
12
chart2.bounds('50%', 10, '50%', '100%');
13
chart2.hatchFill(true);
14
15
// Gets hatch fill palette.
16
var pieChartHatchFillPalette = chart1.hatchFillPalette();
17
18
chart2.hatchFillPalette(pieChartHatchFillPalette);
19
chart2.container(stage);
20
chart2.draw();
21
22
var customTitle = anychart.standalones.title();
23
customTitle.text('Get and use chart hatchFillPalette');
24
customTitle.container(stage);
25
customTitle.draw();
26
});
27
28
function getData() {
29
return [
30
{x: 'Cycling', value: 7},
31
{x: 'Swimming', value: 7},
32
{x: 'Run', value: 7},
33
{x: 'Hiking', value: 7},
34
{x: 'Alpinism', value: 7}
35
]
36
}