Modified overview to be able to use percentiles other than 90%

This commit is contained in:
Mark Watkins 2011-12-24 16:20:07 +10:00
parent 8a79769f3a
commit 25f1e10d7c
5 changed files with 22 additions and 4 deletions

View File

@ -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;i<d.value().size();i++) { // for each machine object for this day
day=d.value()[i];
if (day->machine_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_codes.size();j++) {
if (!m_goodcodes[j]) continue;
ChannelID code=m_codes[j];
EventDataType tval=m_typeval[j];
switch(m_type[j]) {
case ST_WAVG: b="Avg"; break;
case ST_AVG: b="Avg"; break;
case ST_90P: b="90%"; break;
case ST_PERC: b=QString("%1%").arg(tval*100.0,0,'f',0); break;
case ST_MIN: b="Min"; break;
case ST_MAX: b="Max"; break;
case ST_CPH: b=""; break;
@ -684,10 +688,12 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event)
QString a;
for (int i=0;i<m_type.size();i++) {
if (!m_goodcodes[i]) continue;
EventDataType tval=m_typeval[i];
switch(m_type[i]) {
case ST_WAVG: a="W-avg"; break;
case ST_AVG: a="Avg"; break;
case ST_90P: a="90%"; break;
case ST_PERC: a=QString("%1%").arg(tval*100.0,0,'f',0); break;
case ST_MIN: a="Min"; break;
case ST_MAX: a="Max"; break;
case ST_CPH: a=""; break;

View File

@ -38,7 +38,14 @@ class SummaryChart:public Layer
virtual bool isEmpty() { return m_empty; }
//! \brief Adds a layer to the summaryChart (When in Bar mode, it becomes culminative, eg, the AHI chart)
void addSlice(ChannelID code, QColor color, SummaryType type, bool ignore_zeros) { m_codes.push_back(code); m_colors.push_back(color); m_type.push_back(type); m_zeros.push_back(ignore_zeros); }
void addSlice(ChannelID code, QColor color, SummaryType type, bool ignore_zeros=false, EventDataType tval=0.00f)
{
m_codes.push_back(code);
m_colors.push_back(color);
m_type.push_back(type);
m_zeros.push_back(ignore_zeros);
m_typeval.push_back(tval);
}
//! \brief Deselect highlighting (the gold bar)
virtual void deselect() {
@ -58,6 +65,7 @@ class SummaryChart:public Layer
QVector<bool> m_goodcodes;
QVector<bool> m_zeros;
QVector<SummaryType> m_type;
QVector<EventDataType> m_typeval;
QHash<int,QHash<short,EventDataType> > m_values;
QHash<int,QHash<short,EventDataType> > m_times;
QHash<int,EventDataType> m_hours;

View File

@ -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;

View File

@ -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

View File

@ -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"));