QCustomPlot Discussion and Comments

xAxis Time Lables Using Json FileReturn to overview

I am trying to read in a json files that gives me info for a given stock price, and the json gives values for "date: 2020-05-26" and "minute: 09:30" but when I try to convert this to secsSinceEpoch using the code

            timeInEpoch.push_back(QDateTime::fromString(time[i].c_str(), Qt::ISODate).toSecsSinceEpoch() + 
            QDateTime::fromString(minute[i].c_str(), "hh:mm").toSecsSinceEpoch());

it assigns the wrong dates to the xAxis, for example it states that monday is may 29th but in reality may 29th was a friday, and also in between say the 27th and 28th since the json skips hours where the market is not open there are large gaps, is there anyway to fix this, i will attach a picture of my current graph.


Thank you for your help in advance!

Try to also output the year in your label. Maybe you have the wrong year encoded in your data. Because in some years, 29. May was a monday indeed.

I do output the year as "date: 2020-05-26" + "minute: 10:10" as an example, does it not store the 2020?

Update you were right for some reason my code is using the year 1950..

Hmm that sounds suspiciously like the epoch year (1970) minus "20" = 1950. Maybe some funny parsing issue involving the numbers 1970, 20, or 2020?

Okay so i got it working when it comes to the dates but now how can i remove the gaps between the x axis between the 2 days? You can see what i mean by the picture i included, thank you also for your help!