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.