SAS.GRAPH 9.1 Reference, Volumes I and II
You can add pop-up data tips to most SAS/GRAPH Web presentations. The text is displayed when the user s cursor is over a specified area of a graph. See the following sections for basic information on adding data tips to Web presentations:
-
Data Tips in GIF, JPEG, and PNG Files on page 568
-
Data Tips in ACTXIMG and JAVAIMG Images on page 568
-
Data Tips in Java and ActiveX Web Presentations on page 568
-
Data Tips in Metaview Applet Presentations on page 569
-
Data Tips in Treeview Diagrams on page 569
-
Data Tips in Constellation Charts on page 569
-
Data Tips in Critical Success Factor Diagrams on page 569
-
Data Tips in Animated GIFs on page 570.
Data Tips in GIF, JPEG, and PNG Files
For Web output that is generated with ODS and the GIF, JPEG, and PNG device drivers, SAS adds default data tips using the values of fields in the SAS data set. Also, if you specify DESCRIPTION= as an option on the SAS/GRAPH procedure, then SAS adds the text of that description as a data tip for the entire graphic. Specify DESCRIPTION="" to suppress this default data tip.
You can also add custom data tips to the output of any SAS/GRAPH procedure that supports the HTML= option. For this technique, see Adding Data Tips with the HTML= Option on page 570.
Data Tips in ACTXIMG and JAVAIMG Images
When you specify DEVICE=ACTIXIMG or JAVAIMG, and use ODS HTML, SAS adds default data tips using the values of fields in the SAS data set. Also, if you specify DESCRIPTION= as an option on the SAS/GRAPH procedure, then SAS adds the text of that description as a data tip for the entire graphic. Specify DESCRIPTION="" to suppress this default data tip.
By using the HTML= option of a GBARLINE, GCHART, GPLOT (except for high-low ), or GRADAR procedure, you can add custom data tips to graphs created with the ACTXIMG device driver. For information, see Adding Data Tips with the HTML= Option on page 570. SAS/GRAPH does not directly support adding custom data tips to Web presentations created with DEVICE=JAVAIMG. You can, however, use any image-map tool available to you to create an image map for the resulting PNG file.
Data Tips in Java and ActiveX Web Presentations
By default, Web presentations created by the ACTIVEX control or JAVA applets automatically include data tips using the values of fields in the SAS data set. Use the TIPS=NONE parameter to suppress data tips. See Parameter Reference for Java and ActiveX on page 424.
You can provide your own custom data tips to the output of any SAS/GRAPH procedure that supports the HTML= option. (This feature is supported by the Map applet but is not currently supported by the Graph applet.) For information on this technique, see Adding Data Tips with the HTML= Option on page 570.
Note: When you provide data-tip text using HTML= ˜ALT=" variable_name " the Java applets automatically suppress the display of the default data tips. The ActiveX Control, however, adds your custom text to the default text. To suppress the default text in ActiveX presentations, use the TipMode=HTML parameter in an ODS statement. See Parameter Reference for Java and ActiveX on page 424.
For example:
ODS HTML parameters=("TipMode"="HTML")
Data Tips in Metaview Applet Presentations
For graphs displayed by the Metaview applet, you can add data tips to the output of any SAS/GRAPH procedure that supports the HTML= option. For more information, see Adding Data Tips with the HTML= Option on page 570.
Data Tips in Treeview Diagrams
You can add data tip text to a Treeview diagram by including the text in the SAS data set from which the Treeview is generated. For example, the following data set specifies a different data-tip for each observation:
data father_and_sons; input id . name . father . datatip .; cards; aaron Aaron Parker Data tip for Aaron Parker... bob Bob Parker aaron Data tip for Bob Parker... charlie Charlie Parker aaron Data tip for Charlie Parker... david David Parker aaron Data tip for David Parker... edward Edward Parker david Data tip for Edward Parker... ; run;
Use the TIPS, NTIP, and NTIPFMT parameters of DS2TREE (see DS2TREE and DS2CONST Arguments for Data Definition on page 537) to control data tip text.
Data Tips in Constellation Charts
You can add data tips to a Constellation diagram by including the text in the SAS data set from which the diagram is generated, as is done for Treeview diagrams as shown in Data Tips in Treeview Diagrams on page 569. Use the TIPS, NTIP, and NTIPFMT parameters of DS2CONT (see DS2TREE and DS2CONST Arguments for Data Definition on page 537) to control data-tip text.
Data Tips in Critical Success Factor Diagrams
The Critical Success Factor macro DS2CSF does not support adding data tips.
Data Tips in Animated GIFs
SAS/GRAPH does not directly support inserting data tips into animated GIFs.
Adding 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. Use the HTML option in the following form:
-
HTML= ALT=" variable_name "
The following code fragment illustrates the basic technique of adding data tips with the HTML= option.
/* initialize a data tip variable in the data set */ length rpt ; /* assign values to the link variable */ if Region='Central' then rpt='alt="Central region"'; else if Region='South' then rpt='alt="Southern region"'; else if Region='West' then rpt='alt="Western region"'; /* create a chart that uses the data tip variable */ proc gchart data=regsales; vbar3d region / sumvar=sales patternid=midpoint html=rpt; run;
In this case, the HTML= option identifies the variable RPT as containing ALT= plus the text of data tip to be displayed. The value of RPT, in turn , is set by an IF statement according to the contents of a SAS data set. The maximum length for the value of the variable is 1024 characters, including the characters "ALT=".
The following code uses a variable inside the HTML= variable to substitute the appropriate text for a data tip. It also uses the concatentation operator to concatenate the string "region" to the name of the region, and the newline character 0D x to create a second output line.
/* initialize a data tip variable in the data set */ length rpt ; /* assign values to the link variable */ rpt='ALT="Region: ' trim(left(Region)) '0D'x 'Second line of text ' '"'; /* create a chart that uses the data tip variable */ proc gchart data=regsales; vbar3d region / sumvar=sales patternid=midpoint html=rpt; run;
For more on the HTML option, see Adding Links with the HTML= and HTML_LEGEND= Options on page 574.