diff --git a/Graphs/gBarChart.cpp b/Graphs/gBarChart.cpp index 8aaa5554..994bd734 100644 --- a/Graphs/gBarChart.cpp +++ b/Graphs/gBarChart.cpp @@ -57,6 +57,7 @@ void gBarChart::SetDay(Day * day) for (QMap >::iterator d=m_profile->daylist.begin();d!=m_profile->daylist.end();d++) { tt=QDateTime(d.key(),QTime(0,0,0),Qt::UTC).toTime_t(); + //tt=QDateTime(d.key(),QTime(12,0,0)).toTime_t(); dn=tt/86400; tt*=1000L; if (!m_minx || ttFirstDay(),QTime(0,0,0),Qt::UTC).toTime_t())*1000L; - //m_maxx=qint64(QDateTime(m_profile->LastDay().addDays(1),QTime(0,0,0),Qt::UTC).toTime_t())*1000L; + m_maxx=qint64(QDateTime(m_profile->LastDay().addDays(1),QTime(0,0,0),Qt::UTC).toTime_t())*1000L; + + //m_maxx=qint64(QDateTime(m_profile->LastDay().addDays(1),QTime(12,0,0)).toTime_t())*1000L; int i=0; //set miny & maxy here.. how? @@ -128,9 +131,11 @@ void gBarChart::paint(gGraph & w,int left, int top, int width, int height) int daynum=0; float h,tmp; - qint64 offs=minx% 86400000L; + + qint64 offs=(minx) % 86400000L; //zz*=86400000L; - float offset=offs/86400000.0; + float offset=(offs)/86400000.0; + //offset+=float(utcoff)/86400000.0; offset*=barw; px=left-offset; diff --git a/Graphs/gXAxis.cpp b/Graphs/gXAxis.cpp index 1e22f956..ed0cfa4e 100644 --- a/Graphs/gXAxis.cpp +++ b/Graphs/gXAxis.cpp @@ -22,6 +22,7 @@ gXAxis::gXAxis(QColor col,bool fadeout) m_show_minor_lines=false; m_show_minor_ticks=true; m_show_major_ticks=true; + m_utcfix=false; m_fadeout=fadeout; QDateTime d=QDateTime::currentDateTime(); QTime t1=d.time(); @@ -66,14 +67,14 @@ void gXAxis::paint(gGraph & w,int left,int top, int width, int height) //fitmode=-1; fd="MMM dd"; } else */ - if (xx>86400000L) { // Day + if (xx>=86400000L) { // Day fd="MMM 00"; dividx=0; - divmax=15; + divmax=7; fitmode=0; } else if (xx>600000) { // Minutes fd="00:00"; - dividx=6; + dividx=7; divmax=24; fitmode=1; } else if (xx>5000) { // Seconds @@ -140,6 +141,7 @@ void gXAxis::paint(gGraph & w,int left,int top, int width, int height) if (pyadd(py,top,py,top+4,linecol); } + int utcoff=m_utcfix ? QDateTime(QDate(1970,1,1),QTime(0,0,0)).secsTo(QDateTime(QDate(1970,1,1),QTime(0,0,0),Qt::UTC))/3600 : 0; for (qint64 i=aligned_start;iaddSlice(CPAP_Obstructive,QColor("#40c0ff")); bc->addSlice(CPAP_ClearAirway,QColor("purple")); BC->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin); - BC->AddLayer(new gXAxis(),LayerBottom,0,gXAxis::Margin); + gXAxis *gx=new gXAxis(); + gx->setUtcFix(true); + BC->AddLayer(gx,LayerBottom,0,gXAxis::Margin); BC->AddLayer(bc); BC->AddLayer(new gXGrid()); @@ -1101,9 +1103,9 @@ Session * Daily::CreateJournalSession(QDate date) profile->AddMachine(m); } Session *sess=new Session(m,0); - QDateTime dt; - dt.setDate(date); - dt.setTime(QTime(17,0)); //5pm to make sure it goes in the right day + QDateTime dt(date,QTime(17,0)); + //dt.setDate(date); + //dt.setTime(QTime(17,0)); //5pm to make sure it goes in the right day sess->set_first(qint64(dt.toTime_t())*1000L); dt=dt.addSecs(3600); sess->set_last(qint64(dt.toTime_t())*1000L);