bubble(气泡)
配置项如下
option = {
backgroundColor:'#1B2D3B',
title: {
text: '气泡图',
//subtext:'副标题',
right:'center',
top:'1%',
textStyle: {
color: '#fff'
}
},
legend: {
right: 10,
data: ['1990', '2018'],
textStyle: {
color: '#fff'
}
},
color: ['#39E7FB','#FAC901'],
xAxis: {
data: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
splitLine: {
show: false
},
axisLine: {
lineStyle: {
color: '#eee'
}
}
},
yAxis: {
splitLine: {
show: false
},
axisLine: {
lineStyle: {
color: '#eee'
}
}
},
series: [{
type: 'scatter',
name:'1990',
symbol: 'circle',//设置形状,可圆,可方等等'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'
symbolSize: function (data) {
return Math.sqrt(data[1]) * 2;
},//设置气泡的大小,根据自己需要,这里是取平方根再乘2
//鼠标移到气泡上面的时候,显示formatter: function (param)的返回值
label: {
emphasis: {
show: true,
formatter: function (param) {
return param.data[0]+"\n"+param.data[1];
},
position: 'top'
}
},
data:[
['Sun',50],
['Mon',210],
['Tue',90],
['Wed',234],
['Thu',100],
['Fri',330],
['Sat',400]
]
},
{
type: 'scatter',
name:'2018',
symbol: 'circle',//'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'
symbolSize: function (data) {
return Math.sqrt(data[1]) * 2;
},
label: {
emphasis: {
show: true,
formatter: function (param) {
return param.data[0]+"\n"+param.data[1];
},
position: 'top'
}
},
data:[
['Sun',100],
['Mon',310],
['Tue',190],
['Wed',334],
['Thu',200],
['Fri',430],
['Sat',500]
]
},
]
};