I am trying to use ghunti\'s HighchartsPHP wrapper in CakePHP so I can use it in my project.
In the demo it says to edit the config.php
and include the scri
Your controller should be like this:
<?php
App::import('Vendor', 'HighchartsPHP/Highchart');
class ChartsController extends AppController {
public function index() {
$chart = new Highchart();
$chart->chart = array(
'renderTo' => 'container', // div ID
'type' => 'line'
);
$chart->series[0]->name = 'Tokyo';
$chart->series[0]->data = array(7.0, 6.9, 9.5);
$this->set( compact( 'chart' ) );
}
}
and index.ctp:
<?php $chart->printScripts(); ?>
<script type="text/javascript">
<?php echo $chart->render("chart");?>
</script>