SVG代码
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) --><svgwidth="210mm"height="297mm"viewBox="0 0 210 297"version="1.1"id="svg1"inkscape:version="1.4.2 (f4327f4, 2025-05-13)"sodipodi:docname="demo.svg"xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"xmlns="http://www.w3.org/2000/svg"xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedviewid="namedview1"pagecolor="#ffffff"bordercolor="#000000"borderopacity="0.25"inkscape:showpageshadow="2"inkscape:pageopacity="0.0"inkscape:pagecheckerboard="0"inkscape:deskcolor="#d1d1d1"inkscape:document-units="mm"inkscape:zoom="0.52203984"inkscape:cx="397.47924"inkscape:cy="691.5181"inkscape:window-width="1440"inkscape:window-height="830"inkscape:window-x="-6"inkscape:window-y="-6"inkscape:window-maximized="1"inkscape:current-layer="layer1" /><defsid="defs1" /><ginkscape:label="图层 1"inkscape:groupmode="layer"id="layer1"><path name="N1"style="fill:#ae8591;fill-opacity:1;stroke-width:0.264583"d="m 84.639929,114.03584 c -5.99427,2.11933 -13.533278,2.2052 -19.259383,5.06825 -2.477494,1.23875 -2.522294,4.09501 -3.040956,1.52048 -12.442704,-61.76304 -8.244891,-12.56889 -6.081911,4.05461 0.338176,2.59904 -6.16344,3.79237 -7.095564,6.58874 -0.106847,0.32054 0.151106,0.71144 0,1.01365 -0.487966,0.97593 -1.742697,2.12475 -2.027304,3.54778 -0.114914,0.57457 0.219837,1.87462 0,2.53413 -0.936321,2.80897 -0.798915,3.47043 0.506825,6.08191 0.226661,0.45332 -0.122922,1.02878 0,1.52048 0.239128,0.9565 0.958136,1.78434 1.520479,2.53413 0.365477,0.4873 0.741241,0.97565 1.013653,1.52048 0.07555,0.1511 -0.119459,0.38736 0,0.50682 2.590072,2.59007 -0.706887,-2.12511 2.027304,1.52048 0.226657,0.30221 0.204612,0.78699 0.506825,1.01365 0.427392,0.32055 1.062371,0.23196 1.520478,0.50683 2.534129,1.52048 0,0.50682 1.520479,1.52048 0.928721,0.61915 3.156426,1.72791 4.054607,2.0273 0.480816,0.16027 1.067157,-0.22666 1.520475,0 0.213699,0.10685 0.27504,0.44888 0.506828,0.50683 2.111381,0.52784 6.018051,0.15829 8.109215,0.50682 3.144938,0.52416 6.909469,1.15224 10.136518,0.50683 1.909106,-0.38182 4.38795,-1.96948 6.081911,-2.53413 0.320545,-0.10685 0.711441,0.1511 1.013653,0 2.296454,-1.14823 3.523168,-3.21415 5.068258,-5.06826 1.216853,-1.46023 3.046838,-3.06449 3.547782,-5.06826 0.66036,-2.64144 2.445276,-11.41674 1.520478,-14.19113 -0.07555,-0.22666 -0.337883,-0.33788 -0.506825,-0.50682 -0.168942,-0.50683 -0.402053,-0.99661 -0.506828,-1.52048 -0.06626,-0.33132 0.151106,-0.71144 0,-1.01365 -0.506825,-1.01365 -1.013651,-0.76024 -1.520476,-1.52048 -1.141772,-1.71266 -2.411727,-3.36418 -3.547782,-5.06826 -0.716613,-1.07492 -0.991314,-2.48946 -1.520478,-3.54778 -1.044345,-2.08869 -2.94345,-3.04371 -5.068261,-4.56143 z"id="path1"sodipodi:nodetypes="csssssssssssssssssssssscssscsssssc" /><path name="N2"style="fill:#b09f00;fill-opacity:1;stroke-width:0.264583"d="m 122.65188,144.95222 c -7.99293,0 -16.47371,3.23732 -22.807172,8.10921 -0.757494,0.58269 -1.281041,1.4303 -2.027304,2.02731 -0.131921,0.10553 -0.337883,0 -0.506825,0 -0.506825,0.33788 -1.089758,0.58293 -1.520478,1.01365 -0.229574,0.22957 -2.24635,2.97222 -2.534129,3.54778 -1.275874,2.55174 -1.176361,3.8358 -1.520479,6.58873 -0.06626,0.53012 -0.431273,0.99161 -0.506825,1.52048 -0.443751,3.10626 0.521658,5.66409 1.013651,8.61605 0.08332,0.49992 -50.275168,-5.05842 -50.175768,-4.56144 0.165351,0.82676 52.064205,8.90068 52.203071,9.12287 1.805141,2.88822 -32.776321,73.88185 2.534132,4.56143 3.027255,-5.94302 4.803366,74.14296 10.643346,75.51707 3.47404,0.81742 16.62243,-64.87372 20.27304,-64.87372 1.18259,0 2.39334,0.25654 3.54778,0 0.46646,-0.10366 0.58626,-0.79996 1.01365,-1.01366 0.62303,-0.31151 52.56074,38.24623 53.21672,38.01195 2.83337,-1.01192 -42.61939,-42.1127 -40.54607,-44.60068 1.96717,-2.36061 1.82578,-5.78266 2.53413,-8.61605 0.61584,-2.46336 1.50299,-5.70322 2.53413,-8.10921 0.23994,-0.55988 0.88151,-0.92585 1.01365,-1.52048 0.28932,-1.30193 0.2639,-6.28286 0,-7.60238 -0.44883,-2.24416 -2.08659,-4.68001 -3.04096,-6.58874 -0.62414,-1.24829 1.47118,0.45753 -0.50682,-1.52048 -0.57976,-0.57976 22.04249,-39.31647 21.28668,-39.53242 -3.13981,-0.89709 -34.72081,34.33583 -37.50511,32.94368 -0.55121,-0.2756 -2.83654,-0.30241 -3.04096,-0.50682 -0.11946,-0.11947 0.11946,-0.38737 0,-0.50683 -0.65918,-0.65918 -5.51603,-2.01043 -5.57508,-2.0273 z"id="path2"sodipodi:nodetypes="csscssssssssssssssssssssssssc" /><path style="fill:#000000;stroke-width:0.264583"d="m 115.04949,159.65017 3.54778,3.04096"id="path3" /><path name="N4"sodipodi:type="star"style="fill:#b09f00;fill-opacity:1;stroke-width:0.264583"id="path4"inkscape:flatsided="false"sodipodi:sides="5"sodipodi:cx="110.99488"sodipodi:cy="86.160408"sodipodi:r1="29.387165"sodipodi:r2="29.390985"sodipodi:arg1="0.56408372"sodipodi:arg2="2.8988213"inkscape:rounded="0"inkscape:randomized="0"d="M 135.82935,101.87201 82.465772,93.225814 103.72653,114.63455 95.459301,61.210943 81.668322,88.046789 129.92247,63.675385 100.13842,58.852117 138.22836,97.213364 133.61178,67.396575 108.8985,115.47653 Z"inkscape:transform-center-x="2.2460436"inkscape:transform-center-y="0.58292381" /><rectstyle="fill:#b06a00;fill-opacity:1;stroke-width:0.264583"id="rect11"width="41.052898"height="56.257675"x="29.395905"y="204.75768" /><path style="fill:#b06a00;fill-opacity:1;stroke-width:0.264583"d="M 32.436861,54.7372 13.6843,77.037543"id="path11" /><pathstyle="fill:#b06a00;fill-opacity:1;stroke-width:0.264583"d="M 23.313993,96.803754 20.779863,49.668943"id="path12" /><pathstyle="fill:#b06a00;fill-opacity:1;stroke-width:0.264583"d="M 39.025597,54.230375 11.656996,80.585322"id="path13" /><pathstyle="fill:#b06a00;fill-opacity:1;stroke-width:0.264583"d="M 12.670648,91.735493 20.779863,68.928326"id="path14" /><pathstyle="fill:#b06a00;fill-opacity:1;stroke-width:0.264583"d="M 33.450511,65.380546 52.203072,64.366893"id="path15" /><pathstyle="fill:#b06a00;fill-opacity:1;stroke-width:0.264583"d="m 63.860068,77.544368 1.520478,12.670647"id="path16" /><pathstyle="fill:#b06a00;fill-opacity:1;stroke-width:0.264583"d="M 14.191126,76.530715 30.409557,51.189418"id="path17" /><pathstyle="fill:#b06a00;fill-opacity:1;stroke-width:0.264583"d="M 54.230375,57.778157 17.738908,65.887372"id="path18" /><path name="N3"style="fill:#b06a00;fill-opacity:1;stroke-width:0.264583"d="M 29.902729,45.614333 C 14.191126,74.503411 17.232082,82.105801 17.232082,82.105801 H 33.450511 L 58.284982,76.02389 48.148464,53.216722 Z"id="path19" /></g>
</svg>
完整代码
<!DOCTYPE html>
<html lang="en" style="height: 100%">
<head><meta charset="utf-8"><script type="text/javascript" src="https://echarts.apache.org/zh/js/vendors/jquery@3.7.1/dist/jquery.min.js"></script><script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script>
</head><body style="height: 100%;width:100%; margin: 0"><div id="container" style="height: 80%"></div><script type="text/javascript">var dom = document.getElementById('container');var myChart = echarts.init(dom);var app = {};var option;var china;function demo(){$.get('demo.svg', function (svg) {myChart.hideLoading();echarts.registerMap('demo', {svg:svg});option = {tooltip: {trigger: 'item',formatter: '{b}<br/>{c} (p / km2)'},series: [{name: '香港18区人口密度',type: 'map',map: 'demo',color:['green','blue','yellow','white'],label: {show: true},data: [{ name: 'N1', value: 2000.34 },{ name: 'N2', value: 8000.48 },{ name: 'N3', value: 10000.1 },{ name: 'N4', value: 12000.6 },]},]}myChart.setOption(option)})}myChart.showLoading();demo();</script>
</body>
</html>
示例结果
