DoughnutChartA doughnut chart is a variant of the pie chart, with a blank center allowing for additional information about the data as a whole to be included.

Doughnut - 图1

View on GitHub

  • doughnutchartdemo.ts
  • doughnutchartdemo.html

    doughnutchartdemo.ts

  1. export class DoughnutChartDemo {
  2. data: any;
  3. constructor() {
  4. this.data = {
  5. labels: ['A','B','C'],
  6. datasets: [
  7. {
  8. data: [300, 50, 100],
  9. backgroundColor: [
  10. "#FF6384",
  11. "#36A2EB",
  12. "#FFCE56"
  13. ],
  14. hoverBackgroundColor: [
  15. "#FF6384",
  16. "#36A2EB",
  17. "#FFCE56"
  18. ]
  19. }]
  20. };
  21. }
  22. }
  23.  

doughnutchartdemo.html

  1. <p-chart type="doughnut" [data]="data"></p-chart>
  2.