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 for the first series
4
var data_1 = [
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 data for the second series
17
var data_2 = [
18
{x: 0.5, value: 17.5},
19
{x: 4.75, value: 100}
20
];
21
22
// create a chart
23
var chart = anychart.scatter();
24
25
// create the first series (marker) and set the data
26
var series1 = chart.marker(data_1);
27
28
// create the second series (line) and set the data
29
var series2 = chart.line(data_2);
30
31
// enable major grids
32
chart.xGrid(true);
33
chart.yGrid(true);
34
35
// enable minor grids
36
chart.xMinorGrid(true);
37
chart.yMinorGrid(true);
38
39
// set the chart title
40
chart.title("Scatter Plot: Basic Sample");
41
42
// set the container id
43
chart.container("container");
44
45
// initiate drawing the chart
46
chart.draw();
47
});