Service Packs for the SAS9 Platform." />
SUPPORT / SAMPLES & SAS NOTES
 

Support

Sample 26127: Create a dashboard with multiple bullet graph indicators for use in a portlet

DetailsCodeOutputDownloadsAboutRate It

This sample uses the GCHART procedure in conjunction with the Annotate facility in the SAS/GRAPH software to create a series of bullet graph indicators, and then uses the GREPLAY procedure to arrange the indicators into a dashboard. This version is intended for use in a webDAV content portlet in SAS Information Delivery Portal software.

Note: Bullet graphs were invented by dashboard expert Stephen Few and are described in detail in Chapter 6 of Information Dashboard Design (Sebastopol, CA: O'Reilly Media, Inc., 2006).

For a sample of an individual indicator, see Create a bullet graph indicator for use in a portlet.

Five bullet graphs on the same page do not necessarily make up a dashboard, but they are useful building blocks that will be used later in a full-blown dashboard. To use this bullet graph macro, create a SAS data set that contains the following variables:

MYLABEL1
specifies the primary or large midpoint label, which is displayed to the left of the bar.
MYLABEL2
specifies the secondary or smaller midpoint label, which is displayed to the left of the bar.
BLANK
specifies a string of all Bs to reserve space for the labels.
ACTUAL
specifies the value for the dark bar that represents the actual value.
TARGET
specifies the value for the dark line that represents the target value.
RANGE1
specifies the maximum value of the first shaded area behind the bar.
RANGE2
specifies the maximum value of the second shaded area behind the bar.
RANGE3
specifies the maximum value of the third shaded area behind the bar.
VALUE_FORMAT
specifies the format that is to be used for the tick mark values along the axis.
BY_VALUE
specifies the tick mark increment for the values on the axis.

Note: This data set is similar to the data set in the Create a bullet graph indicator for a dashboard sample, except that it does not contain the TITLETEXT and MYLABEL variables, and it adds the MYLABEL1 and MYLABEL2 variables.

For each bullet graph, call the %DO_BULLET macro, passing in as parameters the data set name and the name of the GRSEG in which the graph will be stored temporarily. Here is an example that uses the data set MYDATA and stores the graphic in GRSEG PLOT1:

%do_bullet(mydata,plot1);

The bullet chart is created similarly to the chart in sample Create a single bullet graph indicator for a dashboard, except that the blank character is used as the bar midpoint value in order to reserve space for the labels, and MYLABEL1 and MYLABEL2 are annotated to the left of the bar. The %DO_BULLET macro is called five times, which generates the five bar charts and stores them in GRSEGs PLOT1 through PLOT5. The GREPLAY procedure is then used to replay the five charts into one page using a custom GREPLAY template.

The custom GREPLAY template is defined by specifying four X and Y coordinates for the rectangular area that will hold each graph. The units of the X and Y coordinates are the percentage of the total length of the axis where the coordinate is located, with 0,0 being at the bottom-left corner. Each rectangular area is assigned an ID number. Here is the layout of the GREPLAY template:

Bullet graph dashboard layout

Note: The layout shown is not an exact representation of the areas. Space has been added around the borders of the areas to make the layout more apparent.

Here are the coordinates that place the Revenue bullet graph near the top of the dashboard in area 1:

   1/llx = 0   lly = 68
     ulx = 0   uly = 85
     urx =100  ury = 85
     lrx =100  lry = 68

where LLX is the lower-left X coordinate, LLY is the lower-left Y coordinate, and so on.

Area 0 is defined as the entire screen, and the GSLIDE procedure is used to create a title slide with the overall titles for the entire dashboard. Area 0 is defined in the custom GREPLAY template as follows:

   0/llx = 0   lly =  0
     ulx = 0   uly =100
     urx =100  ury =100
     lrx =100  lry =  0

Here is the GREPLAY procedure TREPLAY action statement that draws the appropriate charts into the desired areas of the custom GREPLAY template:

   treplay
    0:titles
    1:plot1
    2:plot2
    3:plot3
    4:plot4
    5:plot5

Note: For convenience and code readability, spacing is used in the TREPLAY action statement to make the layout correspond to the actual location of the charts in relation to one another.

Notice that the PLOT1 GRSEG is played into area 1.

For additional information about creating dashboard applications with SAS/GRAPH software, see SAS/GRAPH Dashboard Samples.




These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.