CakePhP3: Any suggestions for creating Line Graphs?

Hi.

Does anybody have any good experiences with creating Line Graphs using relational data in CakePHP?

I’ve used PHPlot without a framework.
http://phplot.sourceforge.net/phplotdocs/

I guess I could just write a custom helper myself?

As always - any feedback grateful received!

Andy

My suggestion is use highcharts:
http://www.highcharts.com/demo/line-basic

Create a cotroller function that return the series data as json and highcharts load that throuth ajax function

If you don’t need to embed the graphs in documents like PDF. I had high success using highcharts, chart.js o morris.js… there are a lot of libraries, but all of them works with json data.

You could implement a controller method returning data in json format or simply, do json_encode in a script tag after formatting the data. I usually grab all the required data from the db and put the transformation login in the view file, so I can transform my entities data to the json format used by the chart library I’m using.

1 Like