PHP Chart – Download FREE

Use the drag-and-drop PHP Chart Builder tool to generate the source code for PHP Chart & Graph



PHP Chart

Introduction

PHP Chart Maker is a PHP-based data visualization tool that allows you to generate PHP source code for your chart that can be used in any PHP application. PHP chart maker tool is a browser-based web application built in the most popular and widely used open-source community Apache + PHP + MySQL + Bootstrap 5 and D3.js Charting Engine, and it is designed with drag-and-drop and ease-of-use in mind, as well as being customizable in a variety of ways with no programming skills required.

The ultimate manifestation of the PHP chart maker is that it does not require programming or coding abilities to fetch complex data and present it in a graphical manner. With the latest JQuery and Bootstrap 5 framework, the PHP chart builder generates PHP code that is very adaptive and flexible.


PHP Chart Overview

A very common necessity of a business website is the creation of a chart based on the website's collected data in order to determine various forms of statistical information about the target users and the current status of the business. This information aids in the faster growth of the firm. As a result, the web programmer must learn the fundamentals of chart creation. Client-side scripts and server-side scripts can be used to generate the chart. The developer can choose any type of script based on the needs of the website. There are several benefits and drawbacks of employing server-side and client-side charts. The chart generated by the server-side script creates server overload, slowing down the site.

End users may lose patience if the chart graphics take longer to download. The client-side chart solves the problem of creating a chart on the website. The chart is built locally by a client-side script that retrieves XML data from the server. The chart built by client-side script speeds up the download, and other customized charts, such as applying motion to the chart and making the chart more appealing, can be created. This tutorial will teach you how to make a chart using the server-side PHP library.


PHP Chart

PHP Chart Tutorial

Learn how to produce PHP source code for interactive and dynamic charts

APPLIES TO:    On-premises    Online   Desktop

In this article, we'll use the Dashboard Builder Tool to create a chart and retrieve data from a MySQL database, as well as generate PHP source code.


Requirements

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

Installation

  • Download from Download Dashboard Builder
  • Place the file in a directory on the web server. e.g. …/www/dashboar/dbuilder/
  • Unzip zip filethe file using Extract Here option to the root folder of "dashboardbuilder"

STEP-1: Launch the Dashboard Builder application

Welcome Screen


STEP-2: Access the data


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

Select your Database

  • Enter user name and password of your database.
  • A green tick mark with Database will appear when your database is successfully connected.

Dashboard Preference


STEP-3: Assign data


  • Select the gear icon for your Dashboard preference.

Database Connected

  • The following screen with a list of tables will appear.

Chart Preference

  • Enter your SQL statement in text box,

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
SQL Statement


STEP-4: Select the row and column


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

SQL Query Result

  • Charts will be shown on the screen as below.

Chart Preference screen3


STEP-5: Generate PHP source code for your PHP chart & graph


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


  • The chart's PHP code will be created automatically, and you may copy and paste it into your PHP application.

PHP Chart's source code



/**
 * 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 =  "pie";

$data->source =  "Database"; 
$data->rdbms =  "mysql"; 
$data->servername =  "";
$data->username =  "";
$data->password =  "";
$data->dbname =  "northwind";
$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 = "piechart";
$data->title = "Pie 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>


 


PHP Chart & Graph Example pages

Whether you're looking for inspiration or just want to take a quick look at your clients, a pre-made sample page can get your project started. Creating charts and graphs in PHP applications has never been easier.


PHP Chart Example

Conclusion

You've learned how to create PHP chart and graphs for your PHP application, , and customize it's look and feel using the dashboard builder. Before we go, we'd like to introduce you to the premium version of Dashboard Builder, which has many features compared to the free version.


Download PHP Chart Maker



How helpful was this information?