【基于Echarts的地图可视化】

html 复制代码
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>中国牛只分布可视化</title>
    <script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
</head>
<body>
    <div id="map" style="width: 100%;height:600px;"></div>
    <script>
        // 异步加载地图数据
        $.get('https://geo.datav.aliyun.com/areas_v3/bound/100000_full.json', function(chinaJson) {
            var chart = echarts.init(document.getElementById('map'));
            echarts.registerMap('china', chinaJson);
            
            // 牛只分布数据
            var cattleData = [
                {name: '内蒙古', value: [111.76, 40.82, 280]},
                {name: '新疆', value: [87.62, 43.82, 190]},
                {name: '黑龙江', value: [126.53, 45.80, 150]},
                {name: '四川', value: [104.06, 30.67, 120]},
                {name: '云南', value: [102.73, 25.04, 90]}
            ];
            
            var option = {
                title: {
                    text: '中国主要牧区牛只分布',
                    subtext: '数据更新时间:2025-06-29',
                    left: 'center'
                },
                tooltip: {
                    trigger: 'item',
                    formatter: function(params) {
                        if(params.seriesType === 'scatter') {
                            return params.name + '<br/>存栏量: ' + params.value[2] + '万头';
                        }
                        return params.name;
                    }
                },
                visualMap: {
                    min: 0,
                    max: 300,
                    text: ['高', '低'],
                    realtime: false,
                    calculable: true,
                    inRange: {
                        color: ['#1e90ff', '#ff4500']
                    }
                },
                geo: {
                    map: 'china',
                    roam: true,
                    label: {
                        show: true,
                        color: '#333',
                        fontSize: 10
                    },
                    emphasis: {
                        label: {
                            color: '#fff'
                        },
                        itemStyle: {
                            areaColor: '#389af4'
                        }
                    },
                    itemStyle: {
                        areaColor: '#e6f7ff',
                        borderColor: '#aaa'
                    }
                },
                series: [{
                    name: '牛只数量',
                    type: 'scatter',
                    coordinateSystem: 'geo',
                    symbolSize: function(val) {
                        return Math.sqrt(val[2]) * 3;
                    },
                    data: cattleData,
                    encode: {
                        value: 2
                    },
                    label: {
                        formatter: '{b}',
                        position: 'right',
                        show: true
                    },
                    itemStyle: {
                        color: '#d63031'
                    }
                }]
            };
            
            chart.setOption(option);
            window.addEventListener('resize', chart.resize);
        });
    </script>
</body>
</html>
相关推荐
行者-全栈开发7 天前
【供应链攻击】CVE-2026-45321:TanStack供应链攻击漏洞深度解析与修复指南
arcgis
思特奇时空智能8 天前
大规模点要素地图渲染性能优化实践
vue.js·arcgis·性能优化·node.js·html·gis·webgl
上海懒图科技15 天前
工厂厂区电子地图定位导航:厂区人车精准定位,安全合规双保障
前端·arcgis·vue
非科班Java出身GISer19 天前
ArcGIS JS 基础教程(48):SceneView watch 状态监听
arcgis·arcgis js基础·arcgis js入门·arcgis js监听状态·arcgis js监听事件·arcgis js 监听飞行·arcgis js 监听功能
JudithHuang21 天前
React 嵌套路由与布局
前端·react.js·arcgis·react·react router
Dxy123931021623 天前
JS DES 加密详解
开发语言·javascript·arcgis
非科班Java出身GISer25 天前
ArcGIS JS 基础教程(46):编辑要素属性 FeatureForm
arcgis·arcgis js编辑要素·arcgis js 要素·arcgis js要素属性·arcgis js 编辑属性·arcgis js编辑要素属性
梅如你1 个月前
ISPRS | 1990-2020年间中国人工林与天然林的空间分布数据
arcgis·gis·遥感
limit00751 个月前
公开 WMTS / XYZ 瓦片接入 Cesium:6 类常见问题与排查顺序
chrome·低代码·arcgis·web3·旅游
limit00751 个月前
三维模型悬空与切片偏移的排查顺序
低代码·3d·arcgis·web3·安卓·webgl