Tuesday, June 24, 2014

Re: cakephp graphs

  I am trying to use highchart in cakephp
I still get a highchart not found.

I downloaded highchartPHP and placed all the 4 files in `Vendor/HighchartsPHP`

In the layout I add the lines with the actual js files in `webroot/js`

    echo $this->Html->script('jquery-1.9.1.min'); // Include jQuery library
    echo $this->Html->script('highcharts'); // Include jQuery library

This is my code

    <?php
    App::import('Vendor', 'HighchartsPHP/Highchart');
    
    class ChartsController extends AppController
    {
        public function index() {        
            $chart = new Highchart();  /////////////////Error: Class 'Highchart' not found
            $chart->chart = array(
                'renderTo' => 'container', // div ID where to render chart
                'type' => 'line'
            );
    
            $chart->series[0]->name = 'Tokyo';
            $chart->series[0]->data = array(7.0, 6.9, 9.5);
            $this->set( compact( 'chart' ) );
        }

In view file
   
    <?php $chart->printScripts(); ?>
   
    <script type="text/javascript">
        <?php echo $chart->render("chart");?>
    </script>


* **https://coderwall.com/p/c6yasq**
* **http://stackoverflow.com/questions/18868242/using-highchartsphp-library-in-cakephp**

I cant find any more instructions about cakePHP setup with highcharts so I am stuck and I get a highchart not found error.
I still have something missing. What has confused me is that highchartPHP doesnt explain how you install it for a MVC version with cakephp

How to setup highchart so it works in cakephp ?

I got from the download zip button link so it must be v3
https://github.com/ghunti/HighchartsPHP

also Error: Class 'Highchart' not found from the controller as i outlined above 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: