<template>
<div class="map">
<div id="map" ref="chart1" style="width:777px;height:527px"></div>
</div>
</template>
<script>
import * as echarts from 'echarts'
import 'echarts/map/js/china'
export default {
data() {
return {
myChart: ''
}
},
mounted() {
this.demo()
},
methods: {
demo() {
const myChart = echarts.init(document.getElementById('map'))
const option = {
title: {
text: 'vue实现疫情地图',
textStyle: {
color: '#9c0505',
fontWeight: 'bolder',
fontSize: '25'
},
left: 'center'
},
tooltip: {
trigger: 'item',
formatter: '地区:{b}<br/>确诊:{c}'
},
series: [
{
type: 'map',
map: 'china',
label: {
show: true,
color: 'red',
fontSize: 12
},
zoom: 1,
emphasis: {
label: {
color: '#fff',
fontSize: 12
},
itemStyle: {
areaColor: 'green'
}
}
}
],
visualMap: {
type: 'piecewise',
show: true,
pieces: [
{ min: 10000 },
{ min: 1000, max: 9999 },
{ min: 100, max: 999 },
{ min: 10, max: 99 },
{ min: 1, max: 9 },
{ value: 0 }
],
inRange: {
color: ['red', 'red', 'red']
},
itemWidth: 10,
itemHeight: 10
}
}
myChart.setOption(option)
}
}
}
</script>
<style>
</style>
【Echarts】关于关闭点击地图时显示黄色的方法
参考次地址
|