0
votes

I have a Primeng 9 p-chart that I'm trying to display and it's not working when I pass an array of data that's being parsed from JSON. When I manually enter the data the lines appear but for some reason an array is bust.

Is there a certain formatting this takes that I'm missing?

Chart

qData = [];
for(let i = 0; i < 6; i++){
      this.qData.push(5);
}

this.data = {
      labels: this.getXAxis(),
      datasets: [
        {
          label: 'First Dataset',
          data: [28, 48, 40, 19, 86], <--Line appears
          fill: false,
          borderColor: '#565656'
        },
        {
          label: 'Second',
          data: this.qData, <-- Array is populated but no lines
          fill: false,
          borderColor: '#4f81bd'
        },
...
1

1 Answers

0
votes

Data wasn't being loaded in time. Added a setTimeout(() => {...chart display...}, 1500); after my data calls and the chart is rendering now.