score:0

forget what i told you in my first comment (about updating the run() function). i just hadn't catched what you were precisely trying to do.

so you have an initial set of data in you php vars, that you feed to your chart. you want to update this set of data (which i guess you should do in your ajax success callback). this answer and the link it provides should point you in the right direction.

in your success callback, you can add something like that:

// update points in the datasets
// index in datasets[] can be 0, 1 or 2 (three datasets for barchart)
barchart2.datasets[0].points[0].value = data[0]['cpfsenviados'];
barchart2.datasets[1].points[0].value = data[0]['propostasfinalizadas'];
barchart2.datasets[2].points[0].value = data[0]['propostasaprovadas'];
barchart2.update();

// index in datasets[] can be 0 or 1 (two datasets for linechar)
linechart.datasets[0].points[0].value = data[0]['propostasfinalizadas'];
linechart.datasets[1].points[0].value = data[0]['propostasaprovadas'];
linechart.update();

let me know if it is what you were looking for. also, simple remark, in many javascript coding conventions you would avoid having the first letter of a variable as a capital. hence maybe you should rename your charts variables to barchart2 and linechart.


Related Query

More Query from same tag