<template><div class="map" id="s-map"><div id="chartMap" :style="{height:height,width:width}"></div></div>
</template><script type="text/ecmascript-6">   // 在之前已经单独引入了echarts文件   // 在此只需引入需要的地区的json文件import echarts from "echarts";import gz from 'echarts/map/json/province/guizhou'import lianxi from '@/map/jiujiang.json'export default {components: {},data () {return {font: '12'}},props: {width: {type: String,default: '1000px'},height: {type: String,default: '500px'},nationCode: {type: String,default: '100000'},nationName: {type: String,default: '中华人民共和国'},},watch: {},data(){return{mapDatabase:{}}},created(){},mounted(){this.drawmap()},methods: {drawmap() {// if (condition) {// }console.log(this.nationCode)this.$axios.get("nation/getJson/" + this.nationCode).then(res => {var data = res.data.data.data;this.mapDatabase = JSON.parse(data)let chartMap = document.getElementById('chartMap');let smap = document.getElementById('s-map');          var resizeWorldMapContainer = function () {chartMap.style.width  = smap.clientWidth +'px';chartMap.style.height = smap.clientHeight + 'px';};resizeWorldMapContainer();// 注册可用的地图echarts.registerMap('dataSource',JSON.parse(data));// echarts.registerMap('guizhou',lianxi);let myChart = echarts.init(chartMap);myChart.setOption({title : {text: this.nationName,subtext: '火灾数量区域图',x:'left'},tooltip: {trigger: 'item',formatter: '{b}<br/>{c} (p / km2)'},roam: false,dataRange: {show:true,x: 'right',y: 'bottom',splitList: [{start: 1500},{start: 900, end: 1500},{start: 310, end: 1000},{start: 200, end: 300},{start: 10, end: 200, label: '10 到 200(火灾数量)'},{start: 5, end: 5, label: '5(火灾数量)', color: 'black'},{end: 10}],color: ['#eee', '#949fb1', '#f3ce85']},// tooltip : {//     trigger: 'item',//     formatter: '{b}',//     itemSize:'14px'// },legend: {orient: 'vertical',x:'center'},series: [{name: '',type: 'map',map: 'dataSource',mapType: 'maptype',roam: true,zoom: 0.6,itemStyle:{normal:{// areaColor: 'rgba(128, 128, 128, 0.01)',// borderWidth:1,// borderColor:'#999999',   label:{show:true,textStyle: {color: '#2991BE',fontSize: this.font}},},emphasis:{// areaColor: '#000',// borderWidth:1,// borderColor:'#999999',   label:{show:true,textStyle: {color: '#398def',fontSize: this.font}}}},data:[{name: '城口县',value: Math.round(Math.random()*2000)},{name: '开县',value: Math.round(Math.random()*2000)},{name: '巫溪县',value: Math.round(Math.random()*2000)},{name: '云阳县',value: Math.round(Math.random()*2000)},{name: '奉节县',value: Math.round(Math.random()*2000)},{name: '巫山县',value: Math.round(Math.random()*2000)},{name: '万州区',value: Math.round(Math.random()*2000)},{name: '梁平县',value: Math.round(Math.random()*2000)},{name: '忠县',value: Math.round(Math.random()*2000)},{name: '垫江县',value: Math.round(Math.random()*2000)},{name: '石柱土家族自治县',value: Math.round(Math.random()*2000)},{name: '丰都县',value: Math.round(Math.random()*2000)},{name: '长寿区',value: Math.round(Math.random()*2000)},{name: '涪陵区',value: Math.round(Math.random()*2000)},{name: '合川区',value: Math.round(Math.random()*2000)},{name: '潼南县',value: Math.round(Math.random()*2000)},{name: '铜梁县',value: Math.round(Math.random()*2000)},{name: '渝北区',value: Math.round(Math.random()*2000)},{name: '璧山县',value: Math.round(Math.random()*2000)},{name: '沙坪坝县',value: Math.round(Math.random()*2000)},{name: '江北区',value: Math.round(Math.random()*2000)},{name: '大足县',value: Math.round(Math.random()*2000)},{name: '永川区',value: Math.round(Math.random()*2000)},{name: '綦江县',value: Math.round(Math.random()*2000)},{name: '南川区',value: Math.round(Math.random()*2000)},{name: '万盛区',value: Math.round(Math.random()*2000)},{name: '大渡口区',value: Math.round(Math.random()*2000)},{name: '南岸区',value: Math.round(Math.random()*2000)},{name: '武隆县',value: Math.round(Math.random()*2000)},{name: '九龙坡区',value: Math.round(Math.random()*2000)},{name: '荣昌县',value: Math.round(Math.random()*2000)},{name: '秀山土家族苗族自治县',value: Math.round(Math.random()*2000)},{name: '酉阳土家族苗族自治县',value: Math.round(Math.random()*2000)},{name: '彭水苗族土家族自治县',value: Math.round(Math.random()*2000)},{name: '江津区',value: Math.round(Math.random()*2000)},{name: '北碚区',value: Math.round(Math.random()*2000)},{name: '巴南区',value: Math.round(Math.random()*2000)}]}]});});window.addEventListener("resize", function(){// resizeWorldMapContainer();// myChart.resize();})}},filters: {},computed: {},destroyed () {}}
</script><style lang="scss" scoped>@function px2rem($px) {$rem: 75px;@return ($px / $rem) + rem;}
</style>

echarts Map(地图) 不同区块显示相关推荐

  1. echaer 地图_echarts Map(地图) 不同颜色区块显示

    echarts Map(地图) 不同区块显示 这里以重庆地图为例 配置项: var option = { title : { text: '重庆市', subtext: '', x:'left' }, ...

  2. echarts map 地图做出立体效果

    echarts map 地图做出立体效果 最近做项目,需要用到立体地图,但是立体地图上还需要很多其他效果,所以用了 map 平面地图 做出了立体效果. 想知道怎么弄的,扣1,欢迎来交流.

  3. echarts map地图数据Json制作教程

    首先来一个echarts map地图使用的教程(对应地图的数据包我的下载里有 echarts地图离线数据包 有需要的可以自行下载或在博客下留言我会单独发你) <!DOCTYPE html> ...

  4. echarts map(地图) 省份名称居中显示

    修改echarts中的china.js文件中省份经纬度,使省份名称居中显示. 亲测可用,更新于2020-12-10 china.js 点击下载 修改前,省份名称并不居中显示: 修改后: 具体修改方法( ...

  5. echarts 5.4 版本 map 地图下钻,显示南沙群岛缩略图,海南三沙市编辑隐藏

    需求:渲染中国地图,支持下钻,同时南沙群岛显示在地图右下脚,三沙市边界隐藏 geoJson 数据可从 阿里云-dataV-下载 如果要展示 南海诸岛需要将地图类型设置为china, 将海南省中的三沙市 ...

  6. echarts map地图geojson/json格式的简单使用

    ** echarts地图简单使用方法 (geojson格式/json格式) ** 首先贴两个非常有用的地图网站 地图下载网站:http://datav.aliyun.com/tools/atlas/# ...

  7. echarts map 地图做出立体效果 | 简单的解

    正文 先利用geo做出来十层阴影 ps:注意我的 map 是 "HK" let geoList = []for (let index = 0; index < 10; ind ...

  8. echarts 使用案例:针对map地图中显示数据格式化

    前言: 1,报表连接:http://gallery.echartsjs.com/editor.html?c=xrJZ60TVIg 2,echats 制作报表中,使用地图的展示样式,发现地图上的显示数据 ...

  9. ECharts地图进去直接显示数字和颜色问题

    上个月刚交付一个项目,最近没什么事,所以准备学学echarts,比较现在做图表什么的这个几乎是不二选择了. 然后一个朋友用echarts做地图方面的项目遇到一问题,让我解决下,顺手就记录下来了,也为方 ...

最新文章

  1. Oracle Varchar2 字段转成Clob字段
  2. 针对$_SERVER[’PHP_SELF’]的跨站脚本攻击(XSS)
  3. Python中的除法 整除 非整除
  4. 大佬终于把鸿蒙OS讲明白了,收藏了!
  5. php模板如何使用,ThinkPHP如何使用模板
  6. [vue-cli]vue-cli怎么解决跨域的问题?
  7. 6-7Pytorch搭建cifar10训练脚本(下)
  8. Spring : 缓存相关注解@EnableCaching、@CacheConfig、@Cacheable、@Caching
  9. 具体问题具体分析 之 QA票
  10. MATLAB基本运算
  11. eclipse左边工程列表不见了,怎么调出来
  12. XcodeGhost作者声明:源于实验,无任何威胁
  13. MFC实战篇——分页功能
  14. 页面加载时就请求ajax,页面加载时发送Ajax请求
  15. 机器学习常见算法思想的面试宝典
  16. android 中打电话,Android 在 APP 中实现拨打电话的方法
  17. 雅思作文模板.html,雅思写作小作文模版:柱状图
  18. 转:我收到一份《中国焦虑图鉴》
  19. 【千里之行,始于足下】大数据高频面试题——数据仓库篇(一)
  20. html中新闻标题字数的限制,微博再无140字数限制 2月28号全面开放

热门文章

  1. PAT JAVA 乙 1020 吃月饼
  2. Java jar包解压
  3. 不较真的生活跟咸鱼有什么区别
  4. linux 下的软件的安装与卸载
  5. 1080P和720P电影的分辨率到底是多少
  6. 一键批量创建招标单、询价单和采购订单
  7. roop 一张图片就能生成换脸视频的开源项目
  8. 【Linux教程】Ubuntu Linux 更换源教程
  9. python学生基础培训班
  10. matlab拟合直线交点,多条直线如何求交点