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 pattern = stage.pattern(new anychart.graphics.math.Rect(0, 0, 20, 20));
5
pattern.star5(11, 7, 9).stroke('#fffaf0');
6
7
var chart = anychart.line();
8
9
var series1 = chart.line([
10
{x: 'Cycling', value: 10},
11
{x: 'Swimming', value: 32},
12
{x: 'Run', value: 18}
13
]);
14
15
var series2 = chart.line([
16
{x: 'Cycling', value: 15},
17
{x: 'Swimming', value: 9},
18
{x: 'Run', value: 29}
19
]);
20
21
chart.legend(true);
22
23
var item = series1.legendItem();
24
25
// Set hatch fill.
26
item.iconHatchFill(pattern);
27
28
chart.title('Set hatch fill as a pattern');
29
chart.container(stage);
30
chart.draw();
31
});