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
// set the data
4
table = anychart.data.table();
5
table.addData([
6
['2004-01-02', 2995, 1217],
7
['2004-01-05', 3889, 3885],
8
['2004-01-06', 4368, 992],
9
['2004-01-07', 4875, 1753],
10
['2004-01-08', 6168, 2493],
11
['2004-01-09', 6885, 5672],
12
['2004-01-12', 5287, 7284],
13
['2004-01-13', 5633, 2737],
14
['2004-01-14', 4229, 8338],
15
['2004-01-15', 4609, 4829],
16
['2004-01-16', 9129, 7532],
17
['2004-01-20', 6227, 1038],
18
['2004-01-21', 5401, 3832],
19
['2004-01-22', 4346, 9248],
20
['2004-01-23', 5964, 2487],
21
['2004-01-26', 4298, 2498],
22
['2004-01-27', 4934, 7564],
23
['2004-01-28', 4944, 5764],
24
['2004-01-29', 8686, 3549],
25
['2004-01-30', 7179, 7365],
26
['2004-02-02', 8164, 2985],
27
['2004-02-03', 8172, 3573],
28
['2004-02-04', 9054, 9834],
29
['2004-02-05', 1039, 3453],
30
['2004-02-06', 7413, 7843],
31
['2004-02-09', 5270, 3820],
32
['2004-02-10', 3974, 2374],
33
['2004-02-11', 8776, 9458],
34
['2004-02-12', 4859, 8237],
35
['2004-02-13', 4336, 9283],
36
['2004-02-17', 3735, 2234]
37
]);
38
39
// map the data
40
mapping_total = table.mapAs();
41
mapping_total.addField('value', 1);
42
mapping_region = table.mapAs();
43
mapping_region.addField('value', 2);
44
45
// chart type
46
var chart = anychart.stock();
47
48
// set the series
49
var series_total = chart.plot(0).stepArea(mapping_total);
50
series_total.name("Total Request number");
51
var series_region = chart.plot(1).stepArea(mapping_region);
52
series_region.name("Region Request Number");
53
54
// coloring
55
series_total.stroke("#ff0000");
56
series_total.fill("#f00 0.6");
57
series_region.stroke("#000");
58
series_region.fill("#fff");
59
series_region.hatchFill("diagonalCross");
60
61
// crosshair settings
62
chart.plot(0).dateTimeHighlighter("green", 0.5, "10 4");
63
64
chart.title('Stock Step Line Demo');
65
chart.container('container');
66
67
chart.draw();
68
});