Hi,

on http://tex.stackexchange.com/q/79252/18401, a solution was given to
let the user have input data of the form `HH:MM:SS` (without
date). Unfortunately, as pointed out in comments, this solution fails if
`HH` is `08` or `09` with the error:

  ┌────
  │ ! Package PGF Math Error: Digit '8' invalid for base 8 (in 
'08*3600-08*3600+54*60+14.75')
  └────

A workaround was pointed out on the present list:

  ┌────
  │ 
http://pgfplots-features.706524.n3.nabble.com/Pgfplots-features-Octal-numbers-td3124234.html
  └────

just by removing the leading zeros but it is not always desirable to
manually change the data. Moreover, the usecase of this post, and hence
the answer given by Christian, are not relevant for data of the form
`HH:MM:SS`.

Thanks to http://tex.stackexchange.com/a/52233/18401, a possible
workaround is, in (see http://tex.stackexchange.com/q/79252/18401), to
replace the "brut" hours, minutes and second (#1, #2 and #3):

--8<---------------cut here---------------start------------->8---
    \pgfmathparse{#1*3600-\pgfkeysvalueof{/pgfplots/timeplot 
zero}*3600+#2*60+#3}
--8<---------------cut here---------------end--------------->8---

from:

--8<---------------cut here---------------start------------->8---
\def\transformtime#1:#2:#3!{
    \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}
    \pgfmathparse{#1*3600-\pgfkeysvalueof{/pgfplots/timeplot 
zero}*3600+#2*60+#3}
    \pgfkeys{/pgf/fpu=false}
}
--8<---------------cut here---------------end--------------->8---
 
by their digital counterparts (`\the\numexpr...\relax`):

--8<---------------cut here---------------start------------->8---
    \pgfmathparse{%
      \the\numexpr#1\relax*3600%
      -\pgfkeysvalueof{/pgfplots/timeplot zero}*3600%
      +\the\numexpr#2\relax*60%
      +\the\numexpr#3\relax%
    }
--8<---------------cut here---------------end--------------->8---

Now, some questions :)

1. Do you think this is a safe way of doing?
2. Is there a better way?
3. Could `pgfplots` be able to directly handle data time (without date)
   format?

Thanks by anticipation.
-- 
Denis

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Pgfplots-features mailing list
Pgfplots-features@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgfplots-features

Reply via email to