echarts地图阴影效果

效果图:

主要代码:

option.geo.itemStyle: { 

            normal: {

                areaColor: '#0e1c47',

                borderWidth: 1,//设置外层边框

                

                borderColor:'#1e9ce7',

                //shadowColor: '#fff',

                shadowColor: '#ccc',

                    shadowBlur: 15,

                opacity:0.8

            }

        }

完整代码:

const sactterMapOpt = {

title: {

text: '',

x: 'center',

textStyle: {

color: '#fff'

}

},

legend: {

data: ['warning'], //与series的name属性对应

        orient: 'vertical',

        y: 'bottom',

        x: 'right',

        textStyle: {

            color: '#fff'

        }

    },

/* tooltip: {

        trigger: 'item',

        backgroundColor:'rgba(255,255,255,0.3)',

        padding:[10, 20],

        textStyle:{

        color:'#fff',

        fontSize:18,

        lineHeight:'30px'

        },

        position: function (point, params, dom, rect, size) {

      return [point[0]+10, point[1]-dom.offsetHeight -10];

  },

        formatter: function(params) {

        var res = '<center>栏目<center>'

            res+=params.name + ' : ' + params.value[2] + '&nbsp;台';

            return res;

        }

    }, */

    visualMap: {

        min: 0,

        max: 200,

        calculable: false,

        inRange: {

            color: ['#50a3ba', '#eac736', '#d94e5d']

        },

        textStyle: {

            color: '#fff'

        }

    },

    geo: {

        show: true,

        map: 'china',

        label: {

            normal: {

                show: false

            },

            emphasis: {

                show: false,

            }

        },

        roam: false,

        itemStyle: {

            normal: {

                areaColor: '#0e1c47',

                borderWidth: 1,//设置外层边框

                

                borderColor:'#1e9ce7',

                //shadowColor: '#fff',

                shadowColor: '#ccc',

                    shadowBlur: 15,

                opacity:0.8

            }

        }

    },

    series: [{

            name: 'PM2.5',

            type: 'scatter',

            coordinateSystem: 'geo',

            symbolSize: 12,

            label: {

                normal: {

                    show: false

                },

                emphasis: {

                    show: false

                }

            },

            itemStyle: {

                emphasis: {

                areaColor: '#0e1c47',

                    borderColor: '#1e9ce7',

                    borderWidth: 1

                }

            },

            data: convertScatterData(scatterVal)

        },

        {

            type: 'map',

            map: 'china',

            geoIndex: 1,

            aspectScale: 0.75, //长宽比

            showLegendSymbol: false, // 存在legend时显示

            label: {

                normal: {

                    show: false,

                },

                emphasis: {

                    show: false,

                    textStyle: {

                        color: '#fff'

                    }

                }

            },

            roam: false,

            itemStyle: {

                normal: {

                    areaColor: '#0e1c47',

                    borderColor: '#1e9ce7',

                    borderWidth: 1,

                    //shadowColor: '#ccc',

                    //shadowBlur: 15

                },

                emphasis: {

                    areaColor: '#01215c'

                }

            },

        }

        ]

};

  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
根据引用中的信息,可以使用echarts来给地图增阴影和立体感。在echarts的配置项中,可以通过设置itemStyle的normal属性来实现。具体代码如下: itemStyle: { normal: { areaColor: { color: { type: 'linear', x: 0, y: 0, x2: 1, y2: 1, colorStops: [ { offset: 0, color: '#24a0fa' }, { offset: 1, color: '#15072a' } ], global: false }, borderColor: '#a18a3a', borderWidth: 1 }, emphasis: { show: false, areaColor: null } } } 可以看到,通过设置areaColor的type为'linear',可以使用线性渐变来填充地图区域的颜色,从而增立体感。另外,还可以设置borderColor和borderWidth来增边界的颜色和宽度。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [echarts中国地图实现阴影效果&自定义设置](https://blog.csdn.net/weixin_44314609/article/details/122981704)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [echarts 设置地图外边框、地图背景渐变色和地图阴影,增立体感以及在地图上打点](https://blog.csdn.net/qq_36437172/article/details/106099547)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Mr.T's Blog

感谢打赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值