将数据添加到primeng图表

时间:2017-07-01 21:07:28

标签: angular primeng

这是我的代码

 testing(type: any, month: any, year: any, id: any){
for(var i = 0; i < id.length; i++){
  this.nodeService.getDataFromId(type, year , month, id[i]).subscribe(
    data =>{
      var test = data.json()
      for(var j = 0; j < test.length; j++){
        if(test[j].mean == null) {
          this.lineDataDetail.push(0)
        } else {
          this.lineDataDetail.push(test[j].mean)
        }

      }


      this.test.push({
              label: id[this.ids],
              data: this.lineDataDetail,
              fill: false,
              borderColor: '#4bc0c0'
            })

      this.lineDataDetail = []
       this.ids++
    }
  )
}
this.data =  {
 labels: ['1', '2', '3', '4', '5', '6', '7','8', '9', '10', '11', '12', '13', '14','15', '16', '17', '18', '19', '20', '21','22', '23', '24', '25', '26', '27', '28', '29', '30', '31'],
 datasets : this.test
}
 }

我正在制作我自己的数组用于数据集,但我一直收到此错误 ERROR TypeError:无法读取属性&#39;转换&#39; null 抱歉英文不好

0 个答案:

没有答案