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 data
4
var data = [
5
{x: 0.5, value: 105},
6
{x: 1, value: 109},
7
{x: 2.4, value: 133},
8
{x: 2.9, value: 116},
9
{x: 2.4, value: 119},
10
{x: 4.6, value: 115},
11
{x: 4.1, value: 117},
12
{x: 3.9, value: 125},
13
{x: 5, value: 128}
14
];
15
16
// create a chart
17
var 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
var error = series.error();
24
error.valueLowerError(7);
25
error.valueUpperError(4);
26
error.xLowerError(0.1);
27
error.xUpperError(0.2);
28
29
// enable major grids
30
chart.xGrid(true);
31
chart.yGrid(true);
32
33
// enable minor grids
34
chart.xMinorGrid(true);
35
chart.yMinorGrid(true);
36
37
// set the chart title
38
chart.title("Scatter Plot: Error Bars");
39
40
// set the container id
41
chart.container("container");
42
43
// initiate drawing the chart
44
chart.draw();
45
});