我正在使用ng2的圓環圖來顯示一些項目,它的所有工作都很好,但是我需要改變的是,每個切片的標籤顯示只在懸停時顯示,但我需要的是它應該在每個切片中默認。如何使用ng2圖表在環形圖中顯示標籤?
Dashboard.component.html:
<canvas #mycanvas baseChart
[data]="doughnutChartData"
[labels]="doughnutChartLabels"
[chartType]="doughnutChartType"
[colors]="colors"
[options]="options"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)">
</canvas>
Dashboard.component.ts:
public doughnutChartLabels:string[] = ['Running', 'Stop', 'Idle'];
public doughnutChartData:number[] = [1, 4, 5];
public doughnutChartType:string = 'doughnut';
public colors: any[] = [{ backgroundColor: ["#008000", "#FF0000", "#FFA500"] }];
我是在需要的東西是完全像圖像中,
標籤應該在默認的每個切片和東西只需要使用純打字稿和沒有javascript就可以實現。請幫助我達到預期的效果。
參考chart.js之文檔[傳奇配置](http://www.chartjs.org/docs/latest/configuration/legend.html#example),你可以使用輸入'[options] =「options」'來傳遞上面鏈接的相同選項 – JoxieMedina