I have a line graph, using proc template and statgraph, and proc sgrender. I've defined a URL variable within the data set and I have the code url=url within my template, which allows the line on the line graph to be a clickable link. Is there anyway to make the background or white space of the graph clickable as well?
The suggestion by others should work. However, if you want to have the entire graph to be clickable (including outside the data area), you could use an annotated transparent rectangle with a URL on the whole graph area.
I've never done this, but it seems like you could use the POLYGONPLOT statement to draw a rectangle that goes from
(min(X), min(Y)) to (max(X), max(Y)). Make the rectangle 100% transparent so it doesn't show up, but use the URL= option to specify the URL.
If you plot the rectangle last within your LAYOUT OVERLAY block, then it should direct all clicks in the plot are to the specified URL. If you plot the rectangle first, then clicks on a line could go to one URL, and clicks that do not touch a line would go elsewhere.
I don't know if you can make the background clickable. But you could probably overlay an invisible / transparent plot on top of it, and define a URL for that. I've overlaid invisibile bar charts for similar reasons.
The suggestion by others should work. However, if you want to have the entire graph to be clickable (including outside the data area), you could use an annotated transparent rectangle with a URL on the whole graph area.
Thank you all for the input. I added this line of code:
drawrectangle x=0 y=0 width=100 height=100 / ANCHOR=BOTTOMLEFT display=all transparency=1 layer=back url="&urlLink";
within my statgraph template and it works perfectly.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.