Usage Note 23176: I would like to create a map that has tool tips and drill-down capabilities. Is there an easy way to do this?
Yes, here is a short sample program that uses the HTML= option on the CHORO statement in the GMAP procedure to create a graph with tool tips and drill-down capabilities using a GIF device driver. In order to run this sample program, you must modify the FILENAME statement to specify the directory location where your HTML file will be stored.
|
filename odsout 'directory location';
data maptips;
length htmlvar $100.;
set maps.us;
/*Create the drilldown information */
drillvar='href="http://www.state.'||
trim(left(lowcase(fipstate(state))))||'.us"';
/*Create tooltips that display when you hover over a state. */
/*These tooltips will only appear when the output is viewed in */
/*Internet Explorer, not Netscape. This is expected behavior. */
/*The 'OD'x hex value creates a line break in the text string */
altvar = 'ALT="State code: ' || trim(left(state)) || '0D'x ||
'State name: ' || trim(left(fipnamel(state))) || '"';
/*Combine the tooltip and drill down into one variable */
htmlvar = drillvar || ' ' || altvar;
run;
ods listing close;
/* Specify the path and filename for the HTML file */
ods html path = odsout
body = 'maptips.html';
/* Reset all of the GOPTIONS to their default values */
/* Set the device driver to GIF and the font to Swiss */
goptions reset = all
device = GIF
ftext = swiss;
title1 h=1.5 'Hover your mouse over a state for more information';
footnote h=1.5 'Click on a state to drilldown to more information';
Pattern1 v=s r=100;
/* Specify the HTMLVAR= option on the CHORO statement */
/* in order to have the tooltips and drilldown capability */
proc gmap data=maptips map=maps.us;
choro state / discrete
nolegend
coutline=black
html = htmlvar;
id state;
run;
quit;
/* Close the HTML file and reopen the default listing */
ODS HTML Close;
ODS Listing;
|
Operating System and Release Information
| SAS System | SAS/GRAPH | All | n/a | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
| Type: | Usage Note |
| Priority: | low |
| Topic: | SAS Reference ==> Procedures ==> GMAP
|
| Date Modified: | 2003-02-26 10:00:01 |
| Date Created: | 2003-02-20 10:27:06 |