Tag Archives: php

PHP Lines graph script

Since I was tired of creating ugly bar graphs I decided to explore an easy way to create a lines graph, mostly inspired by Google Analytics graphs. Ok nothing so advanced but the result is quite nice for my needs.

You can configure the image created by the script using the following parameters:

  • w: width of the graph
  • h: height of the graph
  • points: array of values separated by commas representing the points in the graph
  • labels: array of labels separated by commas to be displayed horizontally
  • rows: number of rows
  • color: the desired color in rgb format, values separated by commas
  • style: 1) bordered circle endpoints 2) filled circles endpoints

Following a couple of examples with parameters used:

graph.php?w=500&h=300&points=9,3,5,2,4,8,5
&labels=mon,tue,wed,thu,fri,sat,sun&rows=4
&color=0,119,204&style=1

Continue reading