From 8614033bc08318e62356ac770b8488a9e43c6c40 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 7 Jan 2012 14:41:07 +1000 Subject: [PATCH] Show Median instead of average in Details tab (because average is not available in summary only days). Average when available shows in Tooltip. Made tooltips in Daily Details tab Statistics easier to access --- daily.cpp | 98 +++++++++++++++++++++++++++-------------------- docs/channels.xml | 2 +- docs/tooltips.css | 1 - 3 files changed, 57 insertions(+), 44 deletions(-) diff --git a/daily.cpp b/daily.cpp index e516ab27..435b1d93 100644 --- a/daily.cpp +++ b/daily.cpp @@ -796,14 +796,6 @@ void Daily::Load(QDate date) } else cs="2 width='50%'>"; html+=""; -// if (PROFILE.general->calculateRDI()) { -// html+=QString("%3%4%5\n") -// .arg("#F88017").arg("black").arg(tr("RDI")).arg(schema::channel[CPAP_RDI].description()).arg(ahi,0,'f',2); -// } else { -// html+=QString("%3%4%5\n") -// .arg("#F88017").arg("black").arg(tr("AHI")).arg(schema::channel[CPAP_AHI].description()).arg(ahi,0,'f',2); -// //html+=""+tr("AHI")+""+schema::channel[CPAP_AHI].description()+""+QString().sprintf("%.2f",ahi)+"\n"; -// } html+=QString("%3%4%5\n") .arg("#4040ff").arg("white").arg(tr("Hypopnea")).arg(schema::channel[CPAP_Hypopnea].description()).arg(hi,0,'f',2).arg(CPAP_Hypopnea); if (cpap->machine->GetClass()==STR_MACH_ResMed) { @@ -877,11 +869,8 @@ void Daily::Load(QDate date) html+=" "; html+=QString("%1").arg(tr("Event Breakdown")); html+="
"; - //G_AHI->setFixedSize(gwwidth,120); - //mainwin->snapshotGraph()->setPrintScaleX(1); - //mainwin->snapshotGraph()->setPrintScaleY(1); GAHI->setShowTitle(false); - //snapGV->setFixedSize(150,150); + QPixmap pixmap=GAHI->renderPixmap(150,150,false); QByteArray byteArray; QBuffer buffer(&byteArray); // use buffer to store pixmap into byteArray @@ -914,7 +903,7 @@ void Daily::Load(QDate date) html+=QString("%1%2%3%4%5") .arg(tr("Channel")) .arg(tr("Min")) - .arg(tr("Avg")) + .arg(tr("Med")) .arg(tr("%1%").arg(percentile*100,0,'f',0)) .arg(tr("Max")); ChannelID chans[]={ @@ -925,33 +914,62 @@ void Daily::Load(QDate date) }; int numchans=sizeof(chans)/sizeof(ChannelID); //int suboffset=0; + int ccnt=0; + EventDataType wavg,med,perc,mx,mn; for (int i=0;ichannelHasData(code)) { //if (code==CPAP_LeakTotal) suboffset=PROFILEIntentionalLeak"].toDouble(); else suboffset=0; QString tooltip=schema::channel[code].description(); if (!schema::channel[code].units().isEmpty()) tooltip+=" ("+schema::channel[code].units()+")"; - html+=QString("%1%2%3%4%5") - .arg(QString("%3%2") //"+tr("RDI")+""+ - .arg(QString::number(code)).arg(tooltip).arg(schema::channel[code].label())) - .arg(cpap->Min(code),0,'f',2) - .arg(cpap->wavg(code),0,'f',2) - .arg(cpap->percentile(code,percentile),0,'f',2) - .arg(cpap->Max(code),0,'f',2); + mx=cpap->Max(code); + mn=cpap->Min(code); + perc=cpap->percentile(code,percentile); + med=cpap->percentile(code,0.5); + wavg=cpap->wavg(code); + if (wavg>0 || mx==0) { + tooltip+=QString("
Avg: %1").arg(wavg,0,'f',2); + } + + html+=QString("%1%6%2%3%4%5") + //.arg(QString("
%3%2") //"+tr("RDI")+""+ + //.arg(QString::number(code)).arg(tooltip).arg(schema::channel[code].label())) + .arg(schema::channel[code].label()) + .arg(mn,0,'f',2) + .arg(med,0,'f',2) + .arg(perc,0,'f',2) + .arg(mx,0,'f',2) + .arg(tooltip); + ccnt++; } if (oxi && oxi->channelHasData(code)) { QString tooltip=schema::channel[code].description(); if (!schema::channel[code].units().isEmpty()) tooltip+=" ("+schema::channel[code].units()+")"; + wavg=oxi->wavg(code); + mx=oxi->Max(code); + mn=oxi->Min(code); + perc=oxi->percentile(code,percentile); + med=oxi->percentile(code,0.5); + if ((med>0 && wavg>0) || (med==0)) { + tooltip+=QString("
Avg: %1").arg(wavg,0,'f',2); + } + html+=QString("%1%2%3%4%5") .arg(QString("
%2%3") .arg(QString::number(code)).arg(schema::channel[code].label()).arg(tooltip)) - .arg(oxi->Min(code),0,'f',2) - .arg(oxi->wavg(code),0,'f',2) - .arg(oxi->percentile(code,percentile),0,'f',2) - .arg(oxi->Max(code),0,'f',2); + .arg(mn,0,'f',2) + .arg(med,0,'f',2) + .arg(perc,0,'f',2) + .arg(mx,0,'f',2); + ccnt++; } } + if (GraphView->isEmpty() && (ccnt>0)) { + html+=" \n"; + html+=QString("%1").arg(tr("Please Note: This day just contains summary data, only limited information is available .")); + } } else { html+=""+tr("No data available")+""; html+=" \n"; @@ -970,27 +988,23 @@ void Daily::Load(QDate date) if (cpap && cpap->hasEnabledSessions()) { html+=" "; -// html+=""; html+=QString("").arg(tr("Machine Settings")); html+=""; - int i=cpap->settings_max(CPAP_PresReliefType); - int j=cpap->settings_max(CPAP_PresReliefSet); - QString flexstr=(i>1) ? schema::channel[CPAP_PresReliefType].option(i)+" x"+QString::number(j) : "None"; + int i=cpap->settings_max(CPAP_PresReliefType); + int j=cpap->settings_max(CPAP_PresReliefSet); + QString flexstr=(i>1) ? schema::channel[CPAP_PresReliefType].option(i)+" x"+QString::number(j) : "None"; + html+=QString("") + .arg(tr("Pr. Relief")) + .arg(schema::channel[CPAP_PresReliefType].description()) + .arg(flexstr); + if (cpap->machine->GetClass()==STR_MACH_PRS1) { + int humid=round(cpap->settings_wavg(PRS1_HumidSetting)); + html+=QString("") + .arg(tr("Humidifier")) + .arg(schema::channel[PRS1_HumidSetting].description()) + .arg(humid==0 ? STR_GEN_Off : "x"+QString::number(humid)); + } - html+=QString("").arg(tr("Pr. Relief")) - .arg(flexstr); - if (cpap->machine->GetClass()==STR_MACH_PRS1) { - int humid=round(cpap->settings_wavg(PRS1_HumidSetting)); - html+=QString("").arg(tr("Humidifier")) - .arg(humid==0 ? STR_GEN_Off : "x"+QString::number(humid)); - } - /*} else if (cpap->machine->GetClass()==STR_MACH_ResMed) { - int epr=cpap->settings_max(RMS9_EPR); - int epr2=cpap->settings_max(RMS9_EPRSet); - html+=QString("") - .arg(tr("EPR")).arg(epr).arg(epr2); - - }*/ } html+="
%1

%1%2%3
%1%2%3
%1%2
%1%2
%1%2 / %3
"; diff --git a/docs/channels.xml b/docs/channels.xml index 8668fa97..1b0c058a 100644 --- a/docs/channels.xml +++ b/docs/channels.xml @@ -85,7 +85,7 @@ Important: One id code per item, DO NOT CHANGE ID NUMBERS!!!