Sample 44319: Use PROC GPLOT with the ODS HTML statement and the PNG device driver to create a graph for the Web with tooltips
This sample uses the GPLOT procedure with the PNG device driver and the ODS HTML statement to create graphics output that you can display with a Web browser. When viewing the graph in a Web browser window, additional tooltips are displayed when you hover your mouse over a plot point in the graph.
To do this, the sample code first uses DATA step code to add a new "tooltip" variable to the input data set. The value of this new variable starts with the string "TITLE=" followed by the text that will be displayed when you hover your mouse over a plot point.
The code then uses the HTML=TIPS option in the PLOT statement of GPLOT to enable the tooltips.
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.
This sample writes its output to C:\TEMP when run on a Microsoft Windows operating system. Modify the value for the PATH= option in the ODS HTML statement below if you want to write the output to a location other than C:\TEMP or if you are running on an operating system other than Windows.
/* Add a new variable called Tips to the Sashelp.Class */
/* data set. The value of this new variable starts */
/* with "TITLE=" followed by the information you want */
/* to see in the tooltip. */
data work.class;
set sashelp.class;
length tips $ 100;
tips = 'TITLE="Name: ' || trim(name) || '0D'X ||
'Age: ' || trim(left(age)) || '0D'X ||
'Height: ' || trim(left(height)) || ' in' || '0D'X ||
'Weight: ' || trim(left(weight)) || ' lbs' || '"';
run;
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
goptions device=PNG noaltdesc xpixels=600 ypixels=400;
symbol1 interpol=none value=dot color=CX7C95CA height=1.8;
axis1 minor=none order=(50 to 70 by 5)
label=(angle=90 'Height in inches');
axis2 offset=(3pct,3pct);
ods listing close;
ods html path='c:\temp' (url=none) file='g44319.html';
title1 h=12pt "Hover your mouse over a plot point";
title2 h=12pt "for more detailed information";
footnote1 angle=90 h=3pct ' ';
proc gplot data=work.class;
/* The HTML=TIPS option is used in the */
/* PLOT statement to enable tooltips. */
plot height*name / vaxis=axis1 haxis=axis2 html=tips;
where sex="F";
run;
quit;
ods html close;
ods listing;
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.
This sample uses the GPLOT procedure with the PNG device driver and the ODS HTML statement to create graphics output that you can display with a Web browser.
Date Modified: | 2011-10-18 15:38:51 |
Date Created: | 2011-09-16 14:24:20 |
Operating System and Release Information
SAS System | SAS/GRAPH | z/OS | 9.1 TS1M3 SP4 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Professional | 9.1 TS1M3 SP4 | |
Microsoft Windows NT Workstation | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP Professional | 9.1 TS1M3 SP4 | |
Windows Vista | 9.1 TS1M3 SP4 | |
Windows Vista for x64 | 9.1 TS1M3 SP4 | |
64-bit Enabled AIX | 9.1 TS1M3 SP4 | |
64-bit Enabled HP-UX | 9.1 TS1M3 SP4 | |
64-bit Enabled Solaris | 9.1 TS1M3 SP4 | |
HP-UX IPF | 9.1 TS1M3 SP4 | |
Linux | 9.1 TS1M3 SP4 | |
Linux on Itanium | 9.1 TS1M3 SP4 | |
OpenVMS Alpha | 9.1 TS1M3 SP4 | |
Solaris for x64 | 9.1 TS1M3 SP4 | |
Tru64 UNIX | 9.1 TS1M3 SP4 | |