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: 2.3, value: 50},
6
{x: 2.7, value: 64},
7
{x: 4, value: 71},
8
{x: 4.5, value: 74},
9
{x: 4.9, value: 83}
10
];
11
12
// create a chart
13
var chart = anychart.scatter();
14
15
// create a line series and set the data
16
var series = chart.line(data);
17
18
// create error bars
19
series.error("10%");
20
21
// enable major grids
22
chart.xGrid().enabled(true);
23
chart.yGrid().enabled(true);
24
25
// enable minor grids
26
chart.xMinorGrid().enabled(true);
27
chart.yMinorGrid().enabled(true);
28
29
// set the chart title
30
chart.title("Scatter Line Chart with Error Bars");
31
32
// set the container id
33
chart.container("container");
34
35
// initiate drawing the chart
36
chart.draw();
37
});