我的控制器代码,
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') ?>
当我执行一个错误时,
“未定义变量:lava(视图:c:\xampp\htdocs\lavachartstest\resources\views\charts.blade.php)”
我也试过使用 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') !!}
但还是有错误
“找不到条形图('resultchart')(视图:c:\xampp\htdocs\lavachartstest\resources\views\charts.blade.php)
暂无答案!
目前还没有任何答案,快来回答吧!