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
// enable major grids
23
chart.xGrid(true);
24
chart.yGrid(true);
25
26
// configure the visual settings of major grids
27
chart.xGrid().stroke({color: "#85adad", thickness: 0.7});
28
chart.yGrid().stroke({color: "#85adad", thickness: 0.7});
29
30
// enable minor grids
31
chart.xMinorGrid(true);
32
chart.yMinorGrid(true);
33
34
// configure the visual settings of minor grids
35
chart.xMinorGrid().stroke({color: "#85adad", thickness: 0.3, dash: 5});
36
chart.yMinorGrid().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
});