PieChartA pie chart is a circular statistical graphic, which is divided into slices to illustrate numerical proportion.

Pie - 图1

View on GitHub

piechartdemo.ts

  1. export class PieChartDemo {
  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.  

piechartdemo.html

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