PHP Charts Wrapper

Add interactive charts to your website using our PHP wrapper.

Most of the PHP charting libraries available in the market use server-side code to generate static images of charts and gauges. But why stick to static images when you can have interactive charts? You can use this PHP Charts plugin along with our core JavaScript library to build interactive charts/graphs for your applications. You can choose from any of the 90+ charts and 1000+ maps and add them to your application using PHP.

Download Wrapper View it on Github


Features

  • The server-side PHP chart wrapper generates the required JavaScript and HTML code as a string, which is then used to render charts on a browser page.
  • Allows you to load data from MySQL database into charts.
  • Multiple ways to add data - JSON and XML.
  • Works seamlessly across PCs (including IE6/7/8), Macs, iPads, iPhones, and Android devices.

Support

Simply open up a github issue with your question/bug report/suggestion.

Along with PHP plugin, you will also need FusionCharts core JavaScript files which you can get from download page. Download FusionCharts JavaScript Files

QuickStart

Step 1: Include FusionChart libraries

In your HTML, include fusioncharts.js and themes/fusioncharts.theme.ocean.js after all other scripts:

<script type="text/javascript" src="/path/to/fusioncharts.js"></script>
<script type="text/javascript" src="/path/to/themes/fusioncharts.theme.ocean.js"></script>

Step 2: Include FusionCharts PHP wrapper in your page

In the page, include fusioncharts.php wrapper.

include("includes/fusioncharts.php");

Step 3: Render the chart by providing required data in constructor parameter

In your code, find the section where you wish to add the chart and provide data to the FusionCharts constructor.

// Syntax for the constructor - new FusionCharts("type of chart", "unique chart id", "width of chart", "height of chart", "div id to render the chart", "type of data", "actual data")
	$columnChart = new FusionCharts("column2d", "ex1" , 600, 400, "chart-1", "json", '{  
		   "chart":{  
			  "caption":"Harry's SuperMart",
			  "subCaption":"Top 5 stores in last month by revenue",
			  "numberPrefix":"$",
			  "theme":"ocean"
		   },
		   "data":[  
			  {  
				 "label":"Bakersfield Central",
				 "value":"880000"
			  },
			  {  
				 "label":"Garden Groove harbour",
				 "value":"730000"
			  },
			  {  
				 "label":"Los Angeles Topanga",
				 "value":"590000"
			  },
			  {  
				 "label":"Compton-Rancho Dom",
				 "value":"520000"
			  },
			  {  
				 "label":"Daly City Serramonte",
				 "value":"330000"
			  }
		   ]
		}');

Step 4: Render FusionCharts

In the previous code, we are populating the FusionCharts constructor with data and chart properties.

It's time to render it.

// Render the chart
$columnChart->render();

And your chart should display when you load the page.


Licensing

PHP-FusionCharts is open-source and distributed under the terms of the MIT/X11 License. You will still need to download and include core FusionCharts library in your page. This PHP charts plugin project provides no direct functionality. Evaluation version can be downloaded from this page. You will need to purchase a FusionCharts license for using it in commercial environment (FusionCharts is free for non-commercial and personal use).