02. 数据单元个数不同的多组系列


示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>气泡图 - 数据单元个数不同的多组系列</title>
</head>

<body>
<div id='C2' style='position:relative; width: 600px; height:300px; '></div>

<script src='../dist/bubble.js'></script>
<script>

createChart('C2');

function createChart(divID)
{
//1. 生成图表对象
let chart = new T.bubble.Chart(divID);

//2. 停止图表绘制
chart.stop() ;

//3. 准备数据
let series1 = new T.bubble.Series();
series1.name = '2015';
series1.data = [[44056,81.8,23968973,'Australia',2015],[43294,81.7,35939927,'Canada',2015],
[13334,76.9,1376048943,'China',2015],[21291,78.5,11389562,'Cuba',2015],
[38923,80.8,5503457,'Finland',2015],[37599,81.9,64395345,'France',2015],
[44053,81.1,80688545,'Germany',2015],[42182,82.8,329425,'Iceland',2015],
[5903,66.8,1311050527,'India',2015],[36162,83.5,126573481,'Japan',2015],
[1390,71.4,25155317,'North Korea',2015],[34644,80.7,50293439,'South Korea',2015],
[34186,80.6,4528526,'New Zealand',2015],[64304,81.6,5210967,'Norway',2015],
[24787,77.3,38611794,'Poland',2015],[23038,73.13,143456918,'Russia',2015],
[19360,76.5,78665830,'Turkey',2015],[38225,81.4,64715810,'United Kingdom',2015],
[53354,79.1,321773631,'United States',2015]] ;

let series2 = new T.bubble.Series();
series2.name = '1990';
series2.data = [[28604,77,17096869,'Australia',1990]] ;

//4. 设置图表信息
let chartInfo_In = chart.chartInfo_In ;
chartInfo_In.title = '气泡图';
chartInfo_In.xAxisName = '(GDP)';
chartInfo_In.yAxisName = '(年龄)';
chartInfo_In.schema = ['GDP','年龄','人口'] ;
chartInfo_In.zeroExtend = false ;
chartInfo_In.series = [series1,series2];

//5. 开始图表绘制
chart.start();
}
</script>

</body>
</html>