【基于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>
相关推荐
Dxy12393102161 天前
JS DES 加密详解
开发语言·javascript·arcgis
非科班Java出身GISer4 天前
ArcGIS JS 基础教程(46):编辑要素属性 FeatureForm
arcgis·arcgis js编辑要素·arcgis js 要素·arcgis js要素属性·arcgis js 编辑属性·arcgis js编辑要素属性
梅如你5 天前
ISPRS | 1990-2020年间中国人工林与天然林的空间分布数据
arcgis·gis·遥感
limit00758 天前
公开 WMTS / XYZ 瓦片接入 Cesium:6 类常见问题与排查顺序
chrome·低代码·arcgis·web3·旅游
limit00759 天前
三维模型悬空与切片偏移的排查顺序
低代码·3d·arcgis·web3·安卓·webgl
最强小杰9 天前
Continue + minimax-m3 接入教程:协议、模型 ID、404 与工具调用排错
arcgis·ai
2501_9343044013 天前
新增2026年! 2012-2026年全国逐月夜间灯光数据
arcgis·gis数据
梅如你14 天前
中国2026年路网数据
arcgis·gis·遥感
梦想的初衷~14 天前
GPT × ArcGIS 强强联合:AI助力数据处理、空间分析、可视化及多案例综合应用实战教程
人工智能·gpt·arcgis
时间的情敌15 天前
《WebGIS EPSG:4326 与 EPSG:3857 墨卡托投影转换》
arcgis·mars2d