From 67bfda32805f0bcf1b8e5fcfa33aa8775f0c4ce6 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sun, 7 Aug 2011 18:52:12 +1000 Subject: [PATCH] YAxis tick cleanup, plus ResMed leaks to Litres per Minute instead of per second --- Graphs/gYAxis.cpp | 74 +++++++++++++++-------- SleepLib/loader_plugins/resmed_loader.cpp | 16 ++--- 2 files changed, 58 insertions(+), 32 deletions(-) diff --git a/Graphs/gYAxis.cpp b/Graphs/gYAxis.cpp index 6970c3f9..c7f21353 100644 --- a/Graphs/gYAxis.cpp +++ b/Graphs/gYAxis.cpp @@ -33,13 +33,9 @@ void gYAxis::Plot(gGraphWindow &w,float scrx,float scry) double dy=maxy-miny; if (dy<=0) { - if (miny==0) - return; - else { - miny+=1; - maxy-=1; - dy=2; - } + //miny=miny; + maxy++; + dy=1; } int m; @@ -69,9 +65,9 @@ void gYAxis::Plot(gGraphWindow &w,float scrx,float scry) m=floor(miny/5.0); miny=m*5; } else { - maxy=ceil(maxy); - if (maxy<1) maxy=1; - miny=floor(miny); + //maxy=ceil(maxy); + //if (maxy<1) maxy=1; + //miny=floor(miny); //if (miny<1) miny=0; } @@ -93,10 +89,13 @@ void gYAxis::Plot(gGraphWindow &w,float scrx,float scry) double yt=1/max_yticks; - double mxy=MAX(maxy,fabs(miny)); - double mny=MIN(maxy,fabs(miny)); + + double mxy=MAX(fabs(maxy),fabs(miny)); + double mny=MIN(fabs(maxy),fabs(miny)); if (miny<0) mny=-mny; if (maxy<0) mxy=-mxy; + //mny=miny; + //mxy=maxy; double rxy=mxy-mny; double ymult=height/rxy; @@ -131,24 +130,29 @@ void gYAxis::Plot(gGraphWindow &w,float scrx,float scry) } - for (double i=miny+(min_ytick/2.0); i miny)) { - minorvertarray[minorvertcnt++]=start_px+1; - minorvertarray[minorvertcnt++]=h; - minorvertarray[minorvertcnt++]=start_px+width; - minorvertarray[minorvertcnt++]=h; + if (m_show_minor_lines) {// && (i > miny)) { + double z=(min_ytick/5)*ymult; + double g=h; + for (int i=0;i<4;i++) { + g+=z; + minorvertarray[minorvertcnt++]=start_px+1; + minorvertarray[minorvertcnt++]=g; + minorvertarray[minorvertcnt++]=start_px+width; + minorvertarray[minorvertcnt++]=g; + } } if (vertcnt>=maxverts) { // Should only need to check one.. The above check should be enough. qWarning() << "vertarray bounds exceeded in gYAxis for " << w.Title() << "graph" << "MinY =" <eventlist[code].push_back(a); //a->AddWaveform(edf.startdate,es.data,recs,duration); a=ToTimeDelta(sess,edf,es, code,recs,duration,0,0); - a->setMax(1); - a->setMin(0); + //a->setMax(1); + //a->setMin(0); } else if (es.label=="Therapy Pres") { code=CPAP_IPAP; //TherapyPressure; //EventList *a=new EventList(code,EVL_Waveform,es.gain,es.offset,es.physical_minimum,es.physical_maximum,rate); @@ -719,18 +719,18 @@ bool ResmedLoader::LoadPLD(Session *sess,EDFParser &edf) a=ToTimeDelta(sess,edf,es, code,recs,duration,0,0); } else if (es.label=="Leak") { code=CPAP_Leak; - // es.gain*=100.0; + es.gain*=60; //es.gain=1;//10.0; - es.offset=-0.5; + //es.offset=-0.5; a=ToTimeDelta(sess,edf,es, code,recs,duration,0,0); - a->setMax(1); - a->setMin(0); + //a->setMax(1); + //a->setMin(0); } else if (es.label=="FFL Index") { code=CPAP_FlowLimitGraph; //es.gain=1;//10.0; a=ToTimeDelta(sess,edf,es, code,recs,duration,0,0); - a->setMax(1); - a->setMin(0); + //a->setMax(1); + //a->setMin(0); } else if (es.label=="Mask Pres") { code=CPAP_Pressure; //es.gain=1;