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
table = anychart.data.table('x');
4
table.addData([
5
{"x":'2015-12-24T12:00:00', value_as: 27, value_sydney: 23.6, value_broome: 30.5},
6
{"x":'2015-12-25T12:00:00', value_as: 25.5, value_sydney: 24.8, value_broome: 31.2},
7
{"x":'2015-12-26T12:00:00', value_as: 23.1, value_sydney: 28, value_broome: 28.4},
8
{"x":'2015-12-27T12:00:00', value_as: 26.9, value_sydney: 27.8, value_broome: 30.1},
9
{"x":'2015-12-28T12:00:00', value_as: 29.7, value_sydney: 27.8, value_broome: 29.9},
10
{"x":'2015-12-29T12:00:00', value_as: 30.3, value_sydney: 25.8, value_broome: 33.1},
11
{"x":'2015-12-30T12:00:00', value_as: 23.7, value_sydney: 25.4, value_broome: 33.9},
12
{"x":'2015-12-31T12:00:00', value_as: 20.4, value_sydney: 23.7, value_broome: 32.15},
13
{"x":'2016-01-01T12:00:00', value_as: 23, value_sydney: 22.4, value_broome: 27.3},
14
{"x":'2016-01-02T12:00:00', value_as: 27.5, value_sydney: 26.4, value_broome: 26.4},
15
{"x":'2016-01-03T12:00:00', value_as: 28.2, value_sydney: 24.2, value_broome: 30.5},
16
{"x":'2016-01-04T12:00:00', value_as: 23.3, value_sydney: 25.2, value_broome: 30.2},
17
{"x":'2016-01-05T12:00:00', value_as: 28.9, value_sydney: 24.3, value_broome: 28.8},
18
{"x":'2016-01-06T12:00:00', value_as: 29.3, value_sydney: 28.9, value_broome: 26.9},
19
{"x":'2016-01-07T12:00:00', value_as: 28.4, value_sydney: 25.7, value_broome: 31.3},
20
{"x":'2016-01-08T12:00:00', value_as: 22.8, value_sydney: 27.3, value_broome: 31.8},
21
{"x":'2016-01-09T12:00:00', value_as: 25, value_sydney: 28.1, value_broome: 30.9},
22
{"x":'2016-01-10T12:00:00', value_as: 26.5, value_sydney: 23, value_broome: 32.1},
23
{"x":'2016-01-11T12:00:00', value_as: 27, value_sydney: 23.5, value_broome: 32.5},
24
{"x":'2016-01-12T12:00:00', value_as: 27.8, value_sydney: 24.6, value_broome: 30.7},
25
{"x":'2016-01-13T12:00:00', value_as: 24.2, value_sydney: 21, value_broome: 28.8},
26
{"x":'2016-01-14T12:00:00', value_as: 29.3, value_sydney: 21.7, value_broome: 28.4},
27
{"x":'2016-01-15T12:00:00', value_as: 28.1, value_sydney: 25.7, value_broome: 30.7},
28
{"x":'2016-01-16T12:00:00', value_as: 30.4, value_sydney: 25.8, value_broome: 28.6},
29
{"x":'2016-01-17T12:00:00', value_as: 28.9, value_sydney: 28.4, value_broome: 29.8},
30
{"x":'2016-01-18T12:00:00', value_as: 24.8, value_sydney: 28.2, value_broome: 29.4},
31
{"x":'2016-01-19T12:00:00', value_as: 31.7, value_sydney: 28.1, value_broome: 30.3},
32
{"x":'2016-01-20T12:00:00', value_as: 29.9, value_sydney: 28.3, value_broome: 33.6},
33
{"x":'2016-01-21T12:00:00', value_as: 24.9, value_sydney: 25.9, value_broome: 30.5},
34
{"x":'2016-01-22T12:00:00', value_as: 29.9, value_sydney: 26.3, value_broome: 30.5},
35
{"x":'2016-01-23T12:00:00', value_as: 23.9, value_sydney: 26.2, value_broome: 30.5}
36
]);
37
38
mapping_as = table.mapAs({'x':"x", 'value':"value_as"});
39
mapping_sydney = table.mapAs({'x':"x", 'value':"value_sydney"});
40
mapping_broome = table.mapAs({'x':"x", 'value':"value_broome"});
41
42
var chart = anychart.stock();
43
chart.padding(10, 10, 10, 50);
44
45
// series of the first plot
46
var series_as = chart.plot(0).column(mapping_as);
47
series_as.name("Alice's Springs");
48
series_as.fill("#CC9933");
49
series_as.stroke("#663300");
50
51
// series of the second plot
52
var series_sydney = chart.plot(1).column(mapping_sydney);
53
series_sydney.name("Sydney");
54
series_sydney.fill("#fff");
55
series_sydney.hatchFill("cross");
56
series_sydney.stroke("#000");
57
58
// series of the third plot
59
var series_broome = chart.plot(2).column(mapping_broome);
60
series_broome.name("Broome");
61
62
// crosshair settings
63
chart.plot(0).dateTimeHighlighter("#663300", 1.5, "6 2", "round");
64
chart.plot(1).dateTimeHighlighter("#999", 1.5);
65
chart.plot(2).dateTimeHighlighter("#000066", 1.5, "7 4");
66
67
chart.plot(0).yAxis();
68
chart.title('Column in Stocks: daily temperature \nColoring');
69
chart.container('container');
70
71
chart.draw();
72
});