BarChartA bar chart or bar graph is a chart that presents Grouped data with rectangular bars with lengths proportional to the values that they represent.

Bar - 图1

View on GitHub

  • barchartdemo.ts
  • barchartdemo.html

    barchartdemo.ts

  1. export class BarChartDemo {
  2. data: any;
  3. constructor() {
  4. this.data = {
  5. labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
  6. datasets: [
  7. {
  8. label: 'My First dataset',
  9. backgroundColor: '#42A5F5',
  10. borderColor: '#1E88E5',
  11. data: [65, 59, 80, 81, 56, 55, 40]
  12. },
  13. {
  14. label: 'My Second dataset',
  15. backgroundColor: '#9CCC65',
  16. borderColor: '#7CB342',
  17. data: [28, 48, 40, 19, 86, 27, 90]
  18. }
  19. ]
  20. }
  21. }
  22. }
  23.  

barchartdemo.html

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