Ng2-Charts Linechart only showing first 2 two values

后端 未结 2 1375
甜味超标
甜味超标 2021-02-14 21:16

I\'m starting new Angular application which I initialised with Angular-CLI (beta 22.1). But when I add test-data (5 values) to my chart it seems to scale wrong and only shows th

相关标签:
2条回答
  • 2021-02-14 22:03

    labels property must be defined along with values. According to documentation for properties:

    labels (?Array) - x axis labels. It's necessary for charts: line, bar and radar.

    So specifying actual values for labels will do the trick.

    0 讨论(0)
  • 2021-02-14 22:12

    You need to put a condition inside the canvas, e.g., show it when the data is loaded or your array.length > 0

    Example:

    <canvas baseChart *ngIf="showMyChart" [datasets]="_numbers"
         [chartType]="_chartType" width="600px">
    </canvas>
    
    0 讨论(0)
提交回复
热议问题