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 chart = anychart.column();
3
4
var series = chart.column([
5
{x: 'January', value: 2},
6
{x: 'February', value: 5},
7
{x: 'March', value: 3},
8
{x: 'April', value: 6},
9
{x: 'May', value: 4}
10
]);
11
series.hatchFill(true);
12
13
var rendering = series.rendering();
14
15
// Get shapes.
16
var shapes = rendering.shapes();
17
18
shapes.pop();
19
shapes.push({
20
name: 'hatchFill',
21
shapeType: 'path',
22
fillName: 'fill',
23
strokeName: 'stroke',
24
isHatchFill: false,
25
zIndex: 0.000001
26
});
27
28
// Set shapes.
29
rendering.shapes(shapes);
30
31
rendering.point(drawer);
32
33
chart.title('Get and set shapes');
34
chart.container('container');
35
chart.draw();
36
});
37
38
function drawer() {
39
// If missing - skip drawing
40
if (this.missing) {
41
return;
42
}
43
44
// Get shapes group.
45
var shapes = this.getShapesGroup(this.pointState);
46
47
// Calculate the left value of the x-axis.
48
var leftX = this.x - this.pointWidth / 2;
49
50
// Calculate the right value of the x-axis.
51
var rightX = leftX + this.pointWidth;
52
53
shapes["hatchFill"]
54
// Draw cone.
55
.moveTo(leftX, this.zero)
56
.lineTo(this.x, this.value)
57
.lineTo(rightX, this.zero)
58
// Close by connecting the last point with the first straight line
59
.close();
60
}