在PrimeNG中隐藏传奇

Wan*_*ene 0 chart.js primeng angular

所以我想在我的饼图中隐藏我的传奇,因为52个标签占用了太多空间,但我找不到在primeNG中做到这一点的方法.

我的代码:

chart.component.html

    <p-chart type="doughnut" [data]="monthlyTeamCost"></p-chart>
Run Code Online (Sandbox Code Playgroud)

我的component.ts中的声明

this.monthlyTeamCost = {
                    labels: team,
                    options: {labels: {display: false}},
                    datasets: [
                        {
                            data: amount,
                            backgroundColor: colorArr,
                        }],
                    };
Run Code Online (Sandbox Code Playgroud)

因此,所有数据都很好,只需要隐藏标签.提前致谢

Adr*_*RAL 7

您需要将选项绑定到对象,如下所示:

<p-chart type="doughnut" [data]="monthlyTeamCost" [options]="chartOptions"></p-chart>
Run Code Online (Sandbox Code Playgroud)

然后在你的TS文件:

this.chartOptions = {
  legend: {display: false}
}
Run Code Online (Sandbox Code Playgroud)

Prime NG是Chart.JS的绑定(用于绘制图书馆的一部分),因此您可以在Chart.JS网站上找到详尽的选项列表:http://www.chartjs.org/docs/latest/