Tutorial - Chart

Note: Before reading this tutorial, please read Chart Setup first.

In this tutorial we will show you how to create a chart to present report data in PHP Report Maker. We'll continue to use the Crosstab Report we created in the Crosstab Report tutorial and create a chart to show the total order amount by product category.

 

Steps to Create the Chart

1. Loading PHP Report Maker

Open PHP Report Maker and connect to the demo database.

2. Adding a Chart

To add a chart to a report, click the report in the database pane on the left, the tabbed Field Setup page and Chart Setup Page will show up on the right. Click the [Charts] tab to go the Chart Setup Page.

Click [+] button to add a new chart.

Enter chart name as "Orders By Category".

We want to draw a column chart so we leave the [Type] setting unchanged at the default value - [Column 2D Chart].

Under [Category (X) Axis], select "CategoryName" for the [Field name] setting. Since the category names are a little long, we'd better rotate the category names by 30 degrees, so we enter "30" for the [Category rotation] setting.

Under [Category (Y) Axis], select "Amount" for the [Field name] setting.

Check [Show labels] so we'll see the category names on the X axis.

Check [Show values] so we'll see the amount at the top of each column.

Check [Show hover] so we'll see a hovering box displaying the category name and its amount when we move the mouse over each column.

There are many other advanced chart properties for you to config the chart, click Tools->Advanced Chart Properties to open the setup form:

In this example, we rotate the category names on the X axis so they won't overlap each other.

Note: Read Chart XML API for supported properties of each chart type.

3. PHP Script Generation

Go to the [Generate] tab, click the [Generate] button and PHP Report Maker will generate the required PHP scripts automatically.

4. Running the PHP Application

Click the "Reports" menu button and select "Quarterly Orders by Product" (or select the sub-menu "Orders By Category") to run the report and see the chart.

 

 

 

 

 

 

 ©2007-2011 e.World Technology Ltd. All rights reserved.