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 教程</title> <script src = "https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script> <script src = "https://code.highcharts.com/highcharts.js"></script> <script src = "https://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>
以上图表实例的输出结果
❮ highcharts_bubble_charts.html