Documentation

How to create a Pie chart in PHP and retrieve data from MySQL

Before we begin, it is important to understand what a pie chart is.


What is a Pie chart?

A Pie chart is a circular chart divided in sectors. Each sector denotes a relative size of each value. The easiest way to generate a Pie chart is through Dashboard Builder which does not require any programming skills. The following is a step-by-step method on producing PHP code for a Pie chart.

PHP Pie Char

Pie Chart Tutorial

In this article, we'll use the Dashboard Builder Tool to create a Pie 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"

Create your first PHP Pie Chart

Welcome Screen

  • 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

  • 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

  • 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

  • Now extend the Generate button and click on the Pie chart PHP Source Code


Chart Preference screen9c

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

Pie Chart PHP 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>


 

 

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


How helpful was this information?




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?




How to build a PHP Line chart

Create your first PHP Line chart using Dashboard Builder

PHP Line Chart

Dashboard Builder is the most user-friendly way to create a Line chart in PHP without any coding knowledge.It's a chart that shows data as a series of data points connected by straight line segments. To create a Line chart in PHP, follow the steps below.

 

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

 

Create your first Dashboard

 

 

Welcome Screen

 

  • Now Click the Database icon
  • The screen below will appear. Choose Database from the data source tab. Select SQLite from the Database drop down list, enter "../data/Northwind.db" in the DB name field, and save changes as shown in the screen below.

 

Select your Database

 

 

  • When your database is successfully connected, a green tick mark with a Database icon will appear.

 

Dashboard Preference

 

  • Click the chart setting button.

 

Database Connected

 

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

 

Chart Preference

 

  • In the text box, type your SQL statement.

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

 

  • The query result will be displayed. Now choose your x-axis data from the X drop down list and your y-axis data from the Y drop down list.
  • Choose Line chart from the type drop down menu.
  • Click the Save Changes button.

 

SQL Query Result

 

  • The chart will be displayed.

 

Chart Preference

 

  • Now, expand the Generate button and select PHP Code. The PHP code for the chart will be generated automatically; you can copy and paste this code into your PHP application.

 

Chart Preference screen9c

 

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

 

PHP 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 =  "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 provides both free and paid plans. The Dashboard Builder code is available on GitHub under this license.


How helpful was this information?




Google dashboard - Download FREE


Leveraging the Power of Google Dashboard: Parsing and Visualizing Data in Google Sheets in minutes with this fantastic FREE visualization tool


Google Dashboard by the Dashboard Builder is a powerful tool that allows you to parse data from Google Sheets and create insightful visualizations. Google dashboard gives you a left - wing and right view of your entire Google Sheet and assists you in making future decisions based on the data in your Google Drive. Google dashboard serves multiple functions and are extremely versatile.

In this article, we will explore the features and capabilities of Google Dashboard, walk you through the process of parsing data from Google Sheets, and provide examples of how to visualize that data effectively.


Google Dashboard


Google Dashboard Overview

Google Dashboards are made up of graphs and charts that help the viewer understand the data and how it is represented. This data can also be displayed in a graph, chart, or dashboard, which usually have a lot of chart type to help define the data.


What is a Google dashboard?

A Google dashboard is any method of showing data from Google Drive, specifically Google Sheets, in a useful way. It's not a specific piece of data, but rather a framework into which you can quickly import data from Google Drive and make it more understandable. We'll go over how to use the dashboard builder to create dashboards.


Understanding Google Dashboard

Google Dashboard is a data visualization and reporting tool offered by the Dashboard Builder. It is a part of the Dashboard Visualization ecosystem, making it easily accessible for both personal and business use. With Google Dashboard, users can create interactive and informative dashboards, displaying data from Google Sheets


What is a Google Data Dashboard

Exploring Google Data Dashboards for Dynamic Data Analysis

A Google Data Dashboard is a dynamic and versatile tool designed to parse, analyze, and visualize data sourced from Google Sheets. By leveraging the power of Google Dashboard by the Dashboard Builder, users can seamlessly transform raw data stored in Google Drive into actionable insights. These dashboards are not merely static displays but interactive platforms that offer a comprehensive view of data, enabling users to make informed decisions swiftly. With features like parsing data, visualizing trends, and creating various chart types, Google Data Dashboards provide a holistic understanding of datasets, whether for personal metrics tracking, business analytics, or any other purpose. Through intuitive interfaces and step-by-step guidance, Google Data Dashboards empower users to unlock the potential of their data, fostering a culture of data-driven decision-making.


Is Google Dashboard FREE?

Use interactive dashboards and engaging reports to unlock the value of your data and inspire better business decisions. It's simple and free.


How to Create a Dashboard in Google Sheets

APPLIES TO:    On-premises    Online   Desktop

The simplest way to create a usable dashboard is to keep all of the raw and parsed data on one spreadsheet sheet and all of the visual data on the first. If you wanted to, you could have numerous sheets of graphic, processed, or raw data.

There are three essential stages to do, when creating a dashboard in Google Sheets, Importing or gathering data:

  • Launch the tool
  • Parsing data
  • Visualizing data

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 tool

Welcome Screen


STEP-2: Parsing data


Before going to the next step, make sure that your Google sheet is published to the web:

Step-1: Go to your My Driver folder and right click on the spreadsheet you want to access. Click File and click "Publish to the web" .

Publish to the web

Step-2: Select your desired Sheet and "Comma-separated values (csv)" from the dropdown.

Publish to the web screen2

  • Hit the publish button.

Step-3: Copy the link on the following screen.

Publish to the web screen3


Connecting Google Shee with the Dashboard Builder

Step-1: Click the Database icon

PHP Dashboard welcome screen

Step-2: Now, paste the link of your Google sheet.

Publish to the web screen4


STEP-3: Visualizing data


  • 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

 


How do I access my Google Dashboard

Accessing your Google Dashboard is a straightforward process that begins with launching the Dashboard Builder tool. First, ensure that you have the necessary permissions and access to your Google Sheets data. Then, follow the steps to install the Dashboard Builder tool on your web server.

  • Once installed, you can access the tool through your web browser by navigating to the designated web folder, typically indicated by a URL like http://localhost/dashboardbuilder.
  • Upon accessing the tool, you'll be greeted with a welcome screen, prompting you to proceed with parsing and visualizing your data.
  • To begin, ensure that your Google Sheets data is published to the web and obtain the necessary link.
  • Then, within the Dashboard Builder tool, paste this link to connect your Google Sheets data.
  • From there, you can proceed to parse the data and visualize it using various chart types available in the tool.

By following these steps, you can easily access and utilize your Google Dashboard to gain insights from your data.


Google Dashboard Example

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 Google sheet has never been easier.


Google Dashboard Example


Conclusion

Google Dashboard is a versatile tool that allows you to harness the data stored in Google Sheets and turn it into actionable insights. Whether you want to create business dashboards, track personal metrics, or visualize data for any other purpose, Google Dashboard by the Dashboard Builder simplifies the process and provides a user-friendly interface for designing and sharing your dashboards.

By understanding how to parse data from Google Sheets and create meaningful visualizations, you can unlock the potential of your data and make informed decisions. So, start exploring Google Dashboard by the Dashboard Builder today and unlock the power of data visualization with ease.


Download Google Dashboard Maker



How helpful was this information?




How to build a PHP Donut chart

Create your first PHP Donut chart with Dashboard Builder

PHP Donut Chart

A donut chart is essentially a Pie Chart with the centre area removed.The Dashboard Builder, which does not require any programming skills, is the simplest way to create a Donut chart in PHP. The following is how to generate PHP code for a Donut chart using the Dashboard Builder.

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

Create your first Dashboard

Welcome Screen

  • Now Click the Database icon

  • The screen below will appear. Choose Database from the data source tab. Select SQLite from the Database drop down list, enter "../data/Northwind.db" in the DB name field, and save changes as shown in the screen below.

Select your Database

  • When your database is successfully connected, a green tick mark with a Database icon will appear.

Dashboard Preference

  • Select the gear icon for your Dashboard preference.

Database Connected

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

Chart Preference

  • In the text box, type your SQL statement.

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

  • The query result will be displayed. Now choose your x-axis data from the X drop down list and your y-axis data from the Y drop down list.
  • Choose Line chart from the type drop down menu.
  • Click the Save Changes button.

SQL Query Result

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

Chart Preference

  • Now, expand the Generate button and select PHP Code. The PHP code for the chart will be generated automatically; you can copy and paste this code into your PHP application.

Chart Preference

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

 

PHP 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 =  "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 provides both free and paid plans. The Dashboard Builder code is available on GitHub under this license.


How helpful was this information?