Charting query results as a pie chart

You can chart your query results as a pie chart by using QMF Analytics for TSO.

About this task

Pie charts depict the size relationship between the parts to the whole.

For example, staying with the foul weather gear sales example, you might want to use a pie chart to illustrate which months are the wettest and use the chart to explain why you want to increase production of foul-weather gear during those months.

In this example you will query climate data for the USA and create a chart using data from the RAINFALL and MONTH columns of the query result.

Procedure

  1. Start QMF for TSO.

    Your QMF administrator can tell you how to start a QMF session and give you a user ID. Check with your QMF administrator if you have any questions about getting started with QMF.

  2. From the QMF Home Panel, enter DISPLAY Q.CLIMATE_USA on the command line and press Enter.

    QMF for TSO displays the query result as a multi-columned report.

    Figure 1. Query Results
    REPORT           Q.CLIMATE_USA    LINE 1      POS 1      79    
                                                                                  
                                                                                  
                                                                                  
            MONTH  STATE      TEMPMIN      TEMPMAX     RAINFALL     SUNSHINE    
      -----------  -------  -----------  -----------  -----------  -----------    
                1  AK                 9           25            1            1    
                1  AL                23           61           11           34    
                1  AR                19           50           12            1    
                1  AZ                12           68            7           80    
                1  CA                19           72           18           41    
                1  CO               -13           50            1           51    
                1  CT                18           39            3            1    
                1  DE                25           37            3           11    
                1  FL                34           70           12           83    
                1  GA                25           55            9           45    
                1  HI                63           82            7          133    
                1  IA                -6           27            4            1    
                1  ID                12           50            4           29    
                1  IL                 9           36            2           10    
                1  IN                 9           32            4            1    
                1  KS                 9           54            3           50    
                1  KY                18           36            6            1    
                1  LA                27           63           10           51    
                1  MA                12           39            5            1    
                1  MD                19           39            9            1    
                1  ME                 5           28            4            1    
                1  MI                 9           34            3            1    
                1  MN                -2           19            3            1    
                1  MO                 9           37           10            1    
                1  MS                28           57            6           44    
                1  MT                 1           39            5            1    
                1  NC                14           50            8           23    
                1  ND                -6           23            3            1    
                1  NE                 3           41            3           10    
                1  NH                10           32            1            1    
                1  NJ                21           41            2           11    
                1  NM                 5           54            4           48    
                1  NV                10           57            2           58    
    1=Help         2=            3=End       4=Print       5=Chart        6=Query 
    7=Backward     8=Forward     9=Form     10=Left       11=Right       12=      
    OK, Q.CLIMATE_USA is displayed.                                               
    COMMAND ===>                                                  SCROLL ===> PAGE
  3. Enter SHOW ANALYTICS on the command line and press Enter to start QMF Analytics for TSO.
  4. Tab to Pie in the Charts section of the QMF Analytics for TSO Home Panel and press Enter.

    The Parameter Selection panel is displayed.

  5. Create the specification for your analysis.
    Set your parameters as shown in the following table.

    You can enter column names manually or you can tab to the field and press the List function key (F4).

    The List function opens a Column Selection window that lists all of the column names from the query result. To select a column from the Column Selection window, tab to the column name and press Enter. QMF Analytics for TSO adds the name to the Parameter Selection panel automatically.

    Table 1. Parameter Settings for Pie chart
    Parameter Setting
    Specify the column to form the accumulated values for each slice (Y) RAINFALL
    Specify a column to determine the sector of each slice (X) MONTH
    Explode Slices? None
    3-D Pie Chart? No
    Chart Title

    Enter a title for your chart in the Chart Title field or accept the default value of asterisk (*).

    If you accept the default value of asterisk (*), QMF Analytics for TSO creates a title based on the columns that you have selected.

    If you delete the asterisk (*) and leave this field blank, the analysis output will not include a title.

  6. Optional: Press the Save function key (F5) to save the specification to the QMF database as an ANALYTIC object.
    Saving the specification to the database allows you to run your analysis directly from the QMF command line at a later time, without having to navigate to the QMF Analytics for TSO Home panel and reenter the parameters. Saving specifications makes sense if you plan on running the analysis frequently or multiple times.
    Note: The global variable DSQEC_SESSGLV_SAV in QMF controls how the autosave for parameter settings works. For information about Global Variables, see Global Variable List in the QMF help.
  7. Press the Run function key (F2) to generate the pie chart.

    QMF Analytics for TSO creates the chart.

    Figure 2. Rainfall by Year Pie Chart
    Pie chart showing rainfall by month data.

    The chart shows that June and July (month 6 and 7) are the rainiest months. To make this even more clear to your audience, you can accentuate the "slice" associated with the rainiest month.

  8. Press the End function key to return to the Parameter Selection panel.
  9. To highlight which month was the rainiest month, set Explode Slices? to Largest by tabbing to Largest and pressing Enter.
  10. To apply a 3-dimensional effect to the chart, set 3-D Pie Chart? to Yes by tabbing to Yes and pressing Enter.
  11. Press the Run function key (F2) to generate an updated version of the pie chart.
    Figure 3. Rainfall by Year Pie Chart with Exploded Slice and 3-Dimensional Format
    Updated pie chart in dimensional format with the largest pie slice exploded out.

    QMF Analytics for TSO creates the new pie chart in 3-dimensional format, highlighting the rainiest month 7 .

  12. Optional: If you have configured print capabilities in QMF, you can print the chart.
  13. Press the End function key (F3) to return to the Parameter Selection panel.
  14. Press the End function key (F3) to return to the QMF Analytics for TSO Home panel.