我是这个包的新手:克希尔/拉瓦查特。所以我试着在他们的文档中测试他们的一些例子。
在BarChart的例子中,我们可以看到以下代码:
$lava = new Lavacharts; // See note below for Laravel
$votes = $lava->DataTable();
$votes->addStringColumn('Food Poll')
->addNumberColumn('Votes')
->addRow(['Tacos', rand(1000,5000)])
->addRow(['Salad', rand(1000,5000)])
->addRow(['Pizza', rand(1000,5000)])
->addRow(['Apples', rand(1000,5000)])
->addRow(['Fish', rand(1000,5000)]);
$lava->BarChart('Votes', $votes);
return view('sample', compact(['lava'])); // I add these line
我尝试在视图中呈现BarChart:
方法1
@barchart('Food Poll', 'poll_div')没有发生渲染/没有BarChart。它只是在我的视图上显示@条形图(“食品调查”,“poll_div”)。
方法2
{!! Lava::render('BarChart', 'Food Poll', 'poll_div') !!}或
{!! $lava->render('BarChart', 'Food Poll', 'poll_div') !!}它显示了一个错误:
BarChart(食品调查)未被发现。
有人知道如何在视图中呈现BarChart吗?
发布于 2019-09-22 20:58:10
使用适当的名称调用BarCharts
{!! $lava->render('BarChart', 'Votes', 'poll_div') !!}并确保在HTMl中有一个呈现图表的div。
<div id="poll_div"></div>希望这能有所帮助
https://stackoverflow.com/questions/58053199
复制相似问题