2
$\begingroup$

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]]]
$\endgroup$
2
  • 1
    $\begingroup$ 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 $\endgroup$
    – Yves Klett
    Aug 10, 2013 at 7:47
  • 1
    $\begingroup$ 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!"]}] $\endgroup$ Aug 10, 2013 at 10:11

1 Answer 1

3
$\begingroup$

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"]}]]
$\endgroup$
2
  • $\begingroup$ Or Block[{PopupWindow}, ErrorListPlot[{PopupWindow[{{10, 20}, ErrorBar[5]}, "pop"]}]] $\endgroup$ Aug 10, 2013 at 11:50
  • $\begingroup$ @RolfMertig, that's a good idea, much more obvious what it's doing. $\endgroup$ Aug 10, 2013 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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