Chart Builder - your PHP MySQL chart generator tool

Visualize your data with this great PHP MySQL Chart Builder.

CHART BUILDER is a front-end charting powerful tool that visualizes your data and builds beautiful Charts without writing a code. Chart Builder has a powerful PHP MySQL chart generator tool with auto-generated SQL queries. In addition, it allows you to write your custom SQL queries to put your data to start bringing your data to life. Not only this, Chart Builder also allows you to retrieve data from MS Excel and CSV files.

Chart Builder supports a variety of different charts and can be used to create either static or real-time chart with data coming from a variety of sources such as MySQL, MS SQL, SQLite, ORACLE, PostgreSQL, Sybase and Cubrid with no programming skills. A part of the community, This Chart Builder is designed to integrate with a PHP application you may already be using.

Rather than fiddling around with various settings, Chart Builder has simple drag-and-drop UI, which allows you to reposition and resize your chart with ease.

Chart Builder generates PHP code in just one click for your application and embeds the code anywhere in your application you want.

How to create line chart in PHP and MySQL?

To get started to connect to the MySQL database and retrieve the data for our PHP charts and graphs open source tool, we need to just take a look and make sure that our Web Server (like Apache, Nginx, etc) is configured to display its folder which will contain the dashboard. Read-Write permission to the folders and sub-folders of dashboardbuilder i.e chmod -R 777 dashbboardbuilder-v3-FREE. Just check your browser inspector/console to make sure that there isn't any error being reported, and all the Chart Builder tool files are being loaded properly.

 

Requirements

  • PHP Version 5.6 or later
  • Apache 2 or later
  • Windows 7 or later /Linux 3 or later
  • Firefox 52, Chrome 57, IE 8

 

Installation

 

Build your first PHP Chart

 

 

 

  • Now Click the Database icon
  • Following screen will appear. Select Database from data source tab. Select SQLite from the drop down list of Database, Enter your "../data/Northwind.db" in the DB name field and Save changes    as mentioned in the screen.

 

 

 

  • A green tick mark with Database  will appear when your database is successfully connected.

 

 

  • Select the gear icon for your Dashboard preference.

 

 

  • The following screen will appear. List of the tables will appear.

 

 

  • Enter your SQL statement in text box, SQL field as the following manner

SELECT strftime('%Y-%m',o.shippeddate) as xaxis, sum(d.quantity) as yaxis from `order details` d, orders o where o.orderid = d.orderid group by strftime('%Y-%m',o.orderdate) limit 50

  • Click the Run Query button

 

  • Query Result will appear. Now Select your x-axis data from the drop down list of   and y-axis data from the drop down list of Y .
  • Click Save Changes

 

 

  • Charts will be appeared on the screen as shown below.

 

 

  • Now extend the Generate button and click on the PHP Code

 

 

  • PHP code for the chart will automatically generate, you may copy past this code to your PHP application.

 

PHP charts open source code

Following is source code of auto-generated by the PHP chart open source tool. You can copy & paste the following PHP scripts in your web application.


/**
 * DashboardBuilder
 *
 * @author Diginix Technologies www.diginixtech.com
 * Support  - http://www.dashboardbuilder.net
 * @copyright (C) 2018 Dashboardbuilder.net
 * @version 2.1.7
 * @license: license.txt
 */

include("inc/dashboard_dist.php");  // copy this file to inc folder 


// for chart #1
$data = new dashboardbuilder(); 
$data->type =  "line";

$data->source =  "Database"; 
$data->rdbms =  "sqlite"; 
$data->servername =  "";
$data->username =  "";
$data->password =  "";
$data->dbname =  "data\Northwind.db";
$data->xaxisSQL[0]=  "SELECT strftime(^%Y-%m^,o.shippeddate) as xaxis, sum(d.quantity) as yaxis from `order details` d, orders o  where o.orderid = d.orderid group by strftime(^%Y-%m^,o.orderdate) limit 50";
$data->xaxisCol[0]=  "xaxis";
$data->yaxisSQL[0]=  "SELECT strftime(^%Y-%m^,o.shippeddate) as xaxis, sum(d.quantity) as yaxis from `order details` d, orders o  where o.orderid = d.orderid group by strftime(^%Y-%m^,o.orderdate) limit 50";
$data->yaxisCol[0]=  "yaxis";
$data->name = "linechart";
$data->title = "Line Chart";
$data->orientation = "";
$data->xaxistitle = "x-axis title";
$data->yaxistitle = "y-axis title";
$result[0] = $data->result();

?>

<!DOCTYPE html>
<html> 
<head> 
	<script src="assets/js/dashboard.min.js"></script> <!-- copy this file to assets/js folder --> 
	<!--<link rel="stylesheet" href="assets/css/bootstrap.min.css"> Bootstrap CSS file, change the path accordingly --> 


</head>
<body> 

<div class="container">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading"></div>
    <div class="panel-body">
        <?php echo $result[0];?>
    </div>
</div>
</div>
</div>
</body>


 

 

The project also offers free and paid plans. The code for Dashboard Builder can be found on GitHub under this license

Conclusion

In this chart builder example of PHP code for PHP charts open source application, we have seen how to create dynamic chart using PHP chart builder without programming. This project also offers free MySQL Chart Builder and paid plans. You can also find Dashboard Chart Builder version. This php charts and graphs open source can also be found on GitHub under this license for Open Source Community.


If you want to take a look at our complete PHP MySQL chart generator documentation and video tours of the latest version along with a live tour of user interface and step by step instructions for performing key features.


Download Chart Builder