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.6, value: 22},
6
{x: 1.7, value: 55},
7
{x: 2.3, value: 50},
8
{x: 3.5, value: 80},
9
{x: 3.9, value: 74},
10
{x: 4, value: 68},
11
{x: 4, value: 76},
12
{x: 4.1, value: 84},
13
{x: 4.7, value: 93}
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 major grids and bind them to the X and Y axes
23
chart.grid(0).axis(chart.xAxis());
24
chart.grid(1).axis(chart.yAxis());
25
26
// configure the visual settings of major grids
27
chart.grid(0).stroke({color: "#85adad", thickness: 0.7});
28
chart.grid(1).stroke({color: "#85adad", thickness: 0.7});
29
30
// create minor grids and bind them to the X and Y axes
31
chart.minorGrid(0).axis(chart.xAxis());
32
chart.minorGrid(1).axis(chart.yAxis());
33
34
// configure the visual settings of minor grids
35
chart.minorGrid(0).stroke({color: "#85adad", thickness: 0.3, dash: 5});
36
chart.minorGrid(1).stroke({color: "#85adad", thickness: 0.3, dash: 5});
37
38
// set the chart title
39
chart.title("Scatter Plot: Grids");
40
41
// set the container id
42
chart.container("container");
43
44
// initiate drawing the chart
45
chart.draw();
46
});