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
//create data set on our data
3
var data = anychart.data.set([
4
['P1', 31.34, 14, 9],
5
['P2', 49.76, 8, 6],
6
['P3', 57.43, 8, 12],
7
['P4', 60.67, 7, 8],
8
['P5', 88.19, 10, 6],
9
['P6', 103.54, 8.3, 6],
10
['P7', 120.98, 9, 11],
11
['P8', 153.21, 16, 15],
12
['P9', 201.61, 10, 8],
13
['P10', 261.14, 13, 7]
14
]).mapAs({
15
x: [0],
16
value: [1],
17
valueLowerError: [2],
18
valueUpperError: [3]
19
});
20
21
//create line chart
22
var chart = anychart.line();
23
24
//set container id for the chart
25
chart.container('container');
26
chart.background(null);
27
28
//set chart title text settings
29
chart.title()
30
.text('Line Chart with Errors')
31
.fontWeight('normal')
32
.fontFamily('Verdana')
33
.fontColor('#474747')
34
.fontSize('14px');
35
36
// colors
37
var colorAxisLabels = '#929292';
38
var colorAxis = '#C8C8C8';
39
var colorAxisMinor = '#F2F2F2';
40
var colorSeriesStroke = '#60cae1';
41
42
//create line series with our data
43
var series = chart.line(data);
44
series.stroke(colorSeriesStroke);
45
46
// grid & axis settings
47
chart.grid(1).stroke(colorAxisMinor);
48
chart.yAxis().title().enabled(false);
49
chart.xAxis().title().enabled(false);
50
chart.xAxis().stroke(colorAxis);
51
chart.xAxis().ticks().stroke(colorAxisMinor);
52
chart.xAxis().labels().fontColor(colorAxisLabels);
53
chart.yAxis().minorTicks().stroke(colorAxisMinor);
54
chart.yAxis().stroke(colorAxis);
55
chart.yAxis().ticks().stroke(colorAxis);
56
chart.yAxis().labels().fontColor(colorAxisLabels);
57
58
chart.grid().stroke(colorAxis).oddFill(null).evenFill(null).zIndex(10.1);
59
chart.minorGrid().stroke(colorAxisMinor).zIndex(10);
60
chart.grid().drawLastLine(false);
61
62
//set series default error value
63
series.error(8);
64
series.error().valueErrorStroke('1px #474747');
65
66
//initiate chart drawing
67
chart.draw();
68
});