静态气泡地图更新

qianming 3 years ago
parent ecd32b37c8
commit 27f8238786

@ -1,6 +1,6 @@
<template> <template>
<div :style="styleObj"> <div :style="styleObj">
<v-chart :options="options" autoresize /> <v-chart :options="options" autoresize/>
</div> </div>
</template> </template>
<script> <script>
@ -47,7 +47,7 @@ var data = [
{ {
name: "南海诸岛", name: "南海诸岛",
value: 1 value: 1
}, },
{ {
name: "北京", name: "北京",
value: 524 value: 524
@ -185,7 +185,7 @@ var data = [
value: 9 value: 9
}, },
]; ];
var convertData = function(data) { var convertData = function (data) {
var res = []; var res = [];
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
var geoCoord = geoCoordMap[data[i].name]; var geoCoord = geoCoordMap[data[i].name];
@ -209,17 +209,17 @@ export default {
value: Object, value: Object,
ispreview: Boolean ispreview: Boolean
}, },
data (){ data() {
return { return {
options : { options: {
//backgroundColor: '#0F1C3C', //backgroundColor: '#0F1C3C',
tooltip: { tooltip: {
show: true, show: true,
formatter: function(params) { formatter: function (params) {
if (params.value.length > 1) { if (params.value.length > 1) {
return '&nbsp;&nbsp;' + params.name + '&nbsp;&nbsp;&nbsp;' + params.value[2] + '&nbsp;&nbsp;'; return '&nbsp;&nbsp;' + params.name + '&nbsp;&nbsp;&nbsp;' + params.value[2] + '&nbsp;&nbsp;';
} else { } else {
return '&nbsp;&nbsp;' + params.name + '&nbsp;&nbsp;&nbsp;' + params.value + '&nbsp;&nbsp;'; return '&nbsp;&nbsp;' + params.name + '&nbsp;&nbsp;&nbsp;' + params.value + '&nbsp;&nbsp;';
} }
}, },
}, },
@ -249,21 +249,26 @@ export default {
} }
} }
}, },
series: [{ series: [
{
type: 'map', type: 'map',
map: 'china', map: 'china',
aspectScale: 0.75, aspectScale: 0.75,
//zoom:1.1,
label: { label: {
normal: { normal: {
show: false, //formatter: '{b}',
position: 'right',
show: true,
color: '#53D9FF',
fontSize: 15
}, },
emphasis: { emphasis: {
show: false, show: true,
} },
}, },
itemStyle: { itemStyle: {
normal: { normal: {
//
areaColor: { areaColor: {
x: 0, x: 0,
y: 0, y: 0,
@ -280,6 +285,7 @@ export default {
borderColor: '#215495', borderColor: '#215495',
borderWidth: 1, borderWidth: 1,
}, },
//
emphasis: { emphasis: {
areaColor: { areaColor: {
x: 0, x: 0,
@ -291,14 +297,15 @@ export default {
color: '#073684' // 0% color: '#073684' // 0%
}, { }, {
offset: 1, offset: 1,
color: '#061E3D' // 100% color: '#2B91B7' // 100%
}], }],
}, },
} }
}, },
data: data, data: data,
}, },
{type: 'effectScatter', {
type: 'effectScatter',
coordinateSystem: 'geo', coordinateSystem: 'geo',
rippleEffect: { rippleEffect: {
brushType: 'stroke' brushType: 'stroke'
@ -306,6 +313,7 @@ export default {
showEffectOn: 'render', showEffectOn: 'render',
itemStyle: { itemStyle: {
normal: { normal: {
//
color: { color: {
type: 'radial', type: 'radial',
x: 0.5, x: 0.5,
@ -331,7 +339,7 @@ export default {
color: '#fff', color: '#fff',
fontWeight: 'bold', fontWeight: 'bold',
position: 'inside', position: 'inside',
formatter: function(para) { formatter: function (para) {
return '{cnNum|' + para.data.value[2] + '}' return '{cnNum|' + para.data.value[2] + '}'
}, },
rich: { rich: {
@ -343,10 +351,11 @@ export default {
}, },
}, },
symbol: 'circle', symbol: 'circle',
symbolSize: function(val) { symbolSize: function (val) {
if (val[2] == 0) { if (val[2] == 0) {
return 0; return 0;
}; }
;
return ((maxSize4Pin - minSize4Pin) / (max - min)) * val[2] + (maxSize4Pin - ((maxSize4Pin - minSize4Pin) / (max - min)) * max) * 1.2; return ((maxSize4Pin - minSize4Pin) / (max - min)) * val[2] + (maxSize4Pin - ((maxSize4Pin - minSize4Pin) / (max - min)) * max) * 1.2;
}, },
data: convertData(data), data: convertData(data),
@ -406,8 +415,8 @@ export default {
}; };
this.options.title = title; this.options.title = title;
}, },
setdata(outname,outvalue){ setdata(outname, outvalue) {
const outdata={} const outdata = {}
for (var i = 0; i < outname.length; i++) { for (var i = 0; i < outname.length; i++) {
outdata.push({ outdata.push({
name: outname[i], name: outname[i],
@ -463,6 +472,7 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.echarts { .echarts {
width: 100%; width: 100%;
height: 100%; height: 100%;

Loading…
Cancel
Save