Sessions Overview chart should start at 1

This commit is contained in:
Mark Watkins 2012-01-10 21:10:52 +10:00
parent e81705d3c4
commit 1d1d9435c1
2 changed files with 38 additions and 17 deletions

View File

@ -1050,6 +1050,7 @@ gGraph::gGraph(gGraphView *graphview,QString title,QString units, int height,sho
m_selecting_area=m_blockzoom=false;
m_lastx23=0;
m_quad=new gVertexBuffer(64,GL_QUADS);
m_quad->forceAntiAlias(true);
f_miny=f_maxy=0;
@ -1857,49 +1858,67 @@ void gGraph::ToolTip(QString text, int x, int y, int timeout)
void gGraph::roundY(EventDataType &miny, EventDataType &maxy)
{
if (title()=="Sessions") {
int i=5;
}
int m,t;
bool ymin_good=false,ymax_good=false;
if (rec_miny!=rec_maxy) {
if (miny>rec_miny) miny=rec_miny;
if (maxy<rec_maxy) maxy=rec_maxy;
if (miny>rec_miny)
miny=rec_miny;
if (maxy<rec_maxy)
maxy=rec_maxy;
if (miny==rec_miny) ymin_good=true;
if (maxy==rec_maxy) ymax_good=true;
if (miny==rec_miny)
ymin_good=true;
if (maxy==rec_maxy)
ymax_good=true;
}
if (maxy==miny) {
m=ceil(maxy/2.0);
t=m*2;
if (maxy==t) t+=2;
if (!ymax_good) maxy=t;
if (maxy==t)
t+=2;
if (!ymax_good)
maxy=t;
m=floor(miny/2.0);
t=m*2;
if (miny==t) t-=2;
if (miny>=0 && t<0) t=0;
if (!ymin_good) miny=t;
if (miny==t)
t-=2;
if (miny>=0 && t<0)
t=0;
if (!ymin_good)
miny=t;
return;
}
if (maxy>=400) {
m=ceil(maxy/50.0);
t=m*50;
if (!ymax_good) maxy=t;
if (!ymax_good)
maxy=t;
m=floor(miny/50.0);
if (!ymin_good) miny=m*50;
if (!ymin_good)
miny=m*50;
} else if (maxy>=5) {
m=ceil(maxy/5.0);
t=m*5;
if (!ymax_good) maxy=t;
if (!ymax_good)
maxy=t;
m=floor(miny/5.0);
if (!ymin_good) miny=m*5;
if (!ymin_good)
miny=m*5;
} else {
if (maxy==miny && maxy==0) {
maxy=0.5;
} else {
//maxy*=4.0;
//miny*=4.0;
if (!ymax_good) maxy=ceil(maxy);
if (!ymin_good) miny=floor(miny);
if (!ymax_good)
maxy=ceil(maxy);
if (!ymin_good)
miny=floor(miny);
//maxy/=4.0;
//miny/=4.0;
}

View File

@ -188,8 +188,6 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
set->addSlice(CPAP_PresReliefSet,QColor("red"),ST_SETWAVG);
//set->addSlice(RMS9_EPRSet,QColor("green"),ST_SETWAVG);
//set->addSlice(INTP_SmartFlex,QColor("purple"),ST_SETWAVG);
SET->setRecMinY(0);
SET->setRecMaxY(5);
SET->AddLayer(set);
rr=new SummaryChart(tr("breaths/min"),GT_LINE);
@ -268,6 +266,10 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
ui->rangeCombo->setCurrentIndex(6);
icon_on=new QIcon(":/icons/session-on.png");
icon_off=new QIcon(":/icons/session-off.png");
SES->setRecMinY(1);
SET->setRecMinY(0);
SET->setRecMaxY(5);
}
Overview::~Overview()
{