当我尝试为图表集成插件时出现此错误。我在网上找到的插件都是蛋糕版本2.*的。我尝试为 3.0 做同样的事情并得到了这个错误。这是我的代码。我也尝试了高图表并得到了同样的结果。
use App\Controller\AppController;
App::uses('AppController', 'Controller');
App::uses('GoogleCharts', 'GoogleCharts.Lib');
class ChartsController extends AppController {
public $helpers = array('GoogleCharts.GoogleCharts');
//Setup data for chart
public function index() {
$chart = new GoogleCharts();
$chart->type("LineChart");
//Options array holds all options for Chart API
$chart->options(array('title' => "Recent Scores"));
$chart->columns(array(
//Each column key should correspond to a field in your data array
'event_date' => array(
//Tells the chart what type of data this is
'type' => 'string',
//The chart label for this column
'label' => 'Date'
),
'score' => array(
'type' => 'number',
'label' => 'Score',
//Optional NumberFormat pattern
'format' => '#,###'
)
));
//You can also manually add rows:
$chart->addRow(array('event_date' => '1/1/2012', 'score' => 55));
//Set the chart for your view
$this->set(compact('chart'));
}
}