有没有办法在echarts中将图表分别定位在canvas和图例上?

Is there is way to position the chart on the canvas and the legend individually in echarts?

我正在尝试定位我的饼图并将其从最初呈现的位置向右移动一点。我只想移动图表而不是图例。有什么办法可以做到吗?

我查看了文档,但找不到任何内容。网格也不行。

考虑这个例子:

Pie Doughnut on ECharts

如何将图表向右移动,同时保持图例在原处?

在选项系列中设置中心:

center: ['75%', '50%']

完整代码从您发布的 url 转移而来:

app.title = '环形图';

option = {
    tooltip: {
        trigger: 'item',
        formatter: "{a} <br/>{b}: {c} ({d}%)"
    },
    legend: {
        orient: 'vertical',
        x: 'left',
        data:['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
    },
    series: [
        {
            name:'访问来源',
            type:'pie',
            radius: ['50%', '70%'],
            avoidLabelOverlap: false,
            label: {
                normal: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    show: true,
                    textStyle: {
                        fontSize: '30',
                        fontWeight: 'bold'
                    }
                }
            },
            labelLine: {
                normal: {
                    show: false
                }
            },
            data:[
                {value:335, name:'直接访问'},
                {value:310, name:'邮件营销'},
                {value:234, name:'联盟广告'},
                {value:135, name:'视频广告'},
                {value:1548, name:'搜索引擎'}
            ],
            center: ['60%', '50%']
        }
    ]
};

更好的是,你可以使用grid

grid: {
  width: '50%',
  height:'50%',
  left: '3%',
  right: '4%',
  bottom: '3%',
  containLabel: true
},

https://echarts.apache.org/en/option.html#grid.width