Time for action — creating a chart using data from array
1. In the root of your web application, create a folder named
Includes
if you do not already have it, and copy the FusionCharts PHP LibraryFusionCharts.php
andDBConn.php
files from FusionCharts download package |Code
|PHP
|Includes
.2. Create a PHP file named
chart_from_array.php
in the root of your application.3. Type the following code in it:
<?php include("/Includes/FusionCharts.php"); ?> <html> <head> <title>FusionCharts - Plotting data from an array</title> <script src="Charts/FusionCharts.js"></script> </head> <body> <?php $productArray = array(); $productArray['2009']['Sales of Food Products'] = 892500; $productArray['2010']['Sales of Food Products'] = 1407400; $productArray['2011']['Sales of Food Products'] = 1565000; $productArray['2009']['Sales of Non-Food Products'] = 595000; $productArray['2010']['Sales of Non-Food Products'] = 693200; $productArray['2011'][...