mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-08 20:20:44 +00:00
Merge branch 'master' into graphs4
This commit is contained in:
commit
f1cb0e53d9
@ -223,11 +223,11 @@ void gLineOverlayBar::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
painter.drawRect(rect);
|
painter.drawRect(rect);
|
||||||
|
|
||||||
// Queue tooltip
|
// Queue tooltip
|
||||||
QString lab2 = QString("%1").arg(schema::channel[m_code].fullname());
|
QString strEventTooltip = QString("%1").arg(schema::channel[m_code].fullname());
|
||||||
if (raw != 0) // Hide duration when it is zero
|
if (raw != 0) // Hide duration when it is zero
|
||||||
lab2 += QString(" (%1)").arg(raw);
|
strEventTooltip += QString(" (%1)").arg(raw);
|
||||||
|
|
||||||
w.ToolTip(lab2, x1 - 10, start_py + 24 + (3 * w.printScaleY()), TT_AlignRight, AppSetting->tooltipTimeout());
|
w.ToolTip(strEventTooltip, x1 - 10, start_py + 24 + (3 * w.printScaleY()), TT_AlignRight, AppSetting->tooltipTimeout());
|
||||||
|
|
||||||
painter.setPen(QPen(col,3));
|
painter.setPen(QPen(col,3));
|
||||||
} else {
|
} else {
|
||||||
|
@ -317,9 +317,10 @@ QString gSummaryChart::tooltipData(Day *, int idx)
|
|||||||
{
|
{
|
||||||
QString txt;
|
QString txt;
|
||||||
const auto & slices = cache[idx];
|
const auto & slices = cache[idx];
|
||||||
for (const auto & slice : slices) {
|
int i = slices.size();
|
||||||
txt += QString("\n%1: %2").arg(slice.name).arg(float(slice.value), 0, 'f', 2);
|
while (i > 0) {
|
||||||
|
i--;
|
||||||
|
txt += QString("\n%1: %2").arg(slices[i].name).arg(float(slices[i].value), 0, 'f', 2);
|
||||||
}
|
}
|
||||||
return txt;
|
return txt;
|
||||||
}
|
}
|
||||||
@ -1240,33 +1241,35 @@ void gAHIChart::afterDraw(QPainter & /*painter */, gGraph &graph, QRectF rect)
|
|||||||
QStringList txtlist;
|
QStringList txtlist;
|
||||||
if (!skip) txtlist.append(QObject::tr("%1 %2 / %3 / %4").arg(STR_TR_AHI).arg(min_ahi, 0, 'f', 2).arg(med, 0, 'f', 2).arg(max_ahi, 0, 'f', 2));
|
if (!skip) txtlist.append(QObject::tr("%1 %2 / %3 / %4").arg(STR_TR_AHI).arg(min_ahi, 0, 'f', 2).arg(med, 0, 'f', 2).arg(max_ahi, 0, 'f', 2));
|
||||||
|
|
||||||
for (auto & calc : calcitems) {
|
int i = calcitems.size();
|
||||||
ChannelID code = calc.code;
|
while (i > 0) {
|
||||||
|
i--;
|
||||||
|
ChannelID code = calcitems[i].code;
|
||||||
schema::Channel & chan = schema::channel[code];
|
schema::Channel & chan = schema::channel[code];
|
||||||
float mid = 0;
|
float mid = 0;
|
||||||
skip = true;
|
skip = true;
|
||||||
switch (midcalc) {
|
switch (midcalc) {
|
||||||
case 0:
|
case 0:
|
||||||
if (calc.median_data.size() > 0) {
|
if (calcitems[i].median_data.size() > 0) {
|
||||||
mid = median(calc.median_data.begin(), calc.median_data.end());
|
mid = median(calcitems[i].median_data.begin(), calcitems[i].median_data.end());
|
||||||
skip = false;
|
skip = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (calc.divisor > 0) {
|
if (calcitems[i].divisor > 0) {
|
||||||
mid = calc.wavg_sum / calc.divisor;
|
mid = calcitems[i].wavg_sum / calcitems[i].divisor;
|
||||||
skip = false;
|
skip = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (calc.cnt > 0) {
|
if (calcitems[i].cnt > 0) {
|
||||||
mid = calc.avg_sum / calc.cnt;
|
mid = calcitems[i].avg_sum / calcitems[i].cnt;
|
||||||
skip = false;
|
skip = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip) txtlist.append(QString("%1 %2 / %3 / %4").arg(chan.label()).arg(calc.min, 0, 'f', 2).arg(mid, 0, 'f', 2).arg(calc.max, 0, 'f', 2));
|
if (!skip) txtlist.append(QString("%1 %2 / %3 / %4").arg(chan.label()).arg(calcitems[i].min, 0, 'f', 2).arg(mid, 0, 'f', 2).arg(calcitems[i].max, 0, 'f', 2));
|
||||||
}
|
}
|
||||||
QString txt = txtlist.join(", ");
|
QString txt = txtlist.join(", ");
|
||||||
graph.renderText(txt, rect.left(), rect.top()-5*graph.printScaleY(), 0);
|
graph.renderText(txt, rect.left(), rect.top()-5*graph.printScaleY(), 0);
|
||||||
@ -1294,9 +1297,11 @@ QString gAHIChart::tooltipData(Day *day, int idx)
|
|||||||
float total = 0;
|
float total = 0;
|
||||||
float hour = day->hours(m_machtype);
|
float hour = day->hours(m_machtype);
|
||||||
QString txt;
|
QString txt;
|
||||||
for (const auto & slice : slices) {
|
int i = slices.size();
|
||||||
total += slice.value;
|
while (i > 0) {
|
||||||
txt += QString("\n%1: %2").arg(slice.name).arg(float(slice.value) / hour, 0, 'f', 2);
|
i--;
|
||||||
|
total += slices[i].value;
|
||||||
|
txt += QString("\n%1: %2").arg(slices[i].name).arg(float(slices[i].value) / hour, 0, 'f', 2);
|
||||||
}
|
}
|
||||||
return QString("\n%1: %2").arg(STR_TR_AHI).arg(float(total) / hour,0,'f',2)+txt;
|
return QString("\n%1: %2").arg(STR_TR_AHI).arg(float(total) / hour,0,'f',2)+txt;
|
||||||
}
|
}
|
||||||
|
@ -1045,26 +1045,26 @@ QString formatTime(EventDataType v, bool show_seconds = false, bool duration = f
|
|||||||
bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
||||||
{
|
{
|
||||||
graph->timedRedraw(0);
|
graph->timedRedraw(0);
|
||||||
int x = event->x();
|
int xposLeft = event->x();
|
||||||
int y = event->y();
|
int yPosTop = event->y();
|
||||||
|
|
||||||
if (!m_rect.contains(x, y)) {
|
if (!m_rect.contains(xposLeft, yPosTop)) {
|
||||||
// if ((x<0 || y<0 || x>l_width || y>l_height)) {
|
// if ((x<0 || y<0 || x>l_width || y>l_height)) {
|
||||||
hl_day = -1;
|
hl_day = -1;
|
||||||
//graph->timedRedraw(2000);
|
//graph->timedRedraw(2000);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
x -= m_rect.left();
|
xposLeft -= m_rect.left();
|
||||||
y -= m_rect.top();
|
yPosTop -= m_rect.top();
|
||||||
|
|
||||||
Q_UNUSED(y)
|
Q_UNUSED(yPosTop)
|
||||||
|
|
||||||
double xx = l_maxx - l_minx;
|
double xx = l_maxx - l_minx;
|
||||||
|
|
||||||
double xmult = xx / double(l_width + barw);
|
double xmult = xx / double(l_width + barw);
|
||||||
|
|
||||||
qint64 mx = ceil(xmult * double(x - offset));
|
qint64 mx = ceil(xmult * double(xposLeft - offset));
|
||||||
mx += l_minx;
|
mx += l_minx;
|
||||||
mx = mx + l_offset; //-86400000L;
|
mx = mx + l_offset; //-86400000L;
|
||||||
int zd = mx / 86400000L;
|
int zd = mx / 86400000L;
|
||||||
@ -1080,7 +1080,7 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
|||||||
|
|
||||||
QMap<short, EventDataType> &valhash = d.value();
|
QMap<short, EventDataType> &valhash = d.value();
|
||||||
|
|
||||||
x += m_rect.left(); //gYAxis::Margin+gGraphView::titleWidth; //graph->m_marginleft+
|
xposLeft += m_rect.left(); //gYAxis::Margin+gGraphView::titleWidth; //graph->m_marginleft+
|
||||||
int y = event->y() - m_rect.top() + rtop - 15;
|
int y = event->y() - m_rect.top() + rtop - 15;
|
||||||
//QDateTime dt1=QDateTime::fromTime_t(hl_day*86400).toLocalTime();
|
//QDateTime dt1=QDateTime::fromTime_t(hl_day*86400).toLocalTime();
|
||||||
QDateTime dt2 = QDateTime::fromTime_t(hl_day * 86400).toUTC();
|
QDateTime dt2 = QDateTime::fromTime_t(hl_day * 86400).toUTC();
|
||||||
@ -1094,7 +1094,7 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
|||||||
if ((d != m_values.end()) && (day != nullptr)) {
|
if ((d != m_values.end()) && (day != nullptr)) {
|
||||||
bool summary_only = day->summaryOnly();
|
bool summary_only = day->summaryOnly();
|
||||||
|
|
||||||
QString z = dt.toString(Qt::SystemLocaleShortDate);
|
QString strTooltip = dt.toString(Qt::SystemLocaleShortDate);
|
||||||
|
|
||||||
// Day * day=m_days[hl_day];
|
// Day * day=m_days[hl_day];
|
||||||
//EventDataType val;
|
//EventDataType val;
|
||||||
@ -1112,10 +1112,10 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
|||||||
val = QString::number(d.value()[0], 'f', 2);
|
val = QString::number(d.value()[0], 'f', 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
z += "\r\n" + m_label + ": " + val;
|
strTooltip += "\r\n" + m_label + ": " + val;
|
||||||
|
|
||||||
if (m_type[1] == ST_SESSIONS) {
|
if (m_type[1] == ST_SESSIONS) {
|
||||||
z += " "+QString(QObject::tr("(Sess: %1)")).arg(day->size(), 0);
|
strTooltip += " "+QString(QObject::tr("(Sess: %1)")).arg(day->size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventDataType v = m_times[zd][0];
|
EventDataType v = m_times[zd][0];
|
||||||
@ -1123,9 +1123,9 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
|||||||
|
|
||||||
if (lastt < 0) { lastt = 0; }
|
if (lastt < 0) { lastt = 0; }
|
||||||
|
|
||||||
z += "\r\n"+QString(QObject::tr("Bedtime: %1")).arg(formatTime(v, false, false, true));
|
strTooltip += "\r\n"+QString(QObject::tr("Bedtime: %1")).arg(formatTime(v, false, false, true));
|
||||||
v = m_times[zd][lastt] + m_values[zd][lastt];
|
v = m_times[zd][lastt] + m_values[zd][lastt];
|
||||||
z += "\r\n"+QString(QObject::tr("Waketime: %1")).arg(formatTime(v, false, false, true));
|
strTooltip += "\r\n"+QString(QObject::tr("Waketime: %1")).arg(formatTime(v, false, false, true));
|
||||||
|
|
||||||
} else if (m_graphtype == GT_BAR) {
|
} else if (m_graphtype == GT_BAR) {
|
||||||
if (m_type[0] == ST_HOURS) {
|
if (m_type[0] == ST_HOURS) {
|
||||||
@ -1138,11 +1138,11 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
|||||||
val = QString::number(d.value()[0], 'f', 2);
|
val = QString::number(d.value()[0], 'f', 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
z += "\r\n" + m_label + ": " + val;
|
strTooltip += "\r\n" + m_label + ": " + val;
|
||||||
//z+="\r\nMode="+QString::number(day->settings_min("FlexSet"),'f',0);
|
//z+="\r\nMode="+QString::number(day->settings_min("FlexSet"),'f',0);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
QString a;
|
QString strDataType;
|
||||||
|
|
||||||
for (int i = 0; i < m_type.size(); i++) {
|
for (int i = 0; i < m_type.size(); i++) {
|
||||||
if (!m_goodcodes[i]) {
|
if (!m_goodcodes[i]) {
|
||||||
@ -1157,64 +1157,64 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
|||||||
|
|
||||||
switch (m_type[i]) {
|
switch (m_type[i]) {
|
||||||
case ST_WAVG:
|
case ST_WAVG:
|
||||||
a = STR_TR_WAvg;
|
strDataType = STR_TR_WAvg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_AVG:
|
case ST_AVG:
|
||||||
a = STR_TR_Avg;
|
strDataType = STR_TR_Avg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_90P:
|
case ST_90P:
|
||||||
a = QObject::tr("90%");
|
strDataType = QObject::tr("90%");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_PERC:
|
case ST_PERC:
|
||||||
if (tval >= 0.99) { a = STR_TR_Max; }
|
if (tval >= 0.99) { strDataType = STR_TR_Max; }
|
||||||
else if (tval == 0.5) { a = STR_TR_Med; }
|
else if (tval == 0.5) { strDataType = STR_TR_Med; }
|
||||||
else { a = QString("%1%").arg(tval * 100.0, 0, 'f', 0); }
|
else { strDataType = QString("%1%").arg(tval * 100.0, 0, 'f', 0); }
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_MIN:
|
case ST_MIN:
|
||||||
a = STR_TR_Min;
|
strDataType = STR_TR_Min;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_MAX:
|
case ST_MAX:
|
||||||
a = STR_TR_Max;
|
strDataType = STR_TR_Max;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_CPH:
|
case ST_CPH:
|
||||||
a = "";
|
strDataType = "";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_SPH:
|
case ST_SPH:
|
||||||
a = "%";
|
strDataType = "%";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_HOURS:
|
case ST_HOURS:
|
||||||
a = STR_UNIT_Hours;
|
strDataType = STR_UNIT_Hours;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_SESSIONS:
|
case ST_SESSIONS:
|
||||||
a = STR_TR_Sessions;
|
strDataType = STR_TR_Sessions;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_SETMIN:
|
case ST_SETMIN:
|
||||||
a = STR_TR_Min;
|
strDataType = STR_TR_Min;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_SETMAX:
|
case ST_SETMAX:
|
||||||
a = STR_TR_Max;
|
strDataType = STR_TR_Max;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
a = "";
|
strDataType = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_type[i] == ST_SESSIONS) {
|
if (m_type[i] == ST_SESSIONS) {
|
||||||
val = QString::number(d.value()[i + 1], 'f', 0);
|
val = QString::number(d.value()[i + 1], 'f', 0);
|
||||||
z += "\r\n" + a + ": " + val;
|
strTooltip += "\r\n" + strDataType + ": " + val;
|
||||||
} else {
|
} else {
|
||||||
//if (day && (day->channelExists(m_codes[i]) || day->settingExists(m_codes[i]))) {
|
//if (day && (day->channelExists(m_codes[i]) || day->settingExists(m_codes[i]))) {
|
||||||
schema::Channel &chan = schema::channel[m_codes[i]];
|
schema::Channel &chan = schema::channel[m_codes[i]];
|
||||||
@ -1230,26 +1230,24 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
|||||||
val = QString::number(v, 'f', 2);
|
val = QString::number(v, 'f', 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
z += "\r\n" + chan.label() + " " + a + ": " + val;
|
strTooltip += "\r\n" + chan.label() + " " + strDataType + ": " + val;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (summary_only) {
|
if (summary_only) {
|
||||||
z += "\r\n"+QObject::tr("(Summary Only)");
|
strTooltip += "\r\n"+QObject::tr("(Summary Only)");
|
||||||
}
|
}
|
||||||
|
|
||||||
graph->ToolTip(z, x, y - 15);
|
graph->ToolTip(strTooltip, xposLeft, y - 15);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
QString z = dt.toString(Qt::SystemLocaleShortDate) + "\r\n"+QObject::tr("No Data");
|
QString z = dt.toString(Qt::SystemLocaleShortDate) + "\r\n"+QObject::tr("No Data");
|
||||||
graph->ToolTip(z, x, y - 15);
|
graph->ToolTip(z, xposLeft, y - 15);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user