javascript - How to insert php array values into chart.js line chart? -


i've made point:

<?php $result = mysql_query("select * monitoring") or die(mysql_error()); $wartosci = array();  while ($row_danych = mysql_fetch_assoc($result))     $wartosci[] = $row_danych;  foreach ($wartosci $wartosc) {    echo "{$wartosc[temp1]}<br>"       . "{$wartosc[temp2]}<br>"         . "{$wartosc[wilg]}<br>"       . "{$wartosc[swia]}<br>"       . "{$wartosc[cisn]}<br>"         . "{$wartosc[zan]}<br>"       . "{$wartosc[woda]}<br><br>"; } ?> 

and, "echo" result this:

85.00 32.50 48.50 20 981.59 30 35  32.25 32.40 49.30 20 981.63 30 35  32.38 32.40 48.10 20 981.58 30 35 

and on. now, how insert arrays chart.js line graph 7 datasets? need insert every row separately. i've tried just:

data: {$wartosc[temp1]} 

but this, chart disappears.

i tried this:

echo json_encode($wartosc[temp1]); 

in foreach loop. in first dataset:

data: <?=json_decode($wartosc[temp1]);?> 

and chart isn't visible, before.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -