Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm trying to add popupwindows to tooltips for points on an ErrorListPLot but all the popupwindows appear on screen immediately when I run the command below that plots the graph.

After closing all the popupwindows the tooltips and popupwindows work as intended, so when I hover over the points in the plot I get the right tooltip, and when I click on the points I get the popupwindow. I thought I was missing a semicolon somewhere but I think it is more basic then that.

The tooltips are unique for each point so they are indexed in a loop, but this simplified example illustrates the problem with the popupwindows appearing prior to clicking on the points.

I'm sure there must be an amazingly concise and elegant fix using # & and @ characters amongst others but I am a complete novice in need of enlightenment! Thanks for taking the time to read this.

xyPoints= {{{-152., 1.428}, {-83.9858, 1.88051}, {-84., 
   2.066}, {-133.466, 1.76653}}, {{-152., 1.428}, {-83.9858, 
   1.88051}}, {}, {}, {}, {}, {}, {}, {}, {}}

errorBars= {{ErrorBar[{-86.0233, 86.0233}, {-0.07, 0.07}], 
  ErrorBar[{-70.3562, 70.3562}, {-0.0494975, 0.0494975}], 
  ErrorBar[{-111.803, 111.803}, {-0.1, 0.1}], 
  ErrorBar[{-81.7902, 81.7902}, {-0.0647275, 
    0.0647275}]}, {ErrorBar[{-86.0233, 86.0233}, {-0.07, 0.07}], 
  ErrorBar[{-70.3562, 70.3562}, {-0.0494975, 
    0.0494975}]}, {}, {}, {}, {}, {}, {}, {}, {}}

test = Table[
   Table[{PopupWindow[
      Tooltip[Transpose[{xyPoints[[i]], errorBars[[i]]}][[j]],
       Grid[{{"Tooltip hello"}}, Alignment -> Left, Frame -> All],
       TooltipStyle -> Medium],
      Pane[Grid["Popup hello"], Scrollbars -> True, 
       ImageSize -> {650, 400}], WindowSize -> {700, 450}]
     }, {j, Range[Length[errorBars[[i]]]]}],
   {i, Range[maxSeries]}];

ErrorListPlot[test[[1]]]
share|improve this question
1  
Welcome to Mathematica.SE! Please ensure your code runs properly. Right now maxSeries is not defined. Also take your time to format your question, see: mathematica.stackexchange.com/help/formatting –  Yves Klett Aug 10 '13 at 7:47
1  
It's a good idea to try to strip down your code to a minimal example which displays the problem. In your case most of the data, the styling, and the tooltips can be removed and you still see the popups appearing at evaluation time. For example this code encapsulates the issue: Needs["ErrorBarPlots`"]; ErrorListPlot[{PopupWindow[{{10, 20}, ErrorBar[5]}, "hi!"]}] –  Simon Woods Aug 10 '13 at 10:11

1 Answer 1

up vote 3 down vote accepted

For a workaround you can block PopupWindow (or CreateDocument) until the graphics expression is created:

Needs["ErrorBarPlots`"];

Block[{PopupWindow},
 ErrorListPlot[{PopupWindow[{{10, 20}, ErrorBar[5]}, "pop"]}]]
share|improve this answer
    
Or Block[{PopupWindow}, ErrorListPlot[{PopupWindow[{{10, 20}, ErrorBar[5]}, "pop"]}]] –  Rolf Mertig Aug 10 '13 at 11:50
    
@RolfMertig, that's a good idea, much more obvious what it's doing. –  Simon Woods Aug 10 '13 at 12:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.