Previous Page | Next Page

Enhancing Web Presentations with Chart Descriptions, Data Tips, and Drill-Down Functionality

Data Tips for Web Presentations


What Is a Data Tip?

A data tip is a data value or detailed information that is displayed as pop-up text when a user positions a mouse pointer over an element in a graph. A data tip typically displays the data value that is represented by a bar, a plot point, or some other data element. Data tips created by default, and custom data tips are supported when using the HTML output destination, in combination with certain device drivers.


Adding Custom Data Tips with the HTML= Option

You can add custom data tips to the output of any SAS/GRAPH procedure that supports the HTML= option. The default device for the HTML destination is PNG, so the output of the following code is an HTML file that references a PNG image file.

To add custom data tips:

  1. Add a data tip variable to the data set. In the example that follows, the data tip variable is named rpt.

  2. Assign data tip values to the data tip variable using the following form:

    'alt="data tip"'

    .

  3. Add HTML=data-tip-variable to your procedure's statement. The example below specifies HTML=RPT .

When the user positions the mouse pointer over a data element, the browser displays the data tip. The following example generates the data tips North Carolina and Massachusets and California and Oregon .

/* Create the temporary data set named sales.  */
data sales;
   length Region $ 4 State $ 2;
   format Sales dollar8.;
   input Region State Sales Year Qtr;
   datalines;
West CA 13636 1999 1
West OR 18988 1999 1
West CA 14523 1999 2
West OR 18988 1999 2
East MA 18038 1999 1
East NC 13611 1999 1
East MA 11084 1999 2
East NC 19660 1999 2
West CA 12536 1998 1
West OR 17888 1998 1
West CA 15623 1998 2
West OR 17963 1998 2
East NC 17638 1998 1
East MA 12811 1998 1
East NC 12184 1998 2
East MA 12760 1998 2
;
/* Use an IF statement to assign values to the variable rpt. */
data;
   set data;
      if state in ("NC" "MA") then RPT="alt='North Carolina and Massachusets'";
      if state in ("CA" "OR") then  RPT="alt='California and Oregon'";
run;

/* Close the LISTING destination to conserve resources. */
/* Open the HTML destination and create the bar chart.  */
/* Add the HTML= option to associate custom data tips   */
/* with each graph element.                             */

goptions reset=all;
ods listing close;
ods html file="datatips.htm";
title "Company Sales, Mid Year";
proc gchart data=sales;
   vbar region / sumvar=sales
      group=year
      html=RPT;
run;
quit;
ods html close;
ods listing;

Bar Chart with Custom Data Tips

[Bar chart with custom data tips]


Data Tips in GIF, JPEG, PNG, JAVAMETA, SVG, SVGT, SVGView, and SVGZ Presentations

For output generated with the GIF, JPEG, PNG, JAVAMETA, and SVG, SVGT, SVGView, and SVGZ device drivers, data tips are not generated by default.

Custom data tips can be implemented for the output of any SAS/GRAPH procedure that supports the HTML= option. For procedures that support the HTML= option, refer to the individual procedure chapter.

For more information, see Adding Custom Data Tips with the HTML= Option.


Data Tips in ACTIVEX, ACTXIMG, JAVA, and JAVAIMG Presentations

For output generated with the ACTIVEX, ACTXIMG, JAVA, and JAVAIMG device drivers, data tips are created by default and are displayed when the mouse pointer is positioned over a graph data element. Use the TIPS=NONE parameter to suppress data tips for ActiveX and Java. For example:

ODS HTML parameters=("Tips"="NONE")

Custom data tips can be implemented for the output of any SAS/GRAPH procedure that supports the HTML= option. For procedures that support the HTML= option, refer to the individual procedure chapter. For more information, see Adding Custom Data Tips with the HTML= Option.

Note:   Terminals set to use 16-bit colors or 32-bit colors are not supported when specifying data tips for output generated using DEVICE=ACTXIMG  [cautionend]

Previous Page | Next Page | Top of Page