此篇内容是参考csdn文章的方法
自定义legend
项目中会有自定义的需求,拿v-chart官方的代码作为例子。
官方默认legend的款式是这样的。
设计稿是这样的
这种样式大大不同,我们就需要用到e-charts的legend属性了
根据上一篇使用教程,使用extend属性进行配置
data () {
return {
//在v-charts官方文档可以查看到的配置信息
chartSettings: {
//圆的半径
radius: [30, 60],
offsetY: 60,
labelLine: {
show: false
},
label: {
show: false
},
itemStyle: {
normal: {
color: function (params) {
// 自定义颜色
let colorList = [
'#975fe5', '#f2637b'