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
// create a data set
4
var data = anychart.data.set([
5
["January", 0.7, 6.1, 8.1, 12.6],
6
["February", 0.6, 6.3, 8.5, 12.2],
7
["March", 1.9, 8.5, 10.3, 13.1],
8
["April", 3.1, 10.8, 13.4, 15.9],
9
["May", 5.7, 14.4, 14.9, 16.4]
10
]);
11
12
// map the data
13
var seriesData_1 = data.mapAs({x: 0, low: 1, high: 2});
14
var seriesData_2 = data.mapAs({x: 0, low: 3, high: 4});
15
16
// create a chart
17
var chart = anychart.area();
18
19
// set the interactivity mode
20
chart.interactivity().hoverMode("single");
21
22
// create the first series, set the data and name
23
var series1 = chart.rangeArea(seriesData_1);
24
series1.name("2004");
25
26
// configure the visual settings of the first series
27
series1.normal().fill("#00cc99", 0.3);
28
series1.hovered().fill("#00cc99", 0.1);
29
series1.selected().fill("#00cc99", 0.5);
30
series1.normal().lowStroke("#00cc99", 1, "10 5", "round");
31
series1.hovered().lowStroke("#00cc99", 2, "10 5", "round");
32
series1.selected().lowStroke("#00cc99", 4, "10 5", "round");
33
series1.normal().highStroke("#ff6666", 1, "10 5", "round");
34
series1.hovered().highStroke("#ff6666", 2, "10 5", "round");
35
series1.selected().highStroke("#ff6666", 4, "10 5", "round");
36
37
// create the second series, set the data and name
38
var series2 = chart.rangeArea(seriesData_2);
39
series2.name("2005");
40
41
// configure the visual settings of the second series
42
series2.normal().fill("#0066cc", 0.3);
43
series2.hovered().fill("#0066cc", 0.1);
44
series2.selected().fill("#0066cc", 0.5);
45
series2.normal().hatchFill("forward-diagonal", "#0066cc", 1, 15);
46
series2.hovered().hatchFill("forward-diagonal", "#0066cc", 1, 15);
47
series2.selected().hatchFill("forward-diagonal", "#0066cc", 1, 15);
48
series2.normal().lowStroke("#0066cc", 1);
49
series2.hovered().lowStroke("#0066cc", 2);
50
series2.selected().lowStroke("#0066cc", 4);
51
series2.normal().highStroke("#ff6666");
52
series2.hovered().highStroke("#ff6666", 2);
53
series2.selected().highStroke("#ff6666", 4);
54
55
// set the chart title
56
chart.title("Range Area Chart: Appearance");
57
58
// set the titles of the axes
59
chart.xAxis().title("Month");
60
chart.yAxis().title("Temperature, \xb0C");
61
62
// set the container id
63
chart.container("container");
64
65
// initiate drawing the chart
66
chart.draw();
67
});