mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 03:30:44 +00:00
Some Overview Statistics
This commit is contained in:
parent
a37587a4e9
commit
2cdd9ab333
@ -35,7 +35,6 @@ bool gGraphData::isEmpty()
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gPointData::gPointData(int mp)
|
gPointData::gPointData(int mp)
|
||||||
:gGraphData(mp,gDT_Point)
|
:gGraphData(mp,gDT_Point)
|
||||||
{
|
{
|
||||||
@ -52,3 +51,51 @@ void gPointData::AddSegment(int max_points)
|
|||||||
QPointD *p=new QPointD [max_points];
|
QPointD *p=new QPointD [max_points];
|
||||||
point.push_back(p);
|
point.push_back(p);
|
||||||
}
|
}
|
||||||
|
double gPointData::CalcAverage()
|
||||||
|
{
|
||||||
|
double x,val=0;
|
||||||
|
int cnt=0;
|
||||||
|
for (int i=0;i<np[0];i++) {
|
||||||
|
x=point[0][i].x();
|
||||||
|
if ((x<min_x) || (x>max_x)) continue;
|
||||||
|
val+=point[0][i].y();
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
if (!cnt) return 0;
|
||||||
|
val/=cnt;
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
double gPointData::CalcMinY()
|
||||||
|
{
|
||||||
|
double x,val=0;
|
||||||
|
double min;
|
||||||
|
bool first=true;
|
||||||
|
for (int i=0;i<np[0];i++) {
|
||||||
|
x=point[0][i].x();
|
||||||
|
if ((x<min_x) || (x>max_x)) continue;
|
||||||
|
val=point[0][i].y();
|
||||||
|
if (first) {
|
||||||
|
min=val;
|
||||||
|
first=false;
|
||||||
|
} else
|
||||||
|
if (min>val) min=val;
|
||||||
|
}
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
double gPointData::CalcMaxY()
|
||||||
|
{
|
||||||
|
double x,val=0;
|
||||||
|
double max;
|
||||||
|
bool first=true;
|
||||||
|
for (int i=0;i<np[0];i++) {
|
||||||
|
x=point[0][i].x();
|
||||||
|
if ((x<min_x) || (x>max_x)) continue;
|
||||||
|
val=point[0][i].y();
|
||||||
|
if (first) {
|
||||||
|
max=val;
|
||||||
|
first=false;
|
||||||
|
} else
|
||||||
|
if (max<val) max=val;
|
||||||
|
}
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
@ -30,6 +30,10 @@ public:
|
|||||||
//virtual inline const int & NP(int i) { return vnp[i]; }
|
//virtual inline const int & NP(int i) { return vnp[i]; }
|
||||||
//virtual inline const int & MP(int i) { return vsize[i]; }
|
//virtual inline const int & MP(int i) { return vsize[i]; }
|
||||||
inline const gDataType & Type() { return type; }
|
inline const gDataType & Type() { return type; }
|
||||||
|
virtual double CalcAverage()=0;
|
||||||
|
virtual double CalcMinY()=0;
|
||||||
|
virtual double CalcMaxY()=0;
|
||||||
|
|
||||||
|
|
||||||
virtual inline double MaxX() { return max_x; }
|
virtual inline double MaxX() { return max_x; }
|
||||||
virtual inline double MinX() { return min_x; }
|
virtual inline double MinX() { return min_x; }
|
||||||
@ -103,6 +107,10 @@ public:
|
|||||||
virtual ~gPointData();
|
virtual ~gPointData();
|
||||||
virtual void Reload(Day *day=NULL){ day=day; };
|
virtual void Reload(Day *day=NULL){ day=day; };
|
||||||
virtual void AddSegment(int max_points);
|
virtual void AddSegment(int max_points);
|
||||||
|
virtual double CalcAverage();
|
||||||
|
virtual double CalcMinY();
|
||||||
|
virtual double CalcMaxY();
|
||||||
|
|
||||||
vector<QPointD *> point;
|
vector<QPointD *> point;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -566,20 +566,7 @@ void HistoryData::Reload(Day *day)
|
|||||||
real_max_y=max_y;
|
real_max_y=max_y;
|
||||||
m_ready=true;
|
m_ready=true;
|
||||||
}
|
}
|
||||||
double HistoryData::GetAverage()
|
|
||||||
{
|
|
||||||
double x,val=0;
|
|
||||||
int cnt=0;
|
|
||||||
for (int i=0;i<np[0];i++) {
|
|
||||||
x=point[0][i].x();
|
|
||||||
if ((x<min_x) || (x>max_x)) continue;
|
|
||||||
val+=point[0][i].y();
|
|
||||||
cnt++;
|
|
||||||
}
|
|
||||||
if (!cnt) return 0;
|
|
||||||
val/=cnt;
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
void HistoryData::SetDateRange(QDate start,QDate end)
|
void HistoryData::SetDateRange(QDate start,QDate end)
|
||||||
{
|
{
|
||||||
qint64 x1=QDateTime(start).toMSecsSinceEpoch()/86400000.0;
|
qint64 x1=QDateTime(start).toMSecsSinceEpoch()/86400000.0;
|
||||||
|
@ -95,7 +95,7 @@ public:
|
|||||||
|
|
||||||
void SetProfile(Profile *_profile) { profile=_profile; Reload(); }
|
void SetProfile(Profile *_profile) { profile=_profile; Reload(); }
|
||||||
Profile * GetProfile() { return profile; }
|
Profile * GetProfile() { return profile; }
|
||||||
double GetAverage();
|
//double GetAverage();
|
||||||
|
|
||||||
virtual double Calc(Day *day);
|
virtual double Calc(Day *day);
|
||||||
virtual void Reload(Day *day=NULL);
|
virtual void Reload(Day *day=NULL);
|
||||||
|
@ -704,7 +704,7 @@ void gGraphWindow::OnMouseLeftRelease(QMouseEvent * event)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int xp=x;
|
int xp=x;
|
||||||
xp=0;
|
//xp=0;
|
||||||
double zoom_fact=0.5;
|
double zoom_fact=0.5;
|
||||||
if (event->modifiers() & Qt::ControlModifier) zoom_fact=0.25;
|
if (event->modifiers() & Qt::ControlModifier) zoom_fact=0.25;
|
||||||
ZoomX(zoom_fact,xp); //event.GetX()); // adds origin to zoom in.. Doesn't look that cool.
|
ZoomX(zoom_fact,xp); //event.GetX()); // adds origin to zoom in.. Doesn't look that cool.
|
||||||
|
5
README
5
README
@ -12,8 +12,9 @@ Copyright (C) 2011
|
|||||||
|
|
||||||
Licence Stuff
|
Licence Stuff
|
||||||
-------------
|
-------------
|
||||||
This software is released under the GNU Public License.
|
This software is released under the GNU Public License, at a GPL version of my choosing at a later date.
|
||||||
|
|
||||||
Exceptions:
|
Exceptions:
|
||||||
Incorporates TinyXML.. see their readme for details in ./libs/tinyxml
|
Incorporates TinyXML.. see their readme for details in ./libs/tinyxml
|
||||||
Incorporates QextSerialPort. Insert New BSD license here.
|
Incorporates QextSerialPort. Insert New BSD license here? (Apparently PD.. need to verify)
|
||||||
|
|
||||||
|
25
overview.cpp
25
overview.cpp
@ -152,6 +152,31 @@ void Overview::UpdateGraphs()
|
|||||||
}
|
}
|
||||||
session_times->SetDateRange(first,last);
|
session_times->SetDateRange(first,last);
|
||||||
RedrawGraphs();
|
RedrawGraphs();
|
||||||
|
QString html="<html><body><div align=center>";
|
||||||
|
html+="<table width='100%' cellpadding=2 cellspacing=0 border=0>";
|
||||||
|
html+="<tr align=center><td colspan=4><b><i>Statistics</i></b></td></tr>";
|
||||||
|
html+="<tr><td><b>Details</b></td><td><b>Min</b></td><td><b>Avg</b></td><td><b>Max</b></td></tr>";
|
||||||
|
html+=QString("<tr><td>AHI</td><td>%1</td><td>%2</td><td>%3</td></tr>\n")
|
||||||
|
.arg(ahidata->CalcMinY(),2,'f',2,'0')
|
||||||
|
.arg(ahidata->CalcAverage(),2,'f',2,'0')
|
||||||
|
.arg(ahidata->CalcMaxY(),2,'f',2,'0');
|
||||||
|
html+=QString("<tr><td>Leak</td><td>%1</td><td>%2</td><td>%3</td></tr>")
|
||||||
|
.arg(leak->CalcMinY(),2,'f',2,'0')
|
||||||
|
.arg(leak->CalcAverage(),2,'f',2,'0')
|
||||||
|
.arg(leak->CalcMaxY(),2,'f',2,'0');
|
||||||
|
html+=QString("<tr><td>Pressure</td><td>%1</td><td>%2</td><td>%3</td></tr>")
|
||||||
|
.arg(pressure->CalcMinY(),2,'f',2,'0')
|
||||||
|
.arg(pressure->CalcAverage(),2,'f',2,'0')
|
||||||
|
.arg(pressure->CalcMaxY(),2,'f',2,'0');
|
||||||
|
html+=QString("<tr><td>Usage</td><td>%1</td><td>%2</td><td>%3</td></tr>")
|
||||||
|
.arg(usage->CalcMinY(),2,'f',2,'0')
|
||||||
|
.arg(usage->CalcAverage(),2,'f',2,'0')
|
||||||
|
.arg(usage->CalcMaxY(),2,'f',2,'0');
|
||||||
|
|
||||||
|
html+="</table>"
|
||||||
|
"</div></body></html>";
|
||||||
|
ui->webView->setHtml(html);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
63
overview.ui
63
overview.ui
@ -39,37 +39,40 @@
|
|||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Summary</string>
|
<string>Summary</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<property name="text">
|
<property name="spacing">
|
||||||
<string>This whole page is still being figured out.</string>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<item>
|
||||||
<bool>true</bool>
|
<widget class="QWebView" name="webView">
|
||||||
</property>
|
<property name="minimumSize">
|
||||||
</widget>
|
<size>
|
||||||
</item>
|
<width>0</width>
|
||||||
<item>
|
<height>0</height>
|
||||||
<widget class="QWebView" name="webView">
|
</size>
|
||||||
<property name="minimumSize">
|
</property>
|
||||||
<size>
|
<property name="maximumSize">
|
||||||
<width>200</width>
|
<size>
|
||||||
<height>0</height>
|
<width>16777215</width>
|
||||||
</size>
|
<height>16777215</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="maximumSize">
|
</property>
|
||||||
<size>
|
<property name="url">
|
||||||
<width>200</width>
|
<url>
|
||||||
<height>16777215</height>
|
<string>about:blank</string>
|
||||||
</size>
|
</url>
|
||||||
</property>
|
</property>
|
||||||
<property name="url">
|
</widget>
|
||||||
<url>
|
</item>
|
||||||
<string>about:blank</string>
|
</layout>
|
||||||
</url>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -86,7 +89,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>828</width>
|
<width>800</width>
|
||||||
<height>282</height>
|
<height>282</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -47,7 +47,8 @@ Oximetry::Oximetry(QWidget *parent) :
|
|||||||
|
|
||||||
AddData(plethy=new WaveData(OXI_Plethy));
|
AddData(plethy=new WaveData(OXI_Plethy));
|
||||||
plethy->AddSegment(1000000);
|
plethy->AddSegment(1000000);
|
||||||
plethy->np[0]=0;
|
|
||||||
|
plethy->np.push_back(0);
|
||||||
plethy->SetMaxY(100);
|
plethy->SetMaxY(100);
|
||||||
plethy->SetMinY(0);
|
plethy->SetMinY(0);
|
||||||
PLETHY=new gGraphWindow(gSplitter,tr("Plethysomogram"),PULSE);
|
PLETHY=new gGraphWindow(gSplitter,tr("Plethysomogram"),PULSE);
|
||||||
|
Loading…
Reference in New Issue
Block a user