博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
echarts map地图设置外边框或者阴影
阅读量:6870 次
发布时间:2019-06-26

本文共 3181 字,大约阅读时间需要 10 分钟。

最近要实现一个地图的效果,地图外有个外边框,配置项无此配置,在网上看到的效果,还需要积分下载,顿时感觉很不好,互联网之所以发展到如此,个人感觉是因为 "分享" 。找不到就自己实现咯。

换个思路实现起来也很简单,比如设计图是这个样子:

clipboard.png

你觉得边框不好实现,但是你会不会实现下面两种样子

clipboard.png

clipboard.png

如果你说你都会,那么问题就解决了,两个重叠一下就是你想要的效果(center,aspectScale和zoom需要一样),附上关键代码:

geo: {              map: 'china',              center: [112.194115019531, 23.582111640625],              zoom: 12,              aspectScale: 1, //长宽比              label: {                normal: {                  show: true,                  textStyle: {                    fontSize: 16,                    color: '#ccc'                    }                  },                emphasis: {                  show: false,                  textStyle: {                    color: '#ccc'                  }                }                },              roam: false,              itemStyle: {                normal: {                  borderColor: "#fff",                  borderWidth: 5,                  areaColor: '#272235',                  fontWeightL: 700,                /*  shadowBlur:20,                  shadowColor: '#fff',*/                },                emphasis: {                  areaColor: {                    type: 'linear',                    x: 0,                    y: 0,                    x2: 0,                    y2: 1,                    colorStops: [{                      offset: 0, color: '#3f15d6' // 0% 处的颜色                    }, {                      offset: 1, color: '#d243cd' // 100% 处的颜色                    }],                    globalCoord: false // 缺省为 false                  }                }              }            },            series: [              {                type: 'map',                map: 'china',                center: [112.194115019531, 23.582111640625],                zoom: 12,                geoIndex: 1,                aspectScale: 1, //长宽比                showLegendSymbol: false, // 存在legend时显示                label: {                  normal: {                    show: true,                    textStyle: {                      fontSize: 16,                      color: '#ccc'                    }                  },                  emphasis: {                    show: false,                    textStyle: {                      color: '#ccc'                    }                  }                },                roam: false,                itemStyle: {                  normal: {                    areaColor: '#272235',                    borderColor: '#fff',                    fontWeightL: 700,                    borderWidth: 1                  },                  emphasis: {                    areaColor: {                      type: 'linear',                      x: 0,                      y: 0,                      x2: 0,                      y2: 1,                      colorStops: [{                        offset: 0, color: '#3f15d6' // 0% 处的颜色                      }, {                        offset: 1, color: '#d243cd' // 100% 处的颜色                      }],                      globalCoord: false // 缺省为 false                    }                  }                },                data: []              }              ]

如果想实现阴影就把底层map的边框改成阴影

本篇如能对您有所帮助,实在是感到荣幸。如有不合理之处也请大家多多指点

转载地址:http://kmpfl.baihongyu.com/

你可能感兴趣的文章
java中list和arrayList区别
查看>>
nginx安装记录(2015-5-14)
查看>>
oracle 11g 基础实践1
查看>>
Apache CXF之初探
查看>>
运维常用数据库
查看>>
Linux系统中查看系统版本
查看>>
探讨SQL语句技巧 优化DB2应用程序性能
查看>>
互联系网的超速发展:微信营销的崛起
查看>>
第二节:python中文乱码
查看>>
H3C设备之静态缺省路由
查看>>
day-20: 安装软件包及rpm yum的介绍
查看>>
u盘妙用
查看>>
Centos6.4安装Nagios(中文版)
查看>>
Apache2.4.4 + PHP5.4.12 + FastCGI 模式配置
查看>>
学习总结(2016年10月3日 )
查看>>
linux top命令
查看>>
Nagios+OMSA监控dell设备硬件
查看>>
内存数据库的大明星:TimesTen快速入门
查看>>
Cacti监控apache
查看>>
Lost connection to MySQL server at 'reading
查看>>