From 25f1e10d7c66b4fbacf473eb4f36c44162c5339f Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 24 Dec 2011 16:20:07 +1000 Subject: [PATCH] Modified overview to be able to use percentiles other than 90% --- Graphs/gSummaryChart.cpp | 6 ++++++ Graphs/gSummaryChart.h | 10 +++++++++- SleepLib/day.cpp | 3 +++ SleepLib/machine_common.h | 2 +- overview.cpp | 5 +++-- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Graphs/gSummaryChart.cpp b/Graphs/gSummaryChart.cpp index cfa8dfa2..7d1ece1c 100644 --- a/Graphs/gSummaryChart.cpp +++ b/Graphs/gSummaryChart.cpp @@ -124,6 +124,7 @@ void SummaryChart::SetDay(Day * nullday) //if (code==CPAP_Leak) suboffset=PROFILE.cpap->IntentionalLeak(); else suboffset=0; type=m_type[j]; + EventDataType typeval=m_typeval[j]; for (int i=0;imachine_type()!=m_machinetype) continue; @@ -142,6 +143,7 @@ void SummaryChart::SetDay(Day * nullday) case ST_SUM: tmp=day->sum(code); break; case ST_WAVG: tmp=day->wavg(code); break; case ST_90P: tmp=day->p90(code); break; + case ST_PERC: tmp=day->percentile(code,typeval); break; case ST_MIN: tmp=day->Min(code); break; case ST_MAX: tmp=day->Max(code); break; case ST_CNT: tmp=day->count(code); break; @@ -496,10 +498,12 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height) for (int j=0;j m_goodcodes; QVector m_zeros; QVector m_type; + QVector m_typeval; QHash > m_values; QHash > m_times; QHash m_hours; diff --git a/SleepLib/day.cpp b/SleepLib/day.cpp index 9dbc9085..6a494f55 100644 --- a/SleepLib/day.cpp +++ b/SleepLib/day.cpp @@ -320,6 +320,9 @@ bool Day::hasData(ChannelID code, SummaryType type) case ST_90P: has=sess->m_90p.contains(code); break; + case ST_PERC: + has=sess->m_valuesummary.contains(code); + break; case ST_MIN: has=sess->m_min.contains(code); break; diff --git a/SleepLib/machine_common.h b/SleepLib/machine_common.h index 59de9143..e4ad7858 100644 --- a/SleepLib/machine_common.h +++ b/SleepLib/machine_common.h @@ -39,7 +39,7 @@ qint64 timezoneOffset(); /*! \enum SummaryType \brief Calculation method to select from dealing with summary information */ -enum SummaryType { ST_CNT, ST_SUM, ST_AVG, ST_WAVG, ST_90P, ST_MIN, ST_MAX, ST_CPH, ST_SPH, ST_FIRST, ST_LAST, ST_HOURS, ST_SESSIONS, ST_SETMIN, ST_SETAVG, ST_SETMAX, ST_SETWAVG, ST_SETSUM }; +enum SummaryType { ST_CNT, ST_SUM, ST_AVG, ST_WAVG, ST_PERC, ST_90P, ST_MIN, ST_MAX, ST_CPH, ST_SPH, ST_FIRST, ST_LAST, ST_HOURS, ST_SESSIONS, ST_SETMIN, ST_SETAVG, ST_SETMAX, ST_SETWAVG, ST_SETSUM }; /*! \enum MachineType \brief Generalized type of a machine diff --git a/overview.cpp b/overview.cpp index 0d511a2f..b6752baa 100644 --- a/overview.cpp +++ b/overview.cpp @@ -216,7 +216,8 @@ Overview::Overview(QWidget *parent,gGraphView * shared) : pr->addSlice(CPAP_Pressure,QColor("dark green"),ST_WAVG,true); pr->addSlice(CPAP_Pressure,QColor("orange"),ST_MIN,true); pr->addSlice(CPAP_Pressure,QColor("red"),ST_MAX,true); - pr->addSlice(CPAP_Pressure,QColor("grey"),ST_90P,true); + //pr->addSlice(CPAP_Pressure,QColor("grey"),ST_90P,true); + pr->addSlice(CPAP_Pressure,QColor("grey"),ST_PERC,true,0.95); pr->addSlice(CPAP_EPAP,QColor("green"),ST_MIN,true); pr->addSlice(CPAP_EPAP,QColor("light green"),ST_90P,true); @@ -225,7 +226,7 @@ Overview::Overview(QWidget *parent,gGraphView * shared) : PR->AddLayer(pr); lk=new SummaryChart(tr("Avg Leak"),GT_LINE); - lk->addSlice(CPAP_Leak,QColor("dark grey"),ST_90P,false); + lk->addSlice(CPAP_Leak,QColor("dark grey"),ST_PERC,false,0.8); lk->addSlice(CPAP_Leak,QColor("dark blue"),ST_WAVG,false); //lk->addSlice(CPAP_Leak,QColor("dark yellow")); //pr->addSlice(CPAP_IPAP,QColor("red"));