We’ve added a tutorial on how to use Charts4PHP with CodeIgnitor framework.


– I’m going to show you how to integrate Charts4php with Codeigniter framework.
– And to save time i’ve downloaded CI3 here.
– Next step is to download Charts4PHP. It comes with free version and a paid version. Paid version support far more features and visualization charts.
– When we extract charts4php, there is a ‘lib’ folder in it. It contains all our required files. ‘inc’ folder contains PHP library files. ‘js’ and ‘img’ are static files.
– So to integrate, we will move ‘inc’ folder in ‘application/third_party’ folder inside applications folder of CI as ‘chartphp’.
– And move the static files in a newly created folder ‘public/chartphp’
– Now we can jump to controller of CI. It comes with a default controller file ‘Welcome’. So we’ll be using this to show our chart.
– Saving time, i’ll copy the chartphp code from the line demo. We’ll put the PHP code in controller and move the HTML part in view.
– We will need to adjust the chartphp_dist.php where i placed it in CI.
– That’s all from controller. Now pass the $out variable to view.
– In view, we’ll include our static files with our included path and finally echo the passed variable where we need to show chart.
– That’s all.

You can download complete code from:

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!