Menu

Print X-axis in dateTime format in plotWindow / plotWidget

Anonymous
2019-01-18
2019-01-29
  • Anonymous

    Anonymous - 2019-01-18

    Hi Stefan,

    First of all thank you very much for sharing your great work.

    My request is related to plotWindow / plotWidget script.

    I have successfully plotting the data I received periodically from a datalogger (every 10 seconds).

    At the moment I want to format the X-axis in nice date & time format, something like hh:mm or 1-Jan-19.

    I think the QCustomPlot is able to do that, but it seems that feature is not enabled in your project.

    Could you please implement that feature in your project?

    Thanks & best regards,
    Iqbal

     
  • Stefan Zieker

    Stefan Zieker - 2019-01-18

    Hi Iqbal,

    this is no problem. I will create a prerelease (Windows?) this weekend.

    Regards,
    Stefan

     
    • Muhammad Iqbal

      Muhammad Iqbal - 2019-01-18

      Hi Stefan,

      Really appreciate your feedback, thank you vey much!
      Yes I am on Windows.

      Best regards,
      Iqbal

       
  • Stefan Zieker

    Stefan Zieker - 2019-01-20

    Hi Muhammad,

    I have uploaded a new prerelease under File/Test. This includes your new feature (setLocale, showDateTimeAtXAxis). You can find an example under exampleScripts\WorkerScripts\PlotWindow\plotWindowExample.js

    Regards,
    Stefan

     
  • Muhammad Iqbal

    Muhammad Iqbal - 2019-01-21

    Hi Stefan,

    I've tested the prerelease.

    The xAxis is now showing the nice dateTime format, but I have some issues.

    Issue 1: missing majorTicks x Range is increased
    If I increase the x Range to around 300,000 and above, the majorTicks are not get printed anymore. That was what I did (increase the x Range) if I want to see more data, for example, the last 10 minutes data received from my datalogger.

    Issue 1

    Issue2: majorTicks are not aligned with the plotted data
    I've modified the plotWindowExample.js so that the data get plotted exactly on every second.
    The below picture is showing the last 10 data (x Range 10,000).
    As you can see from the picture below, the plotted data is not aligned with the majorTicks.

    Issue 2

    I am not a programmer, so I'm pretty sure that the mistakes are on my side, but could you please have a look?

    Appreciate your help in advance,

    Cheers,
    iqbal

     

    Last edit: Muhammad Iqbal 2019-01-21
  • Stefan Zieker

    Stefan Zieker - 2019-01-22

    Hi Muhammad,

    I changed QCustomPlot because the time precision is only seconds. I think my changes causes this problems. Therefore I will revert my changes. But then the time precision will only be 1 second.

    Regards,
    Stefan

     
  • Muhammad Iqbal

    Muhammad Iqbal - 2019-01-22

    Hi Stefan,

    For my current aplication, 1 second precision is enough.
    Not sure but maybe other users prefer better precision...? Sorry for causing the hickup.

    Best regards,
    Iqbal

     

    Last edit: Muhammad Iqbal 2019-01-22
  • Stefan Zieker

    Stefan Zieker - 2019-01-27

    Hi Muhammad,

    I have uploaded a new prerelease, which interprets the x values as seconds since epoche (the decimal places are the milliseconds).

    Issue2: You cannot exactly align the x values to the x-axis because:
    - you cannot add a new value exactly 1 second after the old one (it depends on the Windows sheduler)
    - the x-axis labels are not aligned to seconds (try the time format hh:mm:ss:zz, then you will see it)

    Regards,
    Stefan

     
  • Muhammad Iqbal

    Muhammad Iqbal - 2019-01-29

    Hi Stefan,

    Sorry somehow my gmail app didn't notify me that I have new post on this thread.
    I will test tonight and report by soonest.

    Best regards,
    Iqbal

     
  • Muhammad Iqbal

    Muhammad Iqbal - 2019-01-29

    Hi Stefan,

    I've tested the pre release and everything works great!
    I tested it using the script I attached earlier, with only small modification (previously the x values were in millisecond, now are in seconds).
    Also I really like that the x Range values is much more make sense (previously I have to multiply the value by 1000 - because previosly the x axis were in milliseconds).

    Issue1 is solved.

    Regarding Issue 2, I just found out that if we input x Range values between 8 to 10 8 to 15, the major ticks become inconsistent. Instead of printing on every second, sometimes it prints at half second (i.e. 00:00:00:500). It creates impression that the data did not get printed exactly on that second.
    Previously it was not so obvious becasuethe major tick format I used did not show the sub-seconds. As you said, after using the hh:mm:ss:zz format, then it become obvious.

    Please see attached picture.

    But well, I think it's only small issues (or maybe it's an automatic feature of QCustomPlot??), overall for me chart works great and fits my needs.

    Best regards,
    Iqbal

     

    Last edit: Muhammad Iqbal 2019-01-29
  • Stefan Zieker

    Stefan Zieker - 2019-01-29

    Hi Muhammad,

    yes you are right. This is a behavior of QCustomPlot, which I cannot change.
    Thx for your response.

    Best regards,
    Stefan

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.