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
3
// data
4
var data = anychart.data.set([
5
["January", -100, 200],
6
["February", -120, -400],
7
["March", -100, -300],
8
["April", 110, -100],
9
["May", 190, 400]
10
]);
11
12
var chart = anychart.line();
13
chart.xGrid(true).yGrid(true);
14
15
// create line series
16
line = chart.line(data.mapAs({x: 0, value: 1}));
17
// set positive and negative stroke settings
18
line.stroke("#3ba158", 2, "2 2");
19
line.negativeStroke("2 #fa6b71");
20
21
// create area series
22
area = chart.area(data.mapAs({x: 0, value: 2}));
23
24
// set positive and negative stroke and fill settings
25
area.stroke(anychart.color.darken("#ed7d31"));
26
area.fill('#ed7d31 0.5');
27
28
area.negativeStroke(anychart.color.darken("#adadad"), 0.5);
29
area.negativeFill('#adadad 0.5');
30
31
// chart title
32
chart.title("Negative Fill and Stroke");
33
34
// draw chart
35
chart.container("container");
36
chart.draw();
37
});