我想在折线图中得到两条单独的线。我已经从两个不同的数据数组中获得了两行,但是它们都使用相同的标签:/我想将一个数据数组与一个数据标签连接,将另一个数据数组与另一个数据数组连接...
就我而言:
连接数据-this.weightOfTargets
与this.dateOfTargets
-完成并正常工作
和
连接日期-this.weightOfWeightStates
与this.dateOfWeightStates
-目前this.weightOfWeightStates
正在使用this.dateOfTargets
数据:/
html
<canvas baseChart
[datasets]="lineChartData"
[labels]="lineChartLabels"
[options]="lineChartOptions"
[legend]="lineChartLegend"
[chartType]="lineChartType">
</canvas>
打字稿
public lineChartLabels = this.dateOfTargets;
//public lineChartLabels2 = this.dateOfWeightStates;
//does not work :/
//public lineChartLabels = [
this.dateOfTargets,
this.dateOfWeightStates];
public lineChartType = 'line';
public lineChartLegend = true;
public lineChartData = [
{data: this.weightOfTargets, label: 'A'},
{data: this.weightOfWeightStates, label: 'B'}
];
我正在使用ng2-charts@2.2.3和chart.js