3
$\begingroup$

When you hover over an event in a TimelinePlot the border around the event thickens and a Tooltip message gives the date. How can I control the format of the change and the message?

What I would like is for the event to grow bigger and the date to be shown in a simple way. I don't want a Tooltip message.

Here is some data and a display to work with.

test = {
   {{1947} -> "Flutter"},
   {{1940} -> "Tacoma Narrows"},
   {{1954} -> "Fatigue (Comet)"},
   {Interval[{{1912}, {2020}}] -> "Electronic Amplifiers"},
   {{1930} -> "Oscilloscope"},
   {Interval[{{1930}, {1985}}] -> "Analogue Testing"},
   {{1945} -> "Accelerometer"},
   {Interval[{{1985}, {2020}}] -> "Digital Testing"},
   {Interval[{{1975}, {2020}}] -> "Digital Signal Processing"},
   {{1965} -> "Fast Fourier Transform"},
   {Interval[{{1990}, {1986}}] -> "Codification of Testing"},
   {{2012} -> "San Onofre Steam Generators"}
   }; 

simulation = {
   {Interval[{{1950}, {1990}}] -> "Main Frames"},
   {Interval[{{1900}, {1970}}] -> "Slide Rules"},
   {Interval[{{1970}, {1980}}] -> "Electronic Calculators"},
   {Interval[{{1985}, {2020}}] -> "Workstations"},
   {{1964} -> "NASTRAN"},
   {Interval[{{1983}, {2020}}] -> "NAFEMS"},
   {{1960} -> "Finite Element Analysis"},
   {{2006} -> "ASME Verification and Validation"}
   };

Framed@Show[TimelinePlot[#1,
     AxesOrigin -> #2, AxesLabel -> {"Year", " "}] & @@@ {{test, 
     Bottom}, {simulation, Top}},
  AspectRatio -> 1/2, BaseStyle -> {FontSize -> 24},
  PlotRange -> All, Frame -> False, Axes -> {True, False}, 
  ImageSize -> 20 72,
  Epilog -> {
    Style[Text["Test", {-1*^8, 26}], FontSize -> 30],
    Style[Text["Analysis", {-1*^8, -18}], FontSize -> 30]}]

Mathematica graphics

$\endgroup$
  • $\begingroup$ do you get what you need if you change the first argument of Show from # to TimelinePlot[Tooltip[#,Row[{DateString[#,{ "Year"}]&/@(#[[1,1]]/. Interval ->Identity),#[[1,2]]}, ":"]]&/@# , AxesOrigin -> #2, AxesLabel -> {"Year", " "}] & @@@ {{test, Bottom}, {simulation, Top}}? $\endgroup$ – kglr Nov 14 '18 at 16:23
  • $\begingroup$ This gives me a good ToolTip message but unfortunately I don't want one! This is for showing to an audience. So I just need the words in the box made bigger and the date added. Is that possible? Thanks for trying. $\endgroup$ – Hugh Nov 14 '18 at 20:40
2
$\begingroup$

Remove tooltips using the option PerformanceGoal ->"Speed" and pre-process the input data to wrap labels with Mouseover:

toMouseover = # /. Rule[a_, b_] :> Rule[a, 
  Mouseover[b, Row[Style[#, Red, 24] & /@ {b, " : ", 
     If[Head[a] === Interval, Flatten @@ a, ## & @@ a]}]]] &;

Style[Framed@Show[TimelinePlot[toMouseover@#, AxesOrigin->#2, AxesLabel -> {"Year", " "},
       PerformanceGoal -> "Speed"] & @@@ {{test, Bottom}, {simulation, Top}}, 
   AspectRatio -> 1/2, 
   BaseStyle -> {FontSize -> 16}, PlotRange -> All, Frame -> False, 
   Axes -> {True, False}, ImageSize -> 20 72, 
   Epilog -> {Style[Text["Test", {-1*^8, 26}], FontSize -> 30], 
     Style[Text["Analysis", {-1*^8, -18}], FontSize -> 30]}], 
 Magnification -> 2/3]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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