![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 1 Pomógł: 0 Dołączył: 24.04.2016 Ostrzeżenie: (0%) ![]() ![]() |
Witam, Mam problem z uruchomianiem na swojej stronie googleCharts. Posiadam wersje cakePHP w wersji 2.5.1. Wykorzystałem ten poradnik do tworzenia googleCharts: GitHub
Po wykonaniu wszystkich instrukcji na ekranie nic się nie pojawia. Moj kontroler: Kod <?php App::uses('AppController', 'Controller'); App::uses('GoogleCharts', 'GoogleCharts.Lib'); class WyniksController extends AppController { public $components = array('Paginator'); public $helpers = array('GoogleCharts.GoogleCharts'); public function wykres() { $rounds = $this->Wynik->find( 'all', array( 'conditions' => array( 'Wynik.user_id' => $this->userId ), 'limit' => 10, 'fields' => array( 'Wynik.wynik', 'Wynik.id_wynik' ) ) ); $chart = new GoogleCharts(); $chart->type("LineChart"); $chart->options(array('title' => "Wyniki")); $chart->columns(array( 'id_wynik' => array( 'type' => 'string', 'label' => 'Date' ), 'wynik' => array( 'type' => 'number', 'label' => 'Wynik', ) )); foreach($rounds as $row){ //$chart->addRow(array('event_date' => $row['Model']['field1'], 'score' => $row['Model']['field2'])); $chart->addRow(array('id_wynik' => $row['Wynik']['id_wynik'], 'wynik' => $row['Wynik']['wynik'])); } $this->set(compact('chart')); } Widok kontrolera: Kod <?php echo $this->Html->script('jquery'); ?> <?php debug($chart); ?> <div id="div_id"> <?php $this->GoogleCharts->createJsChart($chart);?> </div> Debbuger wyświetlil mi taka liste dla zmiennej $chart: Kod object(GoogleCharts) { [private] type => 'LineChart' [private] columns => array( 'id_wynik' => array( 'type' => 'string', 'label' => 'Date' ), 'wynik' => array( 'type' => 'number', 'label' => 'Wynik' ) ) [private] rows => array( (int) 0 => array( (int) 0 => '21', (int) 1 => '20' ), (int) 1 => array( (int) 0 => '31', (int) 1 => '20' ), (int) 2 => array( (int) 0 => '41', (int) 1 => '40' ), (int) 3 => array( (int) 0 => '51', (int) 1 => '5' ), (int) 4 => array( (int) 0 => '61', (int) 1 => '40' ), (int) 5 => array( (int) 0 => '71', (int) 1 => '0' ), (int) 6 => array( (int) 0 => '81', (int) 1 => '0' ), (int) 7 => array( (int) 0 => '91', (int) 1 => '0' ), (int) 8 => array( (int) 0 => '101', (int) 1 => '40' ), (int) 9 => array( (int) 0 => '111', (int) 1 => '20' ) ) [private] options => array( 'width' => (int) 400, 'height' => (int) 300, 'title' => 'Wyniki', 'titleTextStyle' => array( 'color' => 'red' ) ) [private] callbacks => array() [private] div => 'div_id' } Head layout Kod <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <?php echo $this->Html->charset(); ?> <title> <?php echo $cakeDescription ?>: <?php echo $title_for_layout; ?> </title> <?php echo $this->Html->meta('icon'); echo $this->Html->css('cake.generic'); echo $this->fetch('meta'); echo $this->fetch('css'); echo $this->fetch('script'); ?> Jakieś sugestie w czym może leżeć problem ? Z góry dziękuję za wszelką pomoc! Ten post edytował hebo 24.04.2016, 12:39:34 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 21.08.2025 - 12:36 |