当我使用laravel 5.4并在我的laravel文件夹中安装lavacharts时,现在我想从MySQL数据库中获取数据并且必须在DonutChart中显示相同的数据。
MyController.php
class ChartsController extends Controller
{
function chart(){
$lava = new Lavacharts;
$popularity = $lava->DataTable();
$popularity2 = $lava->DataTable();
$popularity ->addStringColumn('status')
->addNumberColumn('status')
->addRow(['Tickets Close', 5])
->addRow(['Tickets Open', 6])
->addRow(['Tickets Pending', 3]);
Lava::DonutChart('Popularity', $popularity, ['title'=>'Your Ticket Statistics'
]);
return view('chart',compact('lava'));
}
}
myView.blade.php
<div id="pop-div"></div>
<?= Lava::render('DonutChart', 'Popularity', 'pop-div') ?>
当我执行此代码时,我收到错误
ErrorException in Lavacharts.php line 129:
'DonutChart' is not a valid Lavachart object. (View:
C:\wamp64\www\lavachart\resources\views\myView.blade.php
可以帮我解决这个问题吗?
答案 0 :(得分:0)
我找到了答案。
我在视图中遇到的错误。我只是改变了我的看法
这是解决方案
这
@receiver(post_save, sender=EmailAddress)
def handle_email_address_save(sender, instance, created, update_fields, **kwargs):
confirm = account_settings.ACCOUNT_EMAIL_CONFIRMATION_EMAIL
must_confirm = instance.must_confirm if hasattr(instance, 'must_confirm') else False
warning("handle_email_address_save called for email "
+ str(instance.email) + ", created = " + str(created)
+ ", confirm = " + str(confirm) + ", must_confirm = " + str(must_confirm))
if confirm and not instance.verified and must_confirm:
instance.send_confirmation()
warning("handle_email_address_save sent confirmation")
# TODO: move to signals.py in quotes module
@receiver(comment_was_posted)
def handle_comment_posted(sender, comment, request, **kwargs):
if comment.content_type.model == 'leadcontact':
leadcontac = LeadContact.objects.get(pk=comment.object_pk)
leadcontac.send_comment_posted_emails(comment)
要
<div id="pop-div"></div>
<?= Lava::render('DonutChart', 'Popularity', 'pop-div') ?>