• jimmigoo

    jimmigoo - 2009-05-18

    Hi everybody!
    I would like to understand how can I insert exact time values on X labels.
    If I use mpX_TIME option, I cannot read exactly times. I've done some routines
    that transform my sec85 seconds tick number (from 1-1-1985 to the exact time of acquisition) in 3 numbers,
    representing hour, minutes, seconds. But I cannot insert these three values on X labels.
    Does anybody know how to do this thing?

    Thanks in advice!


    • Nigel Paton

      Nigel Paton - 2009-05-27


      It takes the x labels from the value of the X coordinate. So the x coordinate needs to be the time expressed in seconds. See mpScaleX::Plot() in mathplot.cpp in particular this code:

                      if ((m_labelType == mpX_TIME) || (m_labelType == mpX_HOURS)) {
                          double modulus = fabs(n);
                          double sign = n/modulus;
                          double hh = floor(modulus/3600);
                          double mm = floor((modulus - hh*3600)/60);
                          double ss = modulus - hh*3600 - mm*60;
          #ifdef MATHPLOT_DO_LOGGING
                          wxLogMessage(wxT("%02.0f Hours, %02.0f minutes, %02.0f seconds"), sign*hh, mm, ss);
          #endif // MATHPLOT_DO_LOGGING
                          if (fmt.Len() == 20) // Format with hours has 11 chars
                              s.Printf(fmt, sign*hh, mm, floor(ss));
                              s.Printf(fmt, sign*mm, ss);

      The n variable is the current x value it is going to convert into a tick label on the x axis.




Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks