RGraph - Creating a bar chart using PHP
Here we go, Creating charts using data from MySql using PHP. The charting plugin we going to use rgraph which is an open source and you can download it from here. The rgraph libraries are written wih javascrit and it has made it easy like we just need to populate the values and we get the graph for the data.
Creating a bar graph:
Before we draw the graph we need to create a database and a table in MySQL. You can follow the steps here. Lets get into the important stuff now,
below is the PHP code for the Bar Chart.
Similarly we can create different charts like line, pie, horizontal, etc. These charts proerties can be changed and we can make it even more better. It will appear in default variant if properties not changed.
Different Rgraphs available are,
Creating a bar graph:
Before we draw the graph we need to create a database and a table in MySQL. You can follow the steps here. Lets get into the important stuff now,
- After creating the table, create a new folder in htdocs folder give any name without space.
- Move the libraries folder from the rgraph zip file which you have downloaded from the above link.
- Create a PHP file in the same folder and copy paste the below code.
below is the PHP code for the Bar Chart.
Similarly we can create different charts like line, pie, horizontal, etc. These charts proerties can be changed and we can make it even more better. It will appear in default variant if properties not changed.
Different Rgraphs available are,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subscribe to:
Comments (Atom)
