# Highcharts 气泡图
本章节我们将为大家介绍 Highcharts 的气泡图。
我们在前面的章节已经了解了 Highcharts 配置语法。接下来让我们来看下 Highcharts 的其他配置。
## 配置
### chart 配置
配置 chart 的 type 为 'bubble' 。chart.type 描述了图表类型。默认值为 "line"。
chart.zoomType 属性可配置图表放大 ,通过拖动鼠标进行缩放,沿x轴或y轴进行缩放,可以设置为:'x','y','xy'。
```
var chart = {
type: 'bubble',
zoomType: 'xy'
};
```
### 实例
文件名:highcharts_bubble_basic.htm
```
<html>
<head>
<title>Highcharts 教程 | 菜鸟教程(runoob.com)</title>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="/try/demo_source/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-more.js"></script>
</head>
<body>
<div id="container" style="width: 550px; height: 400px; margin: 0 auto"></div>
<script language="JavaScript">
$(document).ready(function() {
var chart = {
type: 'bubble',
zoomType: 'xy'
};
var title = {
text: 'Highcharts Bubbles'
};
var series= [{
data: [[97, 36, 79], [94, 74, 60], [68, 76, 58], [64, 87, 56], [68, 27, 73], [74, 99, 42], [7, 93, 87], [51, 69, 40], [38, 23, 33], [57, 86, 31]]
}, {
data: [[25, 10, 87], [2, 75, 59], [11, 54, 8], [86, 55, 93], [5, 3, 58], [90, 63, 44], [91, 33, 17], [97, 3, 56], [15, 67, 48], [54, 25, 81]]
}, {
data: [[47, 47, 21], [20, 12, 4], [6, 76, 91], [38, 30, 60], [57, 98, 64], [61, 17, 80], [83, 60, 13], [67, 78, 75], [64, 12, 10], [30, 77, 82]]
}
];
var json = {};
json.chart = chart;
json.title = title;
json.series = series;
$('#container').highcharts(json);
});
</script>
</body>
</html>
```
以上实例输出结果为:
![](https://box.kancloud.cn/2015-12-29_5682517cb96a5.png)
## 3D 气泡图
### series.marker
设置 series.marker 渐变让其看起来有 3D 的效果。
```
marker: {
fillColor: {
radialGradient: { cx: 0.4, cy: 0.3, r: 0.7 },
stops: [
[0, 'rgba(255,255,255,0.5)'],
[1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0.5).get('rgba')]
]
}
}
```
### 实例
文件名:highcharts_bubble_3d.htm
```
<html>
<head>
<title>Highcharts 教程 | 菜鸟教程(runoob.com)</title>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="/try/demo_source/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-more.js"></script>
</head>
<body>
<div id="container" style="width: 550px; height: 400px; margin: 0 auto"></div>
<script language="JavaScript">
$(document).ready(function() {
var chart = {
type: 'bubble',
plotBorderWidth: 1,
zoomType: 'xy'
};
var title = {
text: 'Highcharts bubbles with radial gradient fill'
};
var xAxis = {
gridLineWidth: 1
};
var yAxis = {
startOnTick: false,
endOnTick: false
};
var series= [{
data: [
[9, 81, 63],
[98, 5, 89],
[51, 50, 73],
[41, 22, 14],
[58, 24, 20],
[78, 37, 34],
[55, 56, 53],
[18, 45, 70],
[42, 44, 28],
[3, 52, 59],
[31, 18, 97],
[79, 91, 63],
[93, 23, 23],
[44, 83, 22]
],
marker: {
fillColor: {
radialGradient: { cx: 0.4, cy: 0.3, r: 0.7 },
stops: [
[0, 'rgba(255,255,255,0.5)'],
[1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0.5).get('rgba')]
]
}
}
}, {
data: [
[42, 38, 20],
[6, 18, 1],
[1, 93, 55],
[57, 2, 90],
[80, 76, 22],
[11, 74, 96],
[88, 56, 10],
[30, 47, 49],
[57, 62, 98],
[4, 16, 16],
[46, 10, 11],
[22, 87, 89],
[57, 91, 82],
[45, 15, 98]
],
marker: {
fillColor: {
radialGradient: { cx: 0.4, cy: 0.3, r: 0.7 },
stops: [
[0, 'rgba(255,255,255,0.5)'],
[1, Highcharts.Color(Highcharts.getOptions().colors[1]).setOpacity(0.5).get('rgba')]
]
}
}
}
];
var json = {};
json.chart = chart;
json.title = title;
json.xAxis = xAxis;
json.yAxis = yAxis;
json.series = series;
$('#container').highcharts(json);
});
</script>
</body>
</html>
```
以上实例输出结果为:
![](https://box.kancloud.cn/2015-12-29_5682517cccec9.png)
- Highcharts 简介
- Highcharts 环境配置
- Highcharts 配置语法
- Highcharts 配置选项详细说明
- Highcharts 曲线图
- Highcharts 基本曲线图
- Highcharts 带有数据标签曲线图表
- Highcharts 异步加载数据曲线图表
- Highcharts 时间序列,可缩放的图表
- Highcharts X 轴翻转曲线图
- Highcharts 带标记曲线图
- Highcharts 标示区曲线图
- Highcharts 时间间隔图表
- Highcharts 对数图表
- Highcharts 区域图
- Highcharts 基本区域图
- Highcharts 使用负数区域图
- Highcharts 堆叠区域图
- Highcharts 百分比堆叠区域图
- Highcharts 丢失值区域图
- Highcharts 反转x轴与y轴
- Highcharts 曲线区域图
- Highcharts 区间区域图
- Highcharts 使用区间和线的区域图
- Highcharts 条形图
- Highcharts 基本条形图
- Highcharts 堆叠条形图
- Highcharts 反向条形图
- Highcharts 柱形图
- Highcharts 基本柱形图
- Highcharts 使用负值的反向柱形图
- Highcharts 堆叠柱形图
- Highcharts 堆叠组柱形图
- Highcharts 使用百分比的堆叠柱形图
- Highcharts 标签旋转柱形图
- Highcharts 堆叠组柱形图
- Highcharts 固定布局柱形图
- Highcharts 使用 HTML 表格数据的柱形图
- Highcharts 区间柱形图
- Highcharts 饼图
- Highcharts 基本饼图
- Highcharts 显示图例饼图
- Highcharts 圆环图
- Highcharts 半圈圆环图
- Highcharts 向下钻取饼图
- Highcharts 渐变饼图
- Highcharts 单色饼图
- Highcharts 散点图
- Highcharts 气泡图
- Highcharts 动态图
- Highcharts 组合图
- Highcharts 柱形图,线条图,饼图组合
- Highcharts 双Y轴, 柱形图,线条图组合
- Highcharts 多Y轴组合
- Highcharts 散点图上添加回归线
- Highcharts 3D图
- Highcharts 3D柱形图
- Highcharts 带空值(null)和0的3D柱形图
- Highcharts 堆叠3D柱形图
- Highcharts 3D饼图
- Highcharts 3D圆环图
- Highcharts 测量图
- Highcharts 测量图
- Highcharts 圆形进度条式测量图
- Highcharts 时钟
- Highcharts 双轴车速表
- Highcharts 音量表(VU Meter)
- Highcharts 树状图(Treemap)