How to add google-chart correctly in Yii2?

拜拜、爱过 提交于 2020-01-17 04:30:05

问题


I have added the extension (a wraper for google chart) "scotthuangzl/yii2-google-chart": "dev-master" to the require section of my composer.json file. However when I call that extension on views\site\myPage.php I have this error: Class 'scotthuangzl\googlechart\GoogleChart' not found. What I am doing wrong? Thanks.

This is the code where I call the google chart:

<?php
  use scotthuangzl\googlechart\GoogleChart;

  echo GoogleChart::widget(array('visualization' => 'BarChart',
  'data' => array(
  array('Type', 'Value'),
  array('Var1', $model->avg1),
  .............
  ),
 'options' => array('title' => 'Variable - avg1')));
?>

回答1:


I have solved the issue by using another wraper (https://github.com/miloschuman/yii2-highcharts). (1) I put the following lines in the require section of the composer.json file: "yiisoft/yii2-jui": "*", "miloschuman/yii2-highcharts-widget": "dev-master" (2) And then run in the console the command: composer update



来源:https://stackoverflow.com/questions/33483961/how-to-add-google-chart-correctly-in-yii2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!