02-08-2013 01:02 PM
I have a scatter plot of weight versus height, and mouse-over can show weight and height numbers for each observation, but I'd like to show more than just x and y; I want to see name and age as well.
The code is below. Any help will be greatly appreciated.
ods listing close;
ods html file="c:\temp\pie.html" (title="Weight-Height Scatter Plot")
nogtitle nogfootnote style=statdoc gpath="c:\temp\";
symbol i=none value=plus r=100000;
infile datalines dlm=',';
input name $ Sex $ age height weight;
proc gplot data=test;
plot height * weight;
ods html close;
02-08-2013 01:15 PM
I see you're using device=java ... in SAS/Graph, device=java (or activex) typically show the values being plotted, by default. To have custom chart-tip hover-text, you can put your custom text in a variable in your data set (coded a special way as html title= or alt= tags), and then use the gplot "html=" option to point to that variable.
Also, I usually use device=png (or gif) for custom chart tips. Device=java (or activex) might or might not support the custom text, depending on which version you are using (and possibly depending on exactly how you set up your variable). Too many unknowns for me, so I use png.
Here is a simple example:
And here is the important bit of the code:
data mydata; set mydata;
length htmlvar $500;
proc gplot data=mydata;
plot population*st=1 /
haxis=axis1 vaxis=axis2 vzero
02-22-2013 09:16 AM
Just wondering if you noticed the posting https://communities.sas.com/thread/38666. It shows how you can build on Robert's code in the reply above to include information other than a link in a mouse over.
2 weeks ago
Can the html statement be used with proc sgscatter? I keep trying to add it to my code and I throw an error no matter where I place it. Please advise.
length myhtml $ 250;
if nurse_traffic ~=. then provider_type="Nurse Practitioner";
if physician_traffic ~= . then provider_type= "Physician";
"Provider: "||strip(provider_type)||" "||trim(left(pcp_name))||'0D'X||
"Unique Cases: "||trim(left(unique_cases))||'0D'X||
"Unique Consults: "||trim(left(unique_consults))||'0D'X||
"Total Consults: "||strip(total_consults)||'0D'X||
"Cases Missing Site Detail: "||trim(left(missing_site_ct))
||' '|| 'href="'||"&hardcoded_drilldown"||'"';
title "Utilization and Response Times by Provider Type";
proc sgscatter data=case_provider;
plot (unique_cases provider_type )*avg_response_hours / colorresponse=avg_response_hours
colormodel=(CX3288BD CX99D594 CXE6F598 CXFEE08B CXFC8D59 CXD53E4F);
label unique_cases ="Unique Cases" avg_response_hours= "Average Response Time in Hours"