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(10, 10, 8).stroke('#78909C');
6
7
var chart = anychart.line([
8
{x: 0, value: 6},
9
{x: 1, value: 10},
10
{x: 2, value: 18},
11
{x: 3, value: 11},
12
{x: 4, value: 9}
13
]);
14
chart.yScale().minimum(0);
15
chart.xScale('linear');
16
17
var controller = chart.annotations();
18
19
var annotation = controller.rectangle();
20
annotation.xAnchor(1.9);
21
annotation.valueAnchor(17.5);
22
annotation.secondXAnchor(2.1);
23
annotation.secondValueAnchor(18.5);
24
25
// Set hatch fill.
26
annotation.hatchFill(pattern);
27
28
chart.title('Set hatch fill parameter as a pattern');
29
chart.container(stage);
30
chart.draw();
31
});