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
var chart = anychart.bubble();
3
chart.yScale({minimum: 0, maximum: 4});
4
5
var series = chart.bubble([
6
{x: 1, value: 1, size: 6},
7
{x: 2, value: 2, size: 4},
8
{x: 3, value: 3, size: 6},
9
{x: 4, value: 2, size: 2},
10
{x: 5, value: 1, size: 7},
11
{x: 6, value: 2, size: 3},
12
{x: 7, value: 1, size: 2}
13
]);
14
15
var seriesTooltip = series.tooltip();
16
17
seriesTooltip.format(function () {
18
var bubbleSeries = this.series;
19
var index = this.index;
20
var point = bubbleSeries.getPoint(index);
21
22
// Get statistics.
23
return 'Bubble size: ' + point.getStat('bubbleSize');
24
});
25
26
chart.title('Get the statistic and use the tooltip');
27
chart.container('container');
28
chart.draw();
29
});