HTMLcopy
1
<label><input onclick="errorMode('both')" type="radio" name="mode" checked>Both</label>
2
<label><input onclick="errorMode('value')" type="radio" name="mode">Value</label>
3
<label><input onclick="errorMode('x')" type="radio" name="mode">X</label>
4
<label><input onclick="errorMode('none')" type="radio" name="mode">None</label>
5
<div id="container"></div>
CSScopy
16
1
html, body {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
7
label {
8
display: inline-block;
9
margin: 10px 0 0 10px;
10
}
11
#container {
12
position: absolute;
13
width: 100%;
14
top: 35px;
15
bottom: 0;
16
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// create data
4
var data = [
5
[0.6, 22],
6
[1.7, 55],
7
[2.3, 50],
8
[2.6, 76],
9
[2.7, 64],
10
[4, 71],
11
[4, 88],
12
[4.5, 74],
13
[4.9, 83]
14
];
15
16
// create a chart
17
chart = anychart.scatter();
18
19
// create a marker series and set the data
20
var series = chart.marker(data);
21
22
// create and configure error bars
23
error = series.error();
24
error.xLowerError(0.1);
25
error.xUpperError(0.2);
26
error.valueUpperError(5);
27
error.valueLowerError(8);
28
29
// enable major grids
30
chart.xGrid().enabled(true);
31
chart.yGrid().enabled(true);
32
33
// enable minor grids
34
chart.xMinorGrid().enabled(true);
35
chart.yMinorGrid().enabled(true);
36
37
// set the chart title
38
chart.listen("chartDraw", function () {
39
chart.title("Error Chart: Error Mode = " +
40
error.mode());
41
});
42
43
// set the container id
44
chart.container("container");
45
46
// initiate drawing the chart
47
chart.draw();
48
});
49
50
// set the error mode
51
function errorMode(mode) {
52
error.mode(mode);
53
}