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: 1.3, value: 637, size: 7},
6
{x: 2.5, value: 202, size: 14},
7
{x: 3.2, value: 168, size: 9},
8
{x: 3.9, value: 448, size: 18},
9
{x: 5.1, value: 300, size: 2}
10
];
11
12
// create a chart
13
var chart = anychart.scatter();
14
15
// create a bubble series and set the data
16
var series = chart.bubble(data);
17
18
// create major grids and bind them to the X and Y axes
19
chart.grid(0).axis(chart.xAxis());
20
chart.grid(1).axis(chart.yAxis());
21
22
// create minor grids and bind them to the X and Y axes
23
chart.minorGrid(0).axis(chart.xAxis());
24
chart.minorGrid(1).axis(chart.yAxis());
25
26
// set the chart title
27
chart.title("Scatter Bubble Chart");
28
29
// set the container id
30
chart.container("container");
31
32
// initiate drawing the chart
33
chart.draw();
34
});