0
0

More than 1 year has passed since last update.

laravel chartjs 線グラフにしたいときデータがテーブルのうちの一つしかもらえない?

Last updated at Posted at 2021-04-21

chartjsで、データをもとにグラフを作成したかったのだが、、、

<td>{{$body->date}}</td>
<td>{{$body->evaluation}}</td>
    <td>{{$body->memo}}</td>
    <?php $Yaxis1s[] = array() ?>
    <?php $Xaxis1s[] = array() ?>
    <?php $Yaxis1s[] = $body->date; ?>
    <?php $Xaxis1s[] = $body->evaluation; ?>
    <td>
var Xaxis1s = <?php echo json_encode($Xaxis1s) ?>;

        var Yaxis1s = <?php echo json_encode($Yaxis1s) ?>;

で、送られたデータはテーブルの最後の一行だけ。

試行錯誤(〇〇時間)の結果

<?php $Yaxis1s[] = array() ?>
    <?php $Xaxis1s[] = array() ?>

これがいらないらしい

削除して完成

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0