php - How to Pass Smarty variable or array in Chart.js scripts -


i using chart.js creating line charts. using php , smarty. creating string , passing smarty .

when pass smarty variable chart.js shows syntax error stops charts.

so want know proper way use chart.js php , smarty.

any appreciated. that's code use:

var tp = {     $tot_app }; var total_app = tp.split(','); //day applications var dayp = {     $dtcnt }; var day_arr = dayp.split(','); //dates var dt_p = {     $dates }; var arr_t = dt_p.split(','); var linechartdata = {     labels: arr_t,     datasets: [{         fillcolor: "rgba(220,220,220,0.5)",         strokecolor: "rgba(220,220,220,1)",         pointcolor: "rgba(220,220,220,1)",         pointstrokecolor: "#fff",         data: total_app     }, {         fillcolor: "rgba(151,187,205,0.5)",         strokecolor: "rgba(151,187,205,1)",         pointcolor: "rgba(151,187,205,1)",         pointstrokecolor: "#fff",         data: day_arr     }]  } var myline = new chart(document.getelementbyid("canvas").getcontext("2d")).line(linechartdata); 


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -