<!-- 引入echarts -->
<script src='https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js'></script>
<!-- 容器,用于渲染echarts图表 -->
<div id='chart' style='width: 400px; height: 400px;'></div>
<script>
// 初始化echarts图表
var myChart = echarts.init(document.getElementById('chart'));

// 定义svg图形的路径
var svgPath = 'M43,113L99,113L99,206L43,206Z';

// 定义echarts系列的配置项
var option = {
    series: [{
        type: 'custom', // 自定义系列类型
        renderItem: function(params, api) {
            // 创建一个path元素
            var path = new echarts.graphic.Path({
                shape: {
                    // 从api获取svg路径
                    d: api.coord([[43, 113], [99, 113], [99, 206], [43, 206]])
                },
                style: {
                    // 设置边框和填充颜色
                    stroke: '#000000',
                    fill: '#800080'
                }
            });
            // 返回path元素
            return path;
        }
    }]
};

// 设置echarts图表的配置项并渲染图表
myChart.setOption(option);
</script>
<!-- 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 图形简单示例 - 带注释