graph chart

Vertical Bar Graph Examples

[ Bar Graph Home ] [ Tutorials ] [ Documentation ] [ Getting Started ] [ Solutions ]

Applet Example 6 - Data from Databases

if you do not see the graph below then click here

The configuration data is acquired from the text file ../../../bar_graph/vbargraph/Examples/barprops.txt (click here to view)

The VbarDataScriptDB.php is designed to retrieve product sales data from a MySQL database, from a table with the following structure,

Table Name : SalesBar
ProductName Character
Year Integer
Quarter Integer
Value double


Our PHP script will pick out the sales figures for three products ( ProductX, ProductY and ProductZ) and return the data in the correct format for the graph.

The method is as follows,

  • Set the output characteristics for the return data
  • Establish the database connection
  • Build the query statement and retrieve the database records
  • Process the database records and return the Data
  • All finished so close the database connection

The full script code is contained in the VbarDataScriptDB.php file.
(Click here to view the code).

For a full explanation of and range of values for the above parameters please see the Documentation - Configuration Options».

« back to Examples Index

« back to Getting Started

[ Bar Graph Home ] [ Tutorials ] [ Documentation ] [ Getting Started ] [ Solutions ]

Getting Started




Common Problems
This section describes and provides solutions to common problems.