You are here: PHP Products > ChartBuilder > Creating Charts with ChartBuilder

ChartBuilder for PHP

Step 1: Create a New Chart

Open the index.php file in your ChartBuilder folder.  Select the "New Chart" option from the left hand tree view on screen.

Step 2: Select A Database
ChartBuilder can support multiple databases if you have defined them in the databases.php file.  They will appear in the list to choose from.
Step 3: Select A Data Source
Once you have chosen a database, the tables and views will be displayed in the data source dropdown.
Step 4: Select A Visualization
ChartBuilder supports numerous visualizations, from ordinary column and line charts to org charts, geo-maps, and more.
Step 5: Define Visualization-Specific Options  
Each type of visualization will have unique options available to configure.  For common chart types like bar/column/line charts, here are the key options:
X-Axis
Select a column from your table/view that will be the horizontal X-axis. If your x-axis column is a date type, check the Date Driven box.  If your database column is a date stored as an integer, check the Integer Date box.
Series
You can optionally specify a series by which to group your data.  When you include a series, ChartBuilder will break out your data by each series.  If your data source contains multiple columns that you want to use as series, please refer to this page on how to transform individual columns into a single series column.
Geo Field (geocharts only)

The field that contains geographic data.  Data must follow one of the following:

  • A country name as a string (for example, "England"), or an uppercase ISO-3166-1 alpha-2 code or its English text equivalent (for example, "GB" or "United Kingdom").
  • An uppercase ISO-3166-2 region code name or its English text equivalent (for example, "US-NJ" or "New Jersey").
  • A metropolitan area code. These are three-digit metro codes used to designate various regions; US codes only supported. Note that these are not the same as telephone area codes.
Value
The field that will be used to calculate the value to display in the chart.  For example, Order Amount might be the field, and the operation would then be "sum" or "average."
Operation
Choose the type of operation to aggregate your values.  Options are sum, average, count, maximum, and minimum.
Time Grain (line/bar/column charts)
For date-based graphs, the grain of time to display (day, week, month, year).  Use month (##) to display the numeric representation of the month.
Folder
Optionally specify the name of the folder to store this chart within.  Useful for organizing the tree view of the chart list.

Advanced Options

SQL Criteria
Optionally enver any valid SQL Where criteria (must be MySQL valid) to add to the chart query definition.  Click on the "Helper" option for assistance with constructing your SQL criteria.  Note:  It is not necessary to include "where" in the criteria, it will be added automatically.
Legend
Position of the legend.  Select "None" to hide.
Line Type (line charts only)
Type of line to display (straight, rounded)
Point Shape (line charts only)
Select any special shape for points on the line.
X Axis Title and Font Size (line/column/bar charts only)
The title text and font size for the X axis.
Y Axis Title and Font Size (line/column/bar charts only)
The title text and font size for the Y axis
Format
Optionally enter a valid MySQL number format to display values.  For example, $#,###.  Click on the "Helper" option for assistance with constructing your format criteria.
Drilldown
Optionally choose another chart (or the same chart) that you want to drill down to when the user clicks on a line, bar, or pie segment. Be sure that the chosen drilldown chart has the same column(s) that will be used to drilldown or your user will receive an error message when they click on the drilldown.
Description Text
Optionally provide descriptive text to be displayed at the bottom of the chart to help users understand the content of the chart.

Step 6: Embed Your Chart  
ChartBuilder can support multiple MySQL databases.  Edit the databases.php file stored in the /config folder using the example in the file as a guide.