コード例 #1
0
 public function init()
 {
     parent::init();
     $dataTable = $this->dataTable();
     $jOpts = self::encode($this->options);
     $id = $this->getId();
     $this->getView()->registerJs("var {$id}=new google.visualization.PieChart(document.getElementById('{$id}'));{$id}.draw({$dataTable},{$jOpts});");
 }
コード例 #2
0
 public function init()
 {
     parent::init();
     $dataTable = $this->dataTable();
     $jOpts = self::encode($this->options);
     $id = $this->getId();
     if ($this->mode == 'classic') {
         $package = 'corechart';
         $call = "var {$id}=new google.visualization.ColumnChart(document.getElementById('{$id}'));{$id}.draw({$dataTable},{$jOpts});";
     } else {
         $package = 'bar';
         if ($this->mode == 'transition') {
             $jOpts = "google.charts.Bar.convertOptions({$jOpts})";
         }
         $call = "var {$id}=new google.charts.Bar(document.getElementById('{$id}'));{$id}.draw({$dataTable},{$jOpts});";
     }
     $this->packages = [$package];
     $this->getView()->registerJs($call);
 }