<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <title>Echarts 渲染 SVG 图形示例</title>
    <!-- 引入 Echarts 库 -->
    <script src='https://cdn.bootcss.com/echarts/4.2.1-rc1/echarts.min.js'></script>
</head>
<body>
    <!-- 用于渲染 SVG 图形的 DOM 元素 -->
    <div id='svg-container' style='width: 500px; height: 500px;'></div>
<pre><code>&lt;script type='text/javascript'&gt;
    // 初始化 Echarts 实例
    var myChart = echarts.init(document.getElementById('svg-container'));

    // 定义 SVG 图形的数据
    var svgData = '&lt;svg&gt;&lt;g name=&quot;1&quot;&gt;&lt;path d=&quot;M43,113L99,113L99,206L43,206Z&quot; stroke-width=&quot;0.5&quot; stroke=&quot;#000000&quot; fill=&quot;#800080&quot;&gt;&lt;/path&gt;&lt;/g&gt;&lt;/svg&gt;';

    // 将 SVG 数据转换为 Echarts 的图形数据
    var option = {
        // 使用 SVG 的 path 标签作为图形元素
        graphic: echarts.util.parseSVG(svgData)[0]
    };

    // 渲染图形
    myChart.setOption(option);
&lt;/script&gt;
</code></pre>
</body>
</html>
<!-- SVG 图形 -->
<p><svg><g name='1'><path d='M43,113L99,113L99,206L43,206Z' stroke-width='0.5' stroke='#000000' fill='#800080'></path></g></svg></p>
Echarts 渲染 SVG 图形示例:完整代码及注释