Tutorial: Using HighChart on CodeIgniter project without ajax

If we would like print some report on CodeIgniter, we can use view like tabels, and then print or export the report using pdf, word, or excel document. Looking for table in the report page is fine, but if you use chart to present your data, it’s look better and come alive.

Many charts plugin are available to download. Highcharts, is one of the famous chart thats use by programmers .

A little thing about highcharts, Highcharts is pure javascripts source code that will make your data come alive with charts. Charts are available is Bar Charts, Line Charts, and Pie Charts. Highchart was released in 2009, its charting library written in pure JavaScript. In modern browsers, graph are rendered in SVG with VML support for legacy browser. You can find more at highcharts.com

Back to the case, now I will show you how to make it work on CodeIgniter without using ajax. I’ll not telling about CodeIgniter instalation and how to setting up the framework. You came here, I think you are not newbies.


Prepare your database, in this case I make dummy database called chart and for atribut and field you can follow my SQL query:


Something importan, you need to download jquery.js and highcharts.js before you run to next step. And after that, places the file to your directory. You can use /assets/js/[there]At the view file, you’ll load the library like this:

The Controller: Chart.php

The Model: Mread.php

The view: report.php

I think enough, happy learning.

Note: Its just notes, some code I have from another resource on internet.