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-24', value_as: 27, value_sydney: 23.6, value_broome: 30.5},
6
{x:'2015-12-25', value_as: 25.5, value_sydney: 24.8, value_broome: 31.2},
7
{x:'2015-12-26', value_as: 23.1, value_sydney: 28, value_broome: 28.4},
8
{x:'2015-12-27', value_as: 26.9, value_sydney: 27.8, value_broome: 30.1},
9
{x:'2015-12-28', value_as: 29.7, value_sydney: 27.8, value_broome: 29.9},
10
{x:'2015-12-29', value_as: 30.3, value_sydney: 25.8, value_broome: 33.1},
11
{x:'2015-12-30', value_as: 23.7, value_sydney: 25.4, value_broome: 33.9},
12
{x:'2015-12-31', value_as: 20.4, value_sydney: 23.7, value_broome: 32.15},
13
{x:'2016-01-01', value_as: 23, value_sydney: 22.4, value_broome: 27.3},
14
{x:'2016-01-02', value_as: 27.5, value_sydney: 26.4, value_broome: 26.4},
15
{x:'2016-01-03', value_as: 28.2, value_sydney: 24.2, value_broome: 30.5},
16
{x:'2016-01-04', value_as: 23.3, value_sydney: 25.2, value_broome: 30.2},
17
{x:'2016-01-05', value_as: 28.9, value_sydney: 24.3, value_broome: 28.8},
18
{x:'2016-01-06', value_as: 29.3, value_sydney: 28.9, value_broome: 26.9},
19
{x:'2016-01-07', value_as: 28.4, value_sydney: 25.7, value_broome: 31.3},
20
{x:'2016-01-08', value_as: 22.8, value_sydney: 27.3, value_broome: 31.8},
21
{x:'2016-01-09', value_as: 25, value_sydney: 28.1, value_broome: 30.9},
22
{x:'2016-01-10', value_as: 26.5, value_sydney: 23, value_broome: 32.1},
23
{x:'2016-01-11', value_as: 27, value_sydney: 23.5, value_broome: 32.5},
24
{x:'2016-01-12', value_as: 27.8, value_sydney: 24.6, value_broome: 30.7},
25
{x:'2016-01-13', value_as: 24.2, value_sydney: 21, value_broome: 28.8},
26
{x:'2016-01-14', value_as: 29.3, value_sydney: 21.7, value_broome: 28.4},
27
{x:'2016-01-15', value_as: 28.1, value_sydney: 25.7, value_broome: 30.7},
28
{x:'2016-01-16', value_as: 30.4, value_sydney: 25.8, value_broome: 28.6},
29
{x:'2016-01-17', value_as: 28.9, value_sydney: 28.4, value_broome: 29.8},
30
{x:'2016-01-18', value_as: 24.8, value_sydney: 28.2, value_broome: 29.4},
31
{x:'2016-01-19', value_as: 31.7, value_sydney: 28.1, value_broome: 30.3},
32
{x:'2016-01-20', value_as: 29.9, value_sydney: 28.3, value_broome: 33.6},
33
{x:'2016-01-21', value_as: 24.9, value_sydney: 25.9, value_broome: 30.5},
34
{x:'2016-01-22', value_as: 29.9, value_sydney: 26.3, value_broome: 30.5},
35
{x:'2016-01-23', 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
chart.plot(0).yAxis();
63
chart.title('Column in Stocks: daily temperature \nColoring');
64
65
chart.container('container');
66
chart.draw();
67
});