轻松上手echarts地图图表:30个实用案例,让你的数据可视化更生动

2026-08-26 0 阅读

在当今数据驱动的世界里,地图图表作为一种强大的数据可视化工具,可以帮助我们更好地理解地理分布和数据趋势。echarts,作为一款强大的JavaScript图表库,提供了丰富的地图图表功能。本文将为你带来30个实用案例,助你轻松上手echarts地图图表,让你的数据可视化更加生动。

案例一:中国31省市区地图

说明:展示中国31个省市区的人口分布情况。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '中国31省市区人口分布'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '人口',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 省市区数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例二:全球各国GDP排名

说明:展示全球各国GDP排名情况。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '全球各国GDP排名'
    },
    tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b}: {c} ({d}%)'
    },
    series: [
        {
            name: 'GDP',
            type: 'map',
            mapType: 'world',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 国家数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例三:美国各州人口密度

说明:展示美国各州的人口密度分布情况。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '美国各州人口密度'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '人口密度',
            type: 'map',
            mapType: 'USA',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 州数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例四:欧洲各国GDP占比

说明:展示欧洲各国GDP在全球的占比情况。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '欧洲各国GDP占比'
    },
    tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b}: {c} ({d}%)'
    },
    series: [
        {
            name: 'GDP',
            type: 'map',
            mapType: 'europe',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 国家数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例五:中国城市地铁线路图

说明:展示中国部分城市的地铁线路图。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '中国城市地铁线路图'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '地铁线路',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 线路数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例六:世界主要港口分布

说明:展示世界主要港口的分布情况。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '世界主要港口分布'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '港口',
            type: 'map',
            mapType: 'world',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 港口数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例七:中国城市空气质量排名

说明:展示中国城市空气质量排名情况。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '中国城市空气质量排名'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '空气质量',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例八:全球各国人口密度

说明:展示全球各国人口密度分布情况。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '全球各国人口密度'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '人口密度',
            type: 'map',
            mapType: 'world',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 国家数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例九:中国城市GDP排名

说明:展示中国城市GDP排名情况。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '中国城市GDP排名'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: 'GDP',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例十:中国城市人口排名

说明:展示中国城市人口排名情况。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '中国城市人口排名'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '人口',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例十一:全球各国城市人口排名

说明:展示全球各国城市人口排名情况。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '全球各国城市人口排名'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '人口',
            type: 'map',
            mapType: 'world',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例十二:中国城市房价分布

说明:展示中国城市房价分布情况。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '中国城市房价分布'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '房价',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例十三:全球各国城市房价分布

说明:展示全球各国城市房价分布情况。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '全球各国城市房价分布'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '房价',
            type: 'map',
            mapType: 'world',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例十四:中国城市GDP与人口密度关系

说明:展示中国城市GDP与人口密度关系。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '中国城市GDP与人口密度关系'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '关系',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例十五:全球各国城市GDP与人口密度关系

说明:展示全球各国城市GDP与人口密度关系。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '全球各国城市GDP与人口密度关系'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '关系',
            type: 'map',
            mapType: 'world',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例十六:中国城市人口与GDP关系

说明:展示中国城市人口与GDP关系。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '中国城市人口与GDP关系'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '关系',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例十七:全球各国城市人口与GDP关系

说明:展示全球各国城市人口与GDP关系。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '全球各国城市人口与GDP关系'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '关系',
            type: 'map',
            mapType: 'world',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例十八:中国城市人口密度与房价关系

说明:展示中国城市人口密度与房价关系。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '中国城市人口密度与房价关系'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '关系',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例十九:全球各国城市人口密度与房价关系

说明:展示全球各国城市人口密度与房价关系。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '全球各国城市人口密度与房价关系'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '关系',
            type: 'map',
            mapType: 'world',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例二十:中国城市人口与房价关系

说明:展示中国城市人口与房价关系。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '中国城市人口与房价关系'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '关系',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例二十一:全球各国城市人口与房价关系

说明:展示全球各国城市人口与房价关系。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '全球各国城市人口与房价关系'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '关系',
            type: 'map',
            mapType: 'world',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例二十二:中国城市人口与GDP密度关系

说明:展示中国城市人口与GDP密度关系。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '中国城市人口与GDP密度关系'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '关系',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例二十三:全球各国城市人口与GDP密度关系

说明:展示全球各国城市人口与GDP密度关系。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '全球各国城市人口与GDP密度关系'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '关系',
            type: 'map',
            mapType: 'world',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例二十四:中国城市人口密度与GDP密度关系

说明:展示中国城市人口密度与GDP密度关系。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '中国城市人口密度与GDP密度关系'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '关系',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例二十五:全球各国城市人口密度与GDP密度关系

说明:展示全球各国城市人口密度与GDP密度关系。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '全球各国城市人口密度与GDP密度关系'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '关系',
            type: 'map',
            mapType: 'world',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例二十六:中国城市人口与GDP密度关系

说明:展示中国城市人口与GDP密度关系。

代码示例

var myChart = echarts.init(document.getElementById('main'));

var option = {
    title: {
        text: '中国城市人口与GDP密度关系'
    },
    tooltip: {
        trigger: 'item'
    },
    series: [
        {
            name: '关系',
            type: 'map',
            mapType: 'china',
            roam: true,
            label: {
                show: true
            },
            data: [
                // 城市数据...
            ]
        }
    ]
};

myChart.setOption(option);

案例二十七:全球各国城市人口与GDP密度关系

说明:展示全球各国城市人口与GDP密度关系。

代码示例

”`javascript var myChart = echarts.init(document.getElementById(‘main’));

var option = {

title: {
    text: '全球各国城市人口与GDP密度关系'
},
tooltip: {
    trigger: 'item'
},
series: [
    {
        name: '关系',
        type: 'map',
        mapType: 'world',
        roam: true,
        label: {
            show: true
        },
        data: [
            // 城市数据...
        ]
    }
分享到: