我的控制器代码,
use Khill\Lavacharts\lavacharts;
$lava=new Lavacharts;
$stocksTable=$lava->DataTable();
$stocksTable->addStringColumn('Paper Name')
->addNumberColumn('Results');
foreach($papername as $index=>$key)
{
$stocksTable->addRow([
$papername[$index],$newscore[$index]
]);
}
$chart=$lava->BarChart('Results',$stocksTable);
return view('charts',['lava'=>$lava]);
}
我的观看代码,
<div id="stocks-chart">
</div>
<?=$lava->render('BarChart', 'resultchart', 'stocks-chart') ?>
执行时我得到一个错误,
&#34;未定义变量:熔岩(查看:C:\ xampp \ htdocs \ lavachartstest \ resources \ views \ charts.blade.php)&#34;
我也尝试使用Lava
外观,控制器代码
$stocksTable=\Lava::DataTable();
$stocksTable->addStringColumn('Paper Name')
->addNumberColumn('Results');
foreach($papername as $index=>$key)
{
$stocksTable->addRow([
$papername[$index],$newscore[$index]
]);
}
$chart=\Lava::BarChart('Results',$stocksTable);
return view('charts',['chart'=>$chart]);
}
查看代码
<div id="stocks-chart">
</div>
{!!Lava::render('BarChart', 'resultchart', 'stocks-chart') !!}
但仍然出现错误
&#34;未找到BarChart(&#39;结果图&#39;)。 (查看:C:\ xampp \ htdocs \ lavachartstest \ resources \ views \ charts.blade.php)&#34;