Chartjs-Primeng line chart not updating automatically,only update on window refresh

1👍

Your change detection is not triggered when you update the datasetvalues, You can try this,

    Go() {
           this.renewData1.datasets = []
                  
           for(loop){
             this.renewData1.datasets.push({dynamic data});
           }
           this.renewData1 = {...this.renewData1}; // Do this in the end
}

0👍

As stated change detection is not getting triggered since you are updating inside the object, and it only tracks if the whole object (object reference) changes.

Go() { 
this.renewData1 =  {...this.renewData1, datasets: <*ASSING DYNAMIC DATA*> }
}

Here you can create and replace just the dataSets directly in the new object created.

Leave a comment