mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 02:30:44 +00:00
Graph Y axis scaling improvements, AHI graph edge fixes
This commit is contained in:
parent
d02bf56570
commit
9bf2f5ce97
@ -897,6 +897,9 @@ gGraph::gGraph(gGraphView *graphview,QString title,int height,short group) :
|
||||
m_quad->forceAntiAlias(true);
|
||||
f_miny=f_maxy=0;
|
||||
m_forceMinY=m_forceMaxY=false;
|
||||
rec_miny=rec_maxy=0;
|
||||
m_recMinY=true;
|
||||
m_recMaxY=false;
|
||||
}
|
||||
gGraph::~gGraph()
|
||||
{
|
||||
@ -1597,33 +1600,43 @@ void gGraph::ToolTip(QString text, int x, int y, int timeout)
|
||||
void gGraph::roundY(EventDataType &miny, EventDataType &maxy)
|
||||
{
|
||||
int m;
|
||||
if (m_recMinY) {
|
||||
if (miny>rec_miny)
|
||||
miny=rec_miny;
|
||||
}
|
||||
if (m_recMaxY) {
|
||||
if (maxy<rec_maxy) {
|
||||
maxy=rec_maxy;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (maxy>500) {
|
||||
m=ceil(maxy/100.0);
|
||||
maxy=m*100;
|
||||
m=floor(miny/100.0);
|
||||
miny=m*100;
|
||||
//m=floor(miny/100.0);
|
||||
//miny=m*100;
|
||||
} else if (maxy>150) {
|
||||
m=ceil(maxy/50.0);
|
||||
maxy=m*50;
|
||||
m=floor(miny/50.0);
|
||||
miny=m*50;
|
||||
//m=floor(miny/50.0);
|
||||
//miny=m*50;
|
||||
} else if (maxy>100) {
|
||||
m=ceil(maxy/20.0);
|
||||
maxy=m*20;
|
||||
m=floor(miny/20.0);
|
||||
miny=m*20;
|
||||
//m=floor(miny/20.0);
|
||||
//miny=m*20;
|
||||
} else if (maxy>40) {
|
||||
m=ceil(maxy/10.0);
|
||||
m++;
|
||||
maxy=m*10;
|
||||
m=floor(miny/10.0);
|
||||
if(m<0) m--;
|
||||
miny=m*10;
|
||||
//m=floor(miny/10.0);
|
||||
//if(m<0) m--;
|
||||
//miny=m*10;
|
||||
} else if (maxy>=5) {
|
||||
m=ceil(maxy/5.0)+1;
|
||||
maxy=m*5;
|
||||
m=floor(miny/5.0);
|
||||
miny=m*5;
|
||||
//m=floor(miny/5.0);
|
||||
//miny=m*5;
|
||||
} else {
|
||||
if (maxy==miny && maxy==0) {
|
||||
maxy=0.5;
|
||||
|
@ -309,11 +309,13 @@ public:
|
||||
virtual void SetMaxY(EventDataType v);
|
||||
virtual void forceMinY(EventDataType v) { f_miny=v; m_forceMinY=true; }
|
||||
virtual void forceMaxY(EventDataType v) { f_maxy=v; m_forceMaxY=true; }
|
||||
virtual void recMinY(EventDataType v) { rec_miny=v; m_recMinY=true; }
|
||||
virtual void recMaxY(EventDataType v) { rec_maxy=v; m_recMaxY=true; }
|
||||
|
||||
void resize(int width, int height); // margin recalcs..
|
||||
|
||||
qint64 max_x,min_x,rmax_x,rmin_x;
|
||||
EventDataType max_y,min_y,rmax_y,rmin_y, f_miny, f_maxy;
|
||||
EventDataType max_y,min_y,rmax_y,rmin_y, f_miny, f_maxy, rec_miny, rec_maxy;
|
||||
void unforceMinY() { m_forceMinY=false; }
|
||||
void unforceMaxY() { m_forceMaxY=false; }
|
||||
bool blockZoom() { return m_blockzoom; }
|
||||
@ -372,6 +374,7 @@ protected:
|
||||
Day * m_day;
|
||||
GLBuffer * m_quad;
|
||||
bool m_forceMinY,m_forceMaxY;
|
||||
bool m_recMinY,m_recMaxY;
|
||||
signals:
|
||||
|
||||
protected slots:
|
||||
|
@ -492,25 +492,35 @@ void AHIChart::paint(gGraph & w,int left, int top, int width, int height)
|
||||
EventDataType yy=maxy-miny;
|
||||
EventDataType ymult=EventDataType(height-3)/yy; // time to pixel conversion multiplier
|
||||
|
||||
bool first=false;
|
||||
bool first=true;
|
||||
double px,py;
|
||||
double lastpx,lastpy;
|
||||
double top1=top+height;
|
||||
bool done=false;
|
||||
for (int i=0;i<m_time.size();i++) {
|
||||
qint64 ti=m_time[i];
|
||||
EventDataType v=m_data[i];
|
||||
if ((ti>=minx) && (ti<maxx)) {
|
||||
if (ti<minx) continue;
|
||||
if (ti>maxx) done=true;
|
||||
if (first) {
|
||||
if (i>0) {
|
||||
ti=m_time[i-1];
|
||||
v=m_data[i-1];
|
||||
i--;
|
||||
}
|
||||
px=left+(double(ti-minx)*xmult);
|
||||
py=top1-(double(v-miny)*ymult);
|
||||
if (!first) {
|
||||
first=true;
|
||||
} else {
|
||||
lines->add(px,py,lastpx,lastpy,m_color);
|
||||
}
|
||||
first=false;
|
||||
} else {
|
||||
px=left+(double(ti-minx)*xmult);
|
||||
py=top1-(double(v-miny)*ymult);
|
||||
lines->add(px,py,lastpx,lastpy,m_color);
|
||||
}
|
||||
lastpx=px;
|
||||
lastpy=py;
|
||||
if (done) break;
|
||||
}
|
||||
lines->scissor(left,w.flipY(top+height+2),width+1,height+1);
|
||||
}
|
||||
|
||||
void AHIChart::SetDay(Day *d)
|
||||
|
@ -13,7 +13,7 @@ License: GPL
|
||||
//********************************************************************************************
|
||||
|
||||
|
||||
//#include <wx/log.h>
|
||||
#include <QDir>
|
||||
#include "zeo_loader.h"
|
||||
#include "SleepLib/machine.h"
|
||||
|
||||
@ -30,6 +30,24 @@ int ZEOLoader::Open(QString & path,Profile *profile)
|
||||
{
|
||||
Q_UNUSED(path)
|
||||
Q_UNUSED(profile)
|
||||
|
||||
QString newpath;
|
||||
|
||||
QString dirtag="zeo";
|
||||
if (path.toLower().endsWith(QDir::separator()+dirtag)) {
|
||||
return 0;
|
||||
//newpath=path;
|
||||
} else {
|
||||
newpath=path+QDir::separator()+dirtag.toUpper();
|
||||
}
|
||||
|
||||
QString filename;
|
||||
|
||||
if (path.toLower().endsWith(".csv")) {
|
||||
|
||||
} else if (path.toLower().endsWith(".dat")) {
|
||||
// not supported.
|
||||
}
|
||||
// ZEO folder structure detection stuff here.
|
||||
|
||||
return 0; // number of machines affected
|
||||
|
@ -188,7 +188,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared, MainWindow *mw)
|
||||
|
||||
PTB->AddLayer(AddCPAP(new gLineChart(CPAP_PTB,Qt::gray,square)));
|
||||
MP->AddLayer(AddCPAP(new gLineChart(CPAP_MaskPressure,Qt::blue,false)));
|
||||
RR->AddLayer(AddCPAP(new gLineChart("RespRate2",Qt::red,false)));
|
||||
RR->AddLayer(AddCPAP(new gLineChart("RespRate2",Qt::red,square)));
|
||||
RR->AddLayer(AddCPAP(new gLineChart(CPAP_RespRate,Qt::darkMagenta,square)));
|
||||
MV->AddLayer(AddCPAP(new gLineChart(CPAP_MinuteVent,Qt::darkCyan,square)));
|
||||
TV->AddLayer(AddCPAP(new gLineChart(CPAP_TidalVolume,Qt::magenta,square)));
|
||||
@ -205,8 +205,13 @@ Daily::Daily(QWidget *parent,gGraphView * shared, MainWindow *mw)
|
||||
PLETHY->AddLayer(AddOXI(new gLineChart(OXI_Plethy,Qt::darkBlue,false)));
|
||||
|
||||
SPO2->forceMaxY(100);
|
||||
SPO2->forceMinY(70);
|
||||
SPO2->forceMinY(75);
|
||||
PULSE->forceMinY(40);
|
||||
|
||||
LEAK->recMinY(0);
|
||||
LEAK->recMaxY(80);
|
||||
PRD->recMinY(4.0);
|
||||
PRD->recMaxY(15.0);
|
||||
for (int i=0;i<ng;i++){
|
||||
graphs[i]->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);
|
||||
graphs[i]->AddLayer(new gXAxis(),LayerBottom,0,20);
|
||||
|
Loading…
Reference in New Issue
Block a user