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

Support

Sample 26131: Create a dashboard with multiple bar chart 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 bar chart indicators, then uses the GREPLAY procedure to arrange the indicators into a dashboard. This version is intended for use as a webDAV content portlet in SAS Information Delivery Portal software. For a sample of an individual indicator, see Create a bar chart indicator for use in a portlet.

This sample builds on sample Create a bar chart indicator for use in a portlet and places several of these charts on the same page in an arrangement that could be considered a minimal dashboard. It uses the same %DO_CHART macro that was used in the bar chart indicator sample. The %DO_CHART macro is called separately for each graph with a unique GRSEG name. It then uses the GREPLAY procedure to draw the graphs into a custom template to put the graphs on a single page in a specific order and position.

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 custom template:

the layout of the bar chart dashboard

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

Here are the coordinates that place the Revenue chart near the top-left corner of the dashboard in area 1:

   1/llx = 0   lly = 50
     ulx = 0   uly = 73
     urx =20   ury = 73
     lrx =20   lry = 50

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

The GREPLAY procedure allows you to overlap the rectangular areas. In this sample, area 0 is defined as covering the entire dashboard. The GSLIDE procedure is used to place the title near the top-right, and the Annotate facility is used to create a custom legend. Here are the coordinates:

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

The GREPLAY procedure TREPLAY action statement draws the appropriate charts into the desired areas of the custom GREPLAY template as follows:

   treplay
    16:plot16 17:plot17  0:titles
    1:plot1 2:plot2 3:plot3 4:plot4 5:plot5
    6:plot6 7:plot7 8:plot8 9:plot9 10:plot10
    11:plot11 12:plot12 13:plot13 14:plot14 15:plot15

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 PLOT16 is replayed into area 16.

For each chart on the dashboard, this sample adds a drill-down link to a detailed table of the data for the chart. To keep this sample self-contained, the drill-down tables are placed on the same output page just below the dashboard, and each table is identified using an HTML anchor as follows:

ods html anchor="&anchor_name";

However, in your case, these drill-down links would likely be to separate detail tables or charts on a separate page.

In this sample, the anchor names are created when the bar charts are created as follows:

   htmlvar=
   'title='||
    quote(
    'Quarter: '|| trim(left(quarter)) ||'0D'x||
    'Target: '|| trim(left(put(target,&value_format))) ||'0D'x||
    'Actual: '|| trim(left(put(actual,&value_format))) ||'0D'x||
    'Actual as Percent of Target: '|| trim(left(put(percent_of_target,percent6.0)))
     ) || ' '||
   'href="#'||trim(left("&grseg_name"))||'"';

To keep the naming simple and consistent, the GRSEG names are used as the anchor names. While you are viewing the dashboard, if you mouse over each bar, the data value for the bar is displayed in the HTML chart tip. If you click a bar, your browser scrolls down to the HTML anchor to show you the table of the data for the bar.

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.