BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
spirto
Quartz | Level 8

Hello I am using HTML5 destination so I can use SVG for all my output graphics. However regardless if I try to copy it or save the graphic, it always includes the that mouse-over text "Box Plot...".

 

How do I go about turning off this text?

 

Thank you

 

2024-08-08_16-45-28.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
spirto
Quartz | Level 8

@DanH_sas Thanks for the Javascript clue! That led me to determine the root cause of the behavior.

 

Turns out the pop-up text is driven by two embedded Javascript addEventListener methods (within the SVG code itself) that create and hide the tooltip. Here are the methods below. You can see there is one when you move the mouse into the SVG ('mousemove') and one when you 'mouseout' of the SVG. In return these two methods execute the ShowTooltip and HideTooltip functions when the respective events occur. 

 

SVG_IDX2_SVGRoot.addEventListener('mousemove', SVG_IDX2_ShowTooltip, false);
SVG_IDX2_SVGRoot.addEventListener('mouseout', SVG_IDX2_HideTooltip, false);

To prevent the tooltip from showing up when right clicking to copying the image all one needs to do is add a single line of code to add an additional listener method that listens for the 'contextmenu' event. When you right click to bring up the contextmenu, the method will execute the HideTooltip function and Voilà the pop up disappears. 

 

SVG_IDX2_SVGRoot.addEventListener('contextmenu', SVG_IDX2_HideTooltip, false);

Doing everything this way allows you to have your cake (display the pop-up) and eat it (temporarily hide it when copying) too.

 

@Rick_SAS  @DanH_sas - Curious if this is something we can pass along to the SAS ODS developers. They may be interested in making a HotFix. I have no idea how to contact SAS and make this suggestion. 

 

Lastly thank you to all who took this journey with us. Definitely a rabbit hole!

 

View solution in original post

21 REPLIES 21
ballardw
Super User

Can you share the code including the ODS HTML5 statement used to create the output?

 

If this is the output from one of the statistical procedures we may have to modify the graph template the procedure uses.

spirto
Quartz | Level 8

@ballardw You are correct. This is output from the NPAR1WAY procedure. This is the code I am using

 

proc npar1way data=mydata wilcoxon;
   class mygrp;
   var X;
run;

 

Ksharp
Super User

Or just overwrite the SVG file to eliminate  mouse-over text, since SVG file is just a simple text file.

 



ods listing gpath='c:\temp' ;
ods graphics/ reset=all imagename='x' imagefmt=svg;

proc npar1way data=sashelp.class wilcoxon ;
   class sex;
   var weight;
run;


data _null_;
infile "c:\temp\x1.svg";
file  "c:\temp\want.svg";
input;
if _infile_=:'<desc' then delete;
put _infile_;
run;
Rick_SAS
SAS Super FREQ

Can you explain more about what you see? Is the text permanently there, or does it appear only when you put a mouse pointer into the window?

 

If the text "pops up" when your mouse enters the window, I suspect the issue is that you have the IMAGEMAP=ON option set on the ODS GRAPHICS statement. The IMAGEMAP=ON option displays "tooltips" or "hover text" in a graph.

 

To see the state of your ODS GRAPHICS options, run the following statement:

 

ods graphics / show;

Now look in the log. Among the options, I suspect you will see ON next to the IMAGEMAP option:

 

Output format: STATIC
By line:    NOBYLINE
Antialias: ON
Border:    ON
Image map: ON
Scale:     ON

 

To turn off the option, submit the following at the top of your program (and make sure it isn't being set elsewhere):

ods graphics / imagemap=off;

Now resubmit your PROC statement and let us know if that fixes the problem.

 

d0gord02
Calcite | Level 5

it only shows up with mouse-over. turning imagemap off does not fix the issue. I've tried several other things to no avail such as device=SVGnotip but the tooltip is very persistent.

 

I found that right-clicking the graph and inspecting it reveals the information below. Based on this code, any other ideas how to disable the tooltips with html5 using svg?

 

function SVG_IDX_HideTooltip( evt )
{
SVG_IDX_tiptspan.firstChild.nodeValue = null;
SVG_IDX_singleTip.setAttributeNS(null, 'visibility', 'hidden');
}
function SVG_IDX_ShowTooltip( evt )
{
SVG_IDX_GetTrueCoords( evt );
var targetElement = evt.target;
var tspanCount = targetElement.getElementsByTagName('desc').length;
if (tspanCount == 1) {
var targetTspan = targetElement.getElementsByTagName('desc').item(0);
if ( targetTspan) {
if (targetTspan.firstChild != null)
SVG_IDX_tiptspan.firstChild.nodeValue = targetTspan.firstChild.nodeValue; }
}
if ( '' != SVG_IDX_tiptspan.firstChild.nodeValue )
{
var outline = SVG_IDX_singleText.getBBox();
SVG_IDX_singleBox.setAttributeNS(null, 'transform', 'scale(' + SVG_IDX_attrScale + ',' + SVG_IDX_attrScale + ')' );
SVG_IDX_singleText.setAttributeNS(null, 'transform', 'scale(' + SVG_IDX_attrScale + ',' + SVG_IDX_attrScale + ')' );
SVG_IDX_singleTip.setAttributeNS(null, 'visibility', 'visible');
if (evt.clientX + ((outline.width + 8)/0.8) * SVG_IDX_attrScale > SVG_IDX_rightEdge) {
var xPos = SVG_IDX_TrueCoords.x - parseInt((outline.width + 8)*SVG_IDX_attrScale);
if (xPos < 0)
xPos = 0;
}
else
var xPos = SVG_IDX_TrueCoords.x;
if (SVG_IDX_TrueCoords.y < 16) {
var yPos = SVG_IDX_TrueCoords.y + ((outline.height + 16)/0.8)*SVG_IDX_attrScale;
if (yPos > windowHeight)
yPos = SVG_IDX_TrueCoords.y - parseInt((outline.height + 8)*SVG_IDX_attrScale);
}
else
var yPos = SVG_IDX_TrueCoords.y - parseInt((outline.height + 8)*SVG_IDX_attrScale);
if (Number(outline.width == 0))
SVG_IDX_singleBox.setAttributeNS(null, 'width', outline.width);
else
SVG_IDX_singleBox.setAttributeNS(null, 'width', outline.width + 8);
SVG_IDX_singleBox.setAttributeNS(null, 'height', outline.height + 8);
SVG_IDX_singleTip.setAttributeNS(null, 'transform', 'translate(' + xPos + ',' + yPos + ')');
}
}
</script>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" baseProfile="full" version="1.1" id="SVG_IDX" onload='SVG_IDX_Init("SVG_IDX")' viewBox="-1 -1 641 481" height="480" width="640">
<title>Most Recent Ostomy Surgery Date;</title>
<desc id="desc_SVG_IDX">The SGPlot Procedure</desc>

Rick_SAS
SAS Super FREQ

> turning imagemap off does not fix the issue.

 

Interesting. Please run the following code and tell me whether you see the mouse-over text. Also use the Insert Code icon (looks like </>) to insert the complete log.

 

ods graphics / imagemap=off outputfmt=svg;

proc npar1way data=sashelp.cars wilcoxon ;
class Origin;
var weight;
run;

ods graphics / show;
d0gord02
Calcite | Level 5

Yes, the mouse over text still persists even with that code. Here is what I submitted and the result.

17   ods graphics / imagemap=off outputfmt=svg;
18
19   proc npar1way data=sashelp.cars wilcoxon ;
20   class Origin;
21   var weight;
22   run;

NOTE: PROCEDURE NPAR1WAY used (Total process time):
      real time           0.96 seconds
      cpu time            0.62 seconds


23
24   ods graphics / show;

ODS Graphics Settings
---------------------
Output format:                     SVG
By line:                           NOBYLINE
Antialias:                         ON
Image map:                         OFF
Maximum Loess observations:        5000
Maximum stack depth:               1024
Stack depth:                       0
MaxObs:                            2000000
Maximum Histogram Bins:            10000
Maximum Heatmap Bins:              100000
Maximum Obs for Patterned Lines:   10000
Maximum Total Cells per BY-group:  2000

d0gord02_0-1723234095460.png

 

Rick_SAS
SAS Super FREQ

Strange. I don't understand how that is possible. Calling @DanH_sas .

 

I don't have any more ideas, but out of curiosity, how are you submitting this code? SAS Studio? Enterprise Guide? And what version of SAS are you running?

d0gord02
Calcite | Level 5

Pretty standard SAS 9.4 desktop software setup. My colleague (and OP) @spirto is having the same issue as I am. 

d0gord02_0-1723236547812.png

 

I should note that we changed the default html version from html4 to html5 using the registry editor. not sure if that has something to do with it.

d0gord02_1-1723236560173.png

 

 

spirto
Quartz | Level 8
Thanks Rick for the help so far! We are running SAS 9.4M7 via the Windowing Environment and ODS HTML5 destination
Tom
Super User Tom
Super User

That code produces the flyover text.  In SAS/Studio view of the HTML output it is not visible.  But if I open the generated HTML file in Chrome then it is.

 

I was able to find the file, tkmgr039en.so,  in the SASEXE directory that contains that text (and other strings).

 76         data _null_;
 77           infile sasexe('tkmgr039en.so') recfm=f lrecl=512;
 78           input;
 79           if index(_infile_,'Box Plot of Wilcoxon Scores for') ;
 80           list;
 81         run;
 
 NOTE: The infile library SASEXE is:
       (system-specific pathname), 
       (system-specific file attributes)
 
 NOTE: The infile SASEXE('tkmgr039en.so') is:
       (system-specific pathname), 
       (system-specific file attributes)
 
 RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                                        
 
 1611CHAR   Plot...Median Box Plot.Van der Waerden Box Plot....Savage Box Plot.Data Scores Box Plot....Siegel-T
     ZONE  2566700046666624672566705662667256676662467256670000567666246725667046762566767246725667000056666625
     NUMR  00CF4000D5491E02F800CF4061E04520715245E02F800CF4000031617502F800CF404141033F25302F800CF4000039575CD4
 
      101  ukey Box Plot...Ansari-Bradley Box Plot.Klotz Box Plot..Mood Box Plot...Conover Box Plot....EDF Plot
     ZONE  7667246725667000467676247666672467256670466772467256670046662467256670004666767246725667000044425667
     NUMR  5B5902F800CF40001E3129D2214C5902F800CF40BCF4A02F800CF400DFF402F800CF40003FEF65202F800CF4000054600CF4
 
      201  ....Cumulative Proportion...Median Plot.Group Legend....Not Above the Median....Cumulative Frequency
     ZONE  0000476766767625767677666000466666256670476772466666000046724667627662466666000047676676762476776667
     NUMR  000035D5C14965002F0F249FE000D5491E00CF4072F500C575E40000EF4012F6504850D5491E000035D5C149650625155E39
 
      301  ....Median Plot for %*s Classified by %*s...Empirical Distribution Function Plot for %*s Classified 
     ZONE  0000466666256672667222724667766666267222700046767666624677766776662476676662566726672227246677666662
     NUMR  0000D5491E00CF406F205A303C1339695402905A30005D092931C04934292549FE065E349FE00CF406F205A303C133969540
 
      401  by %*s..Box Plot of %*s Classified by %*s...Box Plot of Wilcoxon Scores for %*s Classified by %*s...
     ZONE  6722270046725667266222724667766666267222700046725667266256666766256676726672227246677666662672227000
     NUMR  2905A3002F800CF40F605A303C1339695402905A30002F800CF40F6079C3F8FE033F25306F205A303C1339695402905A3000
      501  Box Plot of 
 NOTE: 5635 records were read from the infile (system-specific pathname).
 NOTE: 5635 records were read from the infile (system-specific pathname).
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
d0gord02
Calcite | Level 5

Is there any way to turn off the flyover / tooltip text or no?

 

If not, it seems like a big limitation to being able to copy and paste an image from SAS output using html5 w/ svg.

spirto
Quartz | Level 8

@Rick_SAS @Tom thanks for the insights so far and @d0gord02 for digging into this.   @DanH_sas The following code will reproduce the issue

 

ods html close;
ods html5 path="C:\mypath"(url=none) file="sas.html" options(svg_mode='embed');
proc npar1way data=sashelp.cars wilcoxon;
class origin;
var weight;
run;
ods html5 close;

The popup text is happening when viewing the HTML5 output with the internal browser of the Results Viewer in Windowing Environment. When I right click the image to either "copy" or "save picture as" it also copies the popup text. Interestingly the popup text seems to have a mind of its own in that, at times it will disappear when I right click, at other times it will persist.

 

Looking at the SVG source code, the popup text is captured in the following line

<desc id="desc_SVG_IDX2">Box Plot of Wilcoxon Scores for Weight Classified by Origin</desc>
<desc>Box Plot of Wilcoxon Scores for Weight Classified by Origin</desc>

 

As a fallback, by embedding the SVG [via options(svg_mode="embed")] I am able to get at the individual SVG file and use it as needed without the popup text issue but it would be so much easier and faster to just be able to copy the SVG from the Results Viewer. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 21 replies
  • 1631 views
  • 0 likes
  • 7 in conversation