Try showing some events counts in TAP chart

This commit is contained in:
Mark Watkins 2016-03-08 11:30:47 +10:00
parent ed5a539584
commit eb369ef8b0
3 changed files with 63 additions and 6 deletions

View File

@ -277,8 +277,64 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r
xp+=xstep;
lastyp = yp;
}
double estep = float(height) / ipap.peakevents;
if (ipap.peakevents>0) {
for (int k=0; k<ipap.chans.size(); ++k) {
ChannelID ch = ipap.chans.at(k);
//(ch != CPAP_AHI) &&
if ((ch != CPAP_Hypopnea) && (ch != CPAP_Obstructive) && (ch != CPAP_ClearAirway) && (ch != CPAP_Apnea)) continue;
schema::Channel & chan = schema::channel[ch];
QColor col = chan.defaultColor();
col.setAlpha(48);
painter.setPen(col);
xp = left;
lastyp = bottom - (float(ipap.events[ch][min-1]) * estep);
for (int i=min; i<max; ++i) {
p0 = ipap.events[ch][i-1];
p1 = ipap.events[ch][i];
p2 = ipap.events[ch][i+1];
p3 = ipap.events[ch][i+1];
yp = bottom - (float(p1) * estep);
painter.drawLine(xp, lastyp, xp+xstep, yp);
lastyp = yp;
xp += xstep;
float s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.2),0.0f);
yp = qMax(bottom-height, float(bottom - (s2 * estep)));
painter.drawLine(xp, lastyp, xp+xstep, yp);
lastyp = yp;
xp += xstep;
s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.4),0.0f);
yp = qMax(bottom-height, float(bottom - (s2 * estep)));
painter.drawLine(xp, lastyp, xp+xstep, yp);
lastyp = yp;
xp += xstep;
s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.6),0.0f);
yp = qMax(bottom-height, float(bottom - (s2 * estep)));
painter.drawLine(xp, lastyp, xp+xstep, yp);
xp+=xstep;
lastyp = yp;
s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.8),0.0f);
yp = qMax(bottom-height, float(bottom - (s2 * estep)));
painter.drawLine(xp, lastyp, xp+xstep, yp);
xp+=xstep;
lastyp = yp;
}
}
}
if (epap.min_pressure) {
xp=left, lastyp = bottom - (float(epap.times[min]) * ystep);
painter.setPen(Qt::blue);
@ -686,13 +742,13 @@ void RecalcMAP::updateTimes(PressureInfo & info, Session * sess)
lasttime = time;
lastdata = data;
}
if (time > maxx) {
break;
}
}
if (lasttime < maxx) {
if ((lasttime < maxx) || (lastdata == data)) {
d1 = qMax(lasttime, minx);
d2 = qMin(maxx, EL->last());

View File

@ -477,6 +477,7 @@ void loadChannels()
chan->setEnabled(enabled);
chan->setDefaultColor(color);
// Don't import channel descriptions if event renaming is turned off. (helps pick up new translations)
if (PREF[STR_PREF_AllowEventRenaming].toBool()) {
chan->setFullname(fullname);
chan->setLabel(label);

View File

@ -9,7 +9,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>845</width>
<width>847</width>
<height>656</height>
</rect>
</property>
@ -57,7 +57,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
<number>4</number>
</property>
<widget class="QWidget" name="importTab">
<attribute name="title">
@ -1736,7 +1736,7 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item>
<widget class="QLabel" name="label_51">
<widget class="QLabel" name="eventsWarningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -1815,7 +1815,7 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item>
<widget class="QLabel" name="label_56">
<widget class="QLabel" name="waveformsWarningLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>