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 chart = anychart.pie([
5
{x: 'Cycling', value: 10},
6
{x: 'Swimming', value: 12},
7
{x: 'Run', value: 18},
8
{x: 'Hiking', value: 11},
9
{x: 'Alpinism', value: 9}
10
]);
11
12
chart.hatchFill(true);
13
14
var palette = anychart.palettes.hatchFills();
15
16
var rect = anychart.math.rect(1, 1, 6, 6);
17
18
var pattern = anychart.graphics.patternFill(rect);
19
20
var circle = stage.circle(3, 3, 2);
21
circle.fill('#BDBDBD');
22
circle.parent(pattern);
23
24
// Set hatch fill with pattern by index.
25
palette.itemAt(1, pattern);
26
27
chart.hatchFillPalette(palette);
28
chart.title('Set hatch fill with pattern by index');
29
chart.container(stage);
30
chart.draw();
31
});