2
$\begingroup$

Last year (in V10.x) I created a DateListPlot of commodity price data. I used Tooltip to display the date and the data value from a date list. I upgraded to V11 and everything was fine. The tooltips would render properly like this: {Fri 17 Feb 2017, 1.58}

But after I upgraded to 11.1 the tooltips now render in scientific notation, like this (same date): {3.69628 x 109, 1.58}

Here's the DateListPlot:

pListCurrYr = {{{2017, 1, 3, 0, 0, 0.}, 1.67}
, {{2017, 1, 4, 0, 0, 0.}, 1.66}, ...}; (* 3 mos. of data *)

DateListPlot[
 Tooltip[pListCurrYr]
 , PlotTheme -> "Classic"
 , AspectRatio -> 0.8
 , PlotLabel -> Style[
   Framed[
    "CME Block Cheese Prices from "
     <> DateString[
      pListCurrYr[[1, 1]], {"MonthName", " ", "DayShort"}] <> " to "
     <> DateString[
      pListCurrYr[[Length[pListCurrYr], 1]], {"MonthName", " ", 
       "DayShort", ", ", "Year"}]
    ]
   , "Subsection"
   ]
 , Filling -> Bottom
 , PlotMarkers -> {\[FilledDiamond], 18}
 , PlotRange -> {Full, {1.00, 2.00}}
 ]

I've tried to use DateString objects instead of Date objects in pListCurrYr, but Tooltip still interprets them in scientific notation.

Could you please show me what I'm doing wrong?

$\endgroup$

1 Answer 1

4
$\begingroup$

Try this

DateListPlot[
 Tooltip[#, {DateString[#[[1]],
      {"Month", "/", "Day", "/", "YearShort"}], #[[2]]}] & /@
  pListCurrYr,
 PlotTheme -> "Classic",
 AspectRatio -> 0.8,
 PlotLabel ->
  Style[Framed[
    "CME Block Cheese Prices from " <>
     DateString[pListCurrYr[[1, 1]],
      {"MonthName", " ", "DayShort"}] <> " to " <>
     DateString[pListCurrYr[[Length[pListCurrYr], 1]],
      {"MonthName", " ", "DayShort", ", ", "Year"}]], "Subsection"],
 Filling -> Bottom,
 PlotMarkers -> {◆, 18},
 PlotRange -> {Full, {1.00, 2.00}}]
$\endgroup$
1
  • $\begingroup$ I see! Alter the format of the date within the Tooltip itself instead of in the List. I appreciate the insight you've given me. $\endgroup$
    – serbach
    Commented Mar 24, 2017 at 14:19

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.