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

Support

Sample 26124: Create a slider chart indicator 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 single slider chart indicator for use in a dashboard. This version is intended for use in a webDAV content portlet in SAS Information Delivery Portal software. For a sample of a complete dashboard, see Create a dashboard with multiple slider chart indicators for use in a portlet.

In this sample, macro %DO_RANGE is used to create a chart that shows three ranges of data and a triangular marker that points to an actual data value. Each data range is represented by a specific color on the slider scale. The syntax of the %DO_RANGE macro is as follows:

%do_range(pltname,val1,val2,val3,val4,actual,color1,color2,color3,alertColor,valFormat,'titleText');

Here is a description of the macro parameters:

pltname
specifies a name for the plot. The maximum length is eight characters.
val1
specifies the lowest numeric value of the first (lowest) range.
val2
specifies the highest numeric value of the first range.
val3
specifies the lowest numeric value of the third (highest) range.
val4
specifies the highest numeric value of the third range.
actual
specifies the numeric value for the triangular pointer marker.
color1
specifies the color for the lowest range.
color2
specifies the color for the middle range.
color3
specifies the color for the highest range.
altertColor
specifies the alert color. Any range that uses the color &LIGHT_RED is changed to the alert color if the marker value is within that range.
valFormat
specifies the format that is to be apply to the numeric values.
titleText
specifies the text for the title that is to appear above the graph.

For this sample, you do not have to add your data to a SAS data set. Instead, run the %DO_RANGE macro and pass in all of the values as macro parameters. Here is an example:

%do_range(itcost,10000,30000,40000,50000,32000,&light_green,&light_yellow,&light_red,&alert_color,comma8.0,'IT Cost');

Here is the slider chart that this sample generates:

Slider chart with no alert

With this sample program, if the actual value falls within a range that is represented by the &LIGHT_RED color, the color of that range and the pointer is changed to &ALERT_COLOR. For example, if the actual value in the previous sample is changed to 40,458, it generates the following slider chart:

slider chart showing an alert

Notice that the color of the 40,000 to 50,000 range and the pointer is now bright red (&ALERT_COLOR), which indicates an alert condition. Using soft colors for the three ranges and a bright color for the alert color makes an alert condition more apparent to the viewer. This is a good practice, but the implementation in this sample is not ideal. Any one or more of the ranges can be considered an alert range, which might not be the top or bottom range. Also, the GCHART procedure assigns colors indirectly through pattern statements rather than directly through a variable such as an annotated triangular marker.

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.