Valor软件折线图表

时间:2017-05-05 18:23:29

标签: angular

这就是我现在想要的。我从包含购买的数据库数据中获取,这就是我在表格中绑定的游戏[密钥] .purchase 。我希望能够根据表格中提供的购买数字或数字绘制图表。该表显示购买价值。在我的html中,我发现图表是根据我的Games.ts中linechartData中的数据集绘制的。

我尝试了这个,所以它可能会反对我的购买价值,但图表不会绘制。如何将购买的值分配给lineChartData中的数据,以便根据我的购买价值绘制线图?

public lineChartData:Array<any> = [
            {data: [this.Games], label: 'Series A'},

          ];

Games.html

<div style="display: block;">
    <canvas baseChart width="300" height="150"
                    [datasets]="lineChartData"
                    [labels]="lineChartLabels"
                    [options]="lineChartOptions"
                    [colors]="lineChartColors"
                    [legend]="lineChartLegend"
                    [chartType]="lineChartType"
                    (chartHover)="chartHovered($event)"
                    (chartClick)="chartClicked($event)"></canvas>
        </div>
      </div>

     <table class="table table-responsive table-condensed">
          <tr>
            <th *ngFor="let label of lineChartLabels">{{label}}</th>
          </tr>
          <tr *ngFor="let key of Games | keys" >
            <td *ngFor="let label of lineChartLabels; let j=index">{{ Games[key].purchase}}</td>
          </tr>
        </table>

Games.ts

Games : Games[] = [];

 public lineChartData:Array<any> = [
        {data: [50, 30, 50], label: 'Series A'},

      ];
      public lineChartLabels:Array<any> = ['January', 'February', 'March'];

0 个答案:

没有答案
相关问题