'
+ schema[1].text + ':' + value[1] + '
'
+ schema[2].text + ':' + value[0] + '
';
}
},
xAxis: {
type: 'value',
name: '单位污染物\n(吨/万元)',
nameGap: 16,
nameTextStyle: {
//color: '#fff',
fontSize: 14
},
min: 0,
//max: 31,
splitLine: {
lineStyle: {
color: ['#ccc'],
type: 'dashed'
}
},
axisLine: {
lineStyle: {
color: '#777'
}
},
axisTick: {
lineStyle: {
color: '#777'
}
},
axisLabel: {
formatter: '{value}',
textStyle: {
//color: '#fff'
}
}
},
yAxis: {
type: 'value',
name: 'GDP(亿元)',
nameLocation: 'end',
nameGap: 20,
scale: true,
nameTextStyle: {
//color: '#fff',
fontSize: 16
},
min: 0,
axisLine: {
lineStyle: {
color: '#777'
}
},
axisTick: {
lineStyle: {
color: '#777'
}
},
splitLine: {
lineStyle: {
color: ['#ccc'],
type: 'dashed'
}
},
axisLabel: {
textStyle: {
//color: '#fff'
}
}
},
visualMap: [
{
left: 'right',
top: '10%',
dimension: 2,
min: 0,
max: 250,
itemWidth: 30,
itemHeight: 120,
calculable: true,
precision: 0.1,
text: ['圆形大小:项目个数'],
textGap: 30,
textStyle: {
//color: '#fff'
},
inRange: {
symbolSize: [10, 70]
},
outOfRange: {
symbolSize: [10, 70],
//color: ['rgba(255,255,255,.2)']
},
controller: {
inRange: {
//color: ['#c23531']
},
outOfRange: {
//color: ['#444']
}
}
},
{
left: 'right',
bottom: '10%',
dimension: 1,
min: 0,
max: 50,
itemHeight: 120,
calculable: true,
precision: 0.1,
text: ['明暗:GDP'],
textGap: 30,
textStyle: {
//color: '#fff'
},
inRange: {
colorLightness: [1, 0.5]
},
outOfRange: {
//color: ['rgba(255,255,255,.2)']
},
controller: {
inRange: {
//color: ['#c23531']
},
outOfRange: {
//color: ['#444']
}
}
}
],
series: [
{
name: '2015',
type: 'scatter',
data: data1,
symbolSize: function (data) {
return Math.sqrt(data[2]) / 5e2;
},
label: {
emphasis: {
show: true,
formatter: function (param) {
return param.data[3];
},
position: 'top'
}
},
itemStyle: {
normal: {
shadowBlur: 10,
shadowColor: 'rgba(25, 100, 150, 0.5)',
shadowOffsetY: 5,
/*color: new echarts.graphic.RadialGradient(0.4, 0.3, 1, [{
offset: 0,
color: 'rgb(129, 227, 238)'
}, {
offset: 1,
color: 'rgb(25, 183, 207)'
}])*/
}
}
},
{
name: '2016',
type: 'scatter',
data: data2,
symbolSize: function (data) {
return Math.sqrt(data[2]) / 5e2;
},
label: {
emphasis: {
show: true,
formatter: function (param) {
return param.data[3];
},
position: 'top'
}
},
itemStyle: {
normal: {
shadowBlur: 10,
shadowColor: 'rgba(120, 36, 50, 0.5)',
shadowOffsetY: 5,
/*color: new echarts.graphic.RadialGradient(0.4, 0.3, 1, [{
offset: 0,
color: 'rgb(251, 118, 123)'
}, {
offset: 1,
color: 'rgb(204, 46, 72)'
}])*/
}
}
}
]
};
myChart.clear();
setTimeout(function () {
// $(myChart.getDom()).css('background', 'radial-gradient(circle at 50% 0, #475b7a 0%, #3c4656 100%)');
var zr = myChart.getZr();
myChart.off('click');
myChart.on('click', function (param) {
var seriesModel = myChart.getModel().getSeriesByIndex(param.seriesIndex);
var data = seriesModel.getData();
var coordSys = seriesModel.coordinateSystem;
var color = data.getItemVisual(param.dataIndex, 'color');
var symbolSize = data.getItemVisual(param.dataIndex, 'symbolSize');
var pt1 = coordSys.dataToPoint(param.value);
var pt2 = coordSys.dataToPoint([param.value[0], 0]);
var line = new echarts.graphic.Line({
shape: {
x1: pt1[0],
y1: pt1[1],
x2: pt1[0],
y2: pt1[1]
},
style: {
stroke: color,
opacity: 0.6
},
z: 100
});
line.animate('shape')
.when(300, {
y1: pt1[1]
})
.when(500, {
y1: pt1[1] * 0.7 + 0.3 * pt2[1],
y2: pt2[1]
})
.when(1000, {
y1: pt1[1],
y2: pt1[1]
})
.done(function () {
zr.remove(line);
})
.start(function (t) {
var y = Math.sin(t * Math.PI) * 0.5;
if (t >= 0.5) {
y = 1 - y;
}
return y;
});
var circle = new echarts.graphic.Circle({
shape: {
cx: pt2[0],
cy: pt2[1],
r: 0
},
style: {
fill: color
},
z: 100
});
var circle2 = new echarts.graphic.Circle({
shape: {
cx: pt1[0],
cy: pt1[1],
r: symbolSize
},
style: {
fill: color,
opacity: 0.4
}
});
circle2.animateTo({
shape: {
r: symbolSize * 1.5
},
style: {
opacity: 0
}
}, 400, function () {
zr.remove(circle2);
})
circle.animate('shape')
.when(250, {
r: 6
})
.when(500, {
r: 0
})
.delay(500)
.done(function () {
zr.remove(circle);
})
.start(function (t) {
var y = Math.sin(t * Math.PI) * 0.5;
if (t >= 0.5) {
y = 1 - y;
}
return y;
});
zr.add(circle);
zr.add(circle2);
zr.add(line);
});
});