我如何在 angular 中的 PIE 图表上显示值?我正在使用 ngx-echarts
How i can display values on PIE chart in angular ? i am using ngx-echarts
这是我的 echarts 选项,我不知道在哪里添加选项以在饼图上显示我的数据值。或任何无需悬停事件即可显示值的指示器。
this.options = {
backgroundColor: this.eTheme.bg,
tooltip: {
trigger: 'item',
formatter: '{b} : {c}',
},
legend: {
orient: 'vertical',
left: 'left',
data: [],
},
series: [
{
name: 'Users',
type: 'pie',
radius: '50%',
center: ['50%', '70%'],
data: [],
},
],
};
my pie chart
没有直接在图表上显示值的选项,您必须使用标签格式化程序来执行此操作。
例如:
this.options = {
backgroundColor: this.eTheme.bg,
tooltip: {
trigger: 'item',
formatter: '{b} : {c}',
},
legend: {
orient: 'vertical',
left: 'left',
data: [],
},
series: [
{
name: 'Users',
type: 'pie',
label: {
formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}:}{c} {per|{d}%} '
},
radius: '50%',
center: ['50%', '70%'],
data: [],
},
],
};
您可以根据需要调整格式化程序。
这是我的 echarts 选项,我不知道在哪里添加选项以在饼图上显示我的数据值。或任何无需悬停事件即可显示值的指示器。
this.options = {
backgroundColor: this.eTheme.bg,
tooltip: {
trigger: 'item',
formatter: '{b} : {c}',
},
legend: {
orient: 'vertical',
left: 'left',
data: [],
},
series: [
{
name: 'Users',
type: 'pie',
radius: '50%',
center: ['50%', '70%'],
data: [],
},
],
};
my pie chart
没有直接在图表上显示值的选项,您必须使用标签格式化程序来执行此操作。
例如:
this.options = {
backgroundColor: this.eTheme.bg,
tooltip: {
trigger: 'item',
formatter: '{b} : {c}',
},
legend: {
orient: 'vertical',
left: 'left',
data: [],
},
series: [
{
name: 'Users',
type: 'pie',
label: {
formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}:}{c} {per|{d}%} '
},
radius: '50%',
center: ['50%', '70%'],
data: [],
},
],
};
您可以根据需要调整格式化程序。