Examples

This section shows how to specify the data for several different graphs of the data in the Printer table in the EAS Demo DB. The table records quarterly unit sales of three printers by three sales representatives.

Table 24-7: Q1 and Q4 data from the Printer table in EAS Demo DB

Rep

Quarter

Product

Units

Jones

Q1

Cosmic

5

Perez

Q1

Cosmic

26

Simpson

Q1

Cosmic

33

Jones

Q1

Galactic

2

Perez

Q1

Galactic

1

Simpson

Q1

Galactic

6

Jones

Q1

Stellar

18

Perez

Q1

Stellar

15

Simpson

Q1

Stellar

12

Jones

Q4

Cosmic

52

Perez

Q4

Cosmic

48

Simpson

Q4

Cosmic

60

Jones

Q4

Galactic

3

Perez

Q4

Galactic

6

Simpson

Q4

Galactic

3

Jones

Q4

Stellar

24

Perez

Q4

Stellar

36

Simpson

Q4

Stellar

30

Graphing total sales

To graph total sales of printers in each quarter, retrieve all the columns into a DataWindow object and create a graph with the following settings on the Data page in the Properties view:

Leave the Series check box and text box empty.

The Quarter column serves as the category. Because the Quarter column has four values (Q1, Q2, Q3, and Q4), there will be four categories along the Category axis. Suppose that you want only one series (total sales in each quarter). You can leave the Series box empty or type a string literal to identify the series in a legend. Setting Value to sum(units for graph) graphs total sales in each quarter.

Figure 24-11 shows the resulting column graph. PocketBuilder automatically generates the category text based on the data in the table.

Figure 24-11: Column graph showing printer sales by quarter

The sample graph is titled Sales by Quarter. Four bars represent the Sales in units, which is measured on the value axis, against the four quarters represented on the category axis.

In the preceding graph, there is one set of data points (one series) across four quarters (the category values).

Figure 24-12 is a pie graph, which has exactly the same properties as the column graph above except for the type, which is 3D Pie.

Figure 24-12: 3D Pie graph showing printer sales by quarter

The sample graph is titled Sales by Quarter. Four segments of a three dimensional pie represent the Sales in units, which are measured per quarter as percentages of the total sales.

In pie graphs, categories are shown in the legend.

Graphing unit sales of each printer

To graph total quarterly sales of each printer type, retrieve all the columns into a DataWindow object and create a graph with the following settings on the Data page in the Properties view:

Suppose that you want a different series for each printer, so the column Product can serve as the series. Because the Product column has three values (Cosmic, Galactic, and Stellar), there will be three series in the graph. As in the first example, you want a value for each quarter, so the Quarter column serves as the category, and you want to graph total sales in each quarter, so the Value box is specified as sum(units for graph).

Figure 24-13 shows the resulting graph. PocketBuilder automatically generates the category and series labels based on the data in the table. The series labels display in the graph's legend.

Figure 24-13: Column graph with series data by printer type

The sample graph, titled Sales by Printer, displays three series, Cosmic, Galactic, and Stellar, in the legend at the bottom. Color coded bars are displayed for each quarter to represent sales for each of the three products.

Graphing unit sales by representative

To graph quarterly sales made by each representative, create a graph with the following settings on the Data page in the Properties view:

Figure 24-14 shows the resulting graph.

Figure 24-14: Column graph with series data by sales representative

The sample graph, titled Sales by Representative, displays three series in the legend at the bottom for Jones, Perez, and Simpson. Color coded bars are displayed for each quarter to represent sales for each of the three representatives.

Graphing unit sales by representative and total sales

To graph quarterly sales made by each representative, plus total sales for each printer, create a graph with the following settings on the Data page in the Properties view:

Figure 24-15: Adding two series to a graph

The example shows the Data page in the Properties view, with Rows set to All and Category set to quarter, " Total ". Value is set to the expression: sum ( units for graph ), sum ( units for graph ). The Series check box is selected and Series is set to rep, rep.

Here you have two types of categories: the first is Quarter, which shows quarterly sales, as in the previous graph. You also want a category for total sales. There is no corresponding column in the DataWindow object, so you can simply type the literal “Total” to identify the category. You separate multiple entries with a comma.

For each of these category types, you want to graph the sum of units sold for each representative, so the Value and Series values are repeated.

Figure 24-16 shows the resulting graph.

Figure 24-16: Graph with dual series data for two categories

The sample graph, titled Sales by Representative, displays three series in the legend at the bottom for Jones, Perez, and Simpson. Color coded bars are displayed for each quarter to represent sales for the three representatives. A final category of Total appears on the category axis, with three columns representing the total sales for each representative in all four quarters.

Notice that PocketBuilder uses the literal “Total” supplied in the Category box in the Graph Data window as a value in the Category axis.

Graphing actual and projected sales

To graph total quarterly sales of all printers and projected sales for next year, where you assume that sales will increase by 10% next year, create a graph with the following settings on the Data page in the Properties view:

You are using labels to identify two series, Actual and Projected. Note the single quotation marks around the literals. For Values, you enter the expressions that correspond to Actual and Projected sales. For Actual, you use the same expression as in the examples above, sum(units for graph). For Projected sales, you multiply each unit sale by 1.1 to get the 10 percent increase. Therefore, the second expression is sum(units*1.1 for graph).

Figure 24-17 shows the resulting graph. PocketBuilder uses the literals you typed for the series as the series labels in the legend.

Figure 24-17: Graph with dual series data for a single category

The sample graph is titled Actual and Projected Sales. The legend at bottom displays the series labels Actual and Projected. Two columns are displayed for each quarter, representing actual and projected sales by quarter.