mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 19:50:45 +00:00
Ressurected Event Breakdown PIE chart
This commit is contained in:
parent
920f52a49d
commit
fba444d0e5
@ -104,7 +104,7 @@ gFlagsLine::gFlagsLine(ChannelID code,QColor flag_color,QString label,bool alway
|
|||||||
gFlagsLine::~gFlagsLine()
|
gFlagsLine::~gFlagsLine()
|
||||||
{
|
{
|
||||||
//delete lines;
|
//delete lines;
|
||||||
delete quads;
|
//delete quads;
|
||||||
}
|
}
|
||||||
void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
|
void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,7 @@ GLBuffer::GLBuffer(QColor color,int max,int type)
|
|||||||
GLBuffer::~GLBuffer()
|
GLBuffer::~GLBuffer()
|
||||||
{
|
{
|
||||||
if (colors) delete [] colors;
|
if (colors) delete [] colors;
|
||||||
delete [] buffer;
|
if (buffer) delete [] buffer;
|
||||||
}
|
}
|
||||||
void GLBuffer::add(GLshort s)
|
void GLBuffer::add(GLshort s)
|
||||||
{
|
{
|
||||||
@ -178,16 +178,21 @@ void GLBuffer::draw()
|
|||||||
if (antialias) {
|
if (antialias) {
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
if (m_type==GL_LINES) {
|
if (m_type==GL_LINES || m_type==GL_LINE_LOOP) {
|
||||||
glEnable(GL_LINE_SMOOTH);
|
glEnable(GL_LINE_SMOOTH);
|
||||||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||||
size+=0.5;
|
size+=0.5;
|
||||||
|
} else if (m_type==GL_POLYGON) {
|
||||||
|
glEnable(GL_POLYGON_SMOOTH);
|
||||||
|
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_type==GL_LINES) {
|
if (m_type==GL_LINES || m_type==GL_LINE_LOOP) {
|
||||||
glLineWidth(size);
|
glLineWidth(size);
|
||||||
} else if (m_type==GL_POINTS) {
|
} else if (m_type==GL_POINTS) {
|
||||||
glPointSize(size);
|
glPointSize(size);
|
||||||
|
} else if (m_type==GL_POLYGON) {
|
||||||
|
glPolygonMode(GL_BACK,GL_FILL);
|
||||||
}
|
}
|
||||||
if (m_scissor) {
|
if (m_scissor) {
|
||||||
glScissor(s1,s2,s3,s4);
|
glScissor(s1,s2,s3,s4);
|
||||||
@ -221,9 +226,14 @@ void GLBuffer::draw()
|
|||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
m_scissor=false;
|
m_scissor=false;
|
||||||
}
|
}
|
||||||
|
if (m_type==GL_POLYGON) {
|
||||||
|
glPolygonMode(GL_BACK,GL_FILL);
|
||||||
|
}
|
||||||
if (antialias) {
|
if (antialias) {
|
||||||
if (m_type==GL_LINES) {
|
if (m_type==GL_LINES || m_type==GL_LINE_LOOP) {
|
||||||
glDisable(GL_LINE_SMOOTH);
|
glDisable(GL_LINE_SMOOTH);
|
||||||
|
} else if (m_type==GL_POLYGON) {
|
||||||
|
glDisable(GL_POLYGON_SMOOTH);
|
||||||
}
|
}
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
@ -347,6 +357,9 @@ Layer::Layer(ChannelID code)
|
|||||||
|
|
||||||
Layer::~Layer()
|
Layer::~Layer()
|
||||||
{
|
{
|
||||||
|
for (int i=0;i<mgl_buffers.size();i++) {
|
||||||
|
delete mgl_buffers[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void Layer::drawGLBuf()
|
void Layer::drawGLBuf()
|
||||||
{
|
{
|
||||||
@ -1675,7 +1688,7 @@ void gGraphView::paintGL()
|
|||||||
quads->draw();
|
quads->draw();
|
||||||
DrawTextQue();
|
DrawTextQue();
|
||||||
m_tooltip->paint();
|
m_tooltip->paint();
|
||||||
if (pref["ShowDebug"].toBool()) {
|
if (m_showsplitter && pref["ShowDebug"].toBool()) {
|
||||||
QString ss;
|
QString ss;
|
||||||
ss="PreDraw took "+QString::number(elapsed)+"ms";
|
ss="PreDraw took "+QString::number(elapsed)+"ms";
|
||||||
AddTextQue(ss,width()-140,10,0,col,defaultfont);
|
AddTextQue(ss,width()-140,10,0,col,defaultfont);
|
||||||
|
@ -283,6 +283,10 @@ public:
|
|||||||
void ToolTip(QString text, int x, int y, int timeout=2000);
|
void ToolTip(QString text, int x, int y, int timeout=2000);
|
||||||
void redraw();
|
void redraw();
|
||||||
void timedRedraw(int ms);
|
void timedRedraw(int ms);
|
||||||
|
void setMargins(short left,short right,short top,short bottom) {
|
||||||
|
m_marginleft=left; m_marginright=right;
|
||||||
|
m_margintop=top; m_marginbottom=bottom;
|
||||||
|
}
|
||||||
|
|
||||||
GLBuffer * lines();
|
GLBuffer * lines();
|
||||||
GLBuffer * backlines();
|
GLBuffer * backlines();
|
||||||
|
@ -22,7 +22,7 @@ gLineChart::gLineChart(ChannelID code,QColor col,bool square_plot, bool disable_
|
|||||||
}
|
}
|
||||||
gLineChart::~gLineChart()
|
gLineChart::~gLineChart()
|
||||||
{
|
{
|
||||||
delete lines;
|
//delete lines;
|
||||||
//delete outlines;
|
//delete outlines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ gLineOverlayBar::gLineOverlayBar(ChannelID code,QColor color,QString label,FlagT
|
|||||||
gLineOverlayBar::~gLineOverlayBar()
|
gLineOverlayBar::~gLineOverlayBar()
|
||||||
{
|
{
|
||||||
//delete lines;
|
//delete lines;
|
||||||
delete quads;
|
//delete quads;
|
||||||
delete points;
|
//delete points;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int height)
|
void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int height)
|
||||||
|
@ -9,10 +9,16 @@
|
|||||||
|
|
||||||
|
|
||||||
gSegmentChart::gSegmentChart(GraphSegmentType type,QColor gradient_color,QColor outline_color)
|
gSegmentChart::gSegmentChart(GraphSegmentType type,QColor gradient_color,QColor outline_color)
|
||||||
:Layer(""),m_graph_type(type),m_gradient_color(gradient_color),m_outline_color(outline_color)
|
:Layer("EmptyChannel"),m_graph_type(type),m_gradient_color(gradient_color),m_outline_color(outline_color)
|
||||||
{
|
{
|
||||||
// m_gradient_color=QColor(200,200,200);
|
// m_gradient_color=QColor(200,200,200);
|
||||||
m_empty=true;
|
m_empty=true;
|
||||||
|
addGLBuf(poly=new GLBuffer(gradient_color,2000,GL_POLYGON));
|
||||||
|
addGLBuf(lines=new GLBuffer(outline_color,2000,GL_LINE_LOOP));
|
||||||
|
lines->setSize(1);
|
||||||
|
poly->forceAntiAlias(false);
|
||||||
|
lines->forceAntiAlias(true);
|
||||||
|
lines->setAntiAlias(true);
|
||||||
}
|
}
|
||||||
gSegmentChart::~gSegmentChart()
|
gSegmentChart::~gSegmentChart()
|
||||||
{
|
{
|
||||||
@ -56,7 +62,6 @@ void gSegmentChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
{
|
{
|
||||||
if (!m_visible) return;
|
if (!m_visible) return;
|
||||||
if (!m_day) return;
|
if (!m_day) return;
|
||||||
//if (!m_total) return;
|
|
||||||
int start_px=left;
|
int start_px=left;
|
||||||
int start_py=top;
|
int start_py=top;
|
||||||
|
|
||||||
@ -67,7 +72,7 @@ void gSegmentChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
|
|
||||||
float j=0.0;
|
float j=0.0;
|
||||||
float sum=0.0;
|
float sum=0.0;
|
||||||
float step=1.0/45.0;
|
float step=1.0/180.0;
|
||||||
float px,py;
|
float px,py;
|
||||||
float q;
|
float q;
|
||||||
|
|
||||||
@ -88,24 +93,17 @@ void gSegmentChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glEnable(GL_LINE_SMOOTH);
|
|
||||||
glLineWidth(1.5);
|
|
||||||
int data;
|
int data;
|
||||||
unsigned size=m_values.size();
|
unsigned size=m_values.size();
|
||||||
float line_step=float(width)/float(size-1);
|
float line_step=float(width)/float(size-1);
|
||||||
bool line_first=true;
|
bool line_first=true;
|
||||||
int line_last;
|
int line_last;
|
||||||
|
|
||||||
|
GLBuffer *quads=w.quads();
|
||||||
if (m_graph_type==GST_Line) {
|
GLBuffer *lines2=w.lines();
|
||||||
w.qglColor(m_outline_color);
|
|
||||||
glBegin(GL_LINES);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned m=0;m<size;m++) {
|
for (unsigned m=0;m<size;m++) {
|
||||||
data=m_values[m];
|
data=m_values[m];
|
||||||
|
QColor & col=m_colors[m % m_colors.size()];
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Pie Chart
|
// Pie Chart
|
||||||
@ -114,49 +112,33 @@ void gSegmentChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
j=float(data)/float(m_total); // ratio of this pie slice
|
j=float(data)/float(m_total); // ratio of this pie slice
|
||||||
|
|
||||||
// Draw Filling
|
// Draw Filling
|
||||||
glBegin(GL_POLYGON);
|
poly->add(start_px+xoffset, start_py+height-yoffset,m_gradient_color);
|
||||||
glPolygonMode(GL_BACK,GL_FILL);
|
|
||||||
w.qglColor(m_gradient_color);
|
|
||||||
glVertex2f(start_px+xoffset, start_py+height-yoffset);
|
|
||||||
w.qglColor(m_colors[m % m_colors.size()]);
|
|
||||||
for (q=sum;q<sum+j;q+=step) {
|
for (q=sum;q<sum+j;q+=step) {
|
||||||
px=start_px+xoffset+sin(q*2*M_PI)*radius;
|
px=start_px+xoffset+sin(q*2*M_PI)*radius;
|
||||||
py=start_py+height-(yoffset+cos(q*2*M_PI)*radius);
|
py=start_py+height-(yoffset+cos(q*2*M_PI)*radius);
|
||||||
glVertex2f(px,py);
|
poly->add(px,py,col);
|
||||||
}
|
}
|
||||||
q=sum+j;
|
q=sum+j;
|
||||||
px=start_px+xoffset+sin(q*2*M_PI)*radius;
|
px=start_px+xoffset+sin(q*2*M_PI)*radius;
|
||||||
py=start_py+height-(yoffset+cos(q*2*M_PI)*radius);
|
py=start_py+height-(yoffset+cos(q*2*M_PI)*radius);
|
||||||
glVertex2f(px,py);
|
poly->add(px,py,col);
|
||||||
glEnd();
|
|
||||||
|
|
||||||
// Draw Outline
|
|
||||||
//m_outline_color=Qt::red;
|
|
||||||
w.qglColor(m_outline_color);
|
|
||||||
if (m_total>data) { // Draw the center point first
|
if (m_total>data) { // Draw the center point first
|
||||||
//glPolygonMode(GL_BACK,GL_LINE);
|
lines->add(start_px+xoffset, start_py+height-yoffset,m_outline_color);
|
||||||
glBegin(GL_LINE_LOOP);
|
|
||||||
glVertex2f(start_px+xoffset, start_py+height-yoffset);
|
|
||||||
} else { // Only one entry, so just draw the circle
|
|
||||||
glBegin(GL_LINE_LOOP);
|
|
||||||
}
|
}
|
||||||
for (q=sum;q<sum+j;q+=step) {
|
for (q=sum;q<sum+j;q+=step) {
|
||||||
px=start_px+xoffset+sin(q*2*M_PI)*radius;
|
px=start_px+xoffset+sin(q*2*M_PI)*radius;
|
||||||
py=start_py+height-(yoffset+cos(q*2*M_PI)*radius);
|
py=start_py+height-(yoffset+cos(q*2*M_PI)*radius);
|
||||||
glVertex2f(px,py);
|
lines->add(px,py,m_outline_color);
|
||||||
}
|
}
|
||||||
double tpx=start_px+xoffset+sin((sum+(j/2.0))*2*M_PI)*(radius/1.7);
|
double tpx=start_px+xoffset+sin((sum+(j/2.0))*2*M_PI)*(radius/1.7);
|
||||||
double tpy=start_py+height-(yoffset+cos((sum+(j/2.0))*2*M_PI)*(radius/1.7));
|
double tpy=start_py+height-(yoffset+cos((sum+(j/2.0))*2*M_PI)*(radius/1.7));
|
||||||
q=sum+j;
|
q=sum+j;
|
||||||
px=start_px+xoffset+sin(q*2*M_PI)*radius;
|
px=start_px+xoffset+sin(q*2*M_PI)*radius;
|
||||||
py=start_py+height-(yoffset+cos(q*2*M_PI)*radius);
|
py=start_py+height-(yoffset+cos(q*2*M_PI)*radius);
|
||||||
glVertex2f(px,py);
|
lines->add(px,py,m_outline_color);
|
||||||
glEnd();
|
|
||||||
|
|
||||||
if (j>.09) {
|
if (j>.09) {
|
||||||
//glBegin(GL_POINTS);
|
|
||||||
//glVertex2f(tpx,tpy);
|
|
||||||
//glEnd();
|
|
||||||
QString a=m_names[m]; //QString::number(floor(100.0/m_total*data),'f',0)+"%";
|
QString a=m_names[m]; //QString::number(floor(100.0/m_total*data),'f',0)+"%";
|
||||||
int x,y;
|
int x,y;
|
||||||
GetTextExtent(a,x,y);
|
GetTextExtent(a,x,y);
|
||||||
@ -171,23 +153,11 @@ void gSegmentChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
} else if (m_graph_type==GST_CandleStick) {
|
} else if (m_graph_type==GST_CandleStick) {
|
||||||
float bw=xmult*float(data);
|
float bw=xmult*float(data);
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
quads->add(xp,start_py,xp+bw,start_py,m_gradient_color);
|
||||||
w.qglColor(m_gradient_color);
|
quads->add(xp+bw,start_py+height,xp,start_py+height,col);
|
||||||
glVertex2f(xp,start_py);
|
|
||||||
glVertex2f(xp+bw,start_py);
|
|
||||||
w.qglColor(m_colors[m % m_colors.size()]);
|
|
||||||
glVertex2f(xp+bw,start_py+height);
|
|
||||||
glVertex2f(xp,start_py+height);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
w.qglColor(m_outline_color);
|
lines->add(xp,start_py,xp+bw,start_py,m_outline_color);
|
||||||
|
lines->add(xp+bw,start_py+height,xp,start_py+height,m_outline_color);
|
||||||
glBegin(GL_LINE_LOOP);
|
|
||||||
glVertex2f(xp,start_py);
|
|
||||||
glVertex2f(xp+bw,start_py);
|
|
||||||
glVertex2f(xp+bw,start_py+height);
|
|
||||||
glVertex2f(xp,start_py+height);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
if (!m_names[m].isEmpty()) {
|
if (!m_names[m].isEmpty()) {
|
||||||
int px,py;
|
int px,py;
|
||||||
@ -203,19 +173,12 @@ void gSegmentChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
if (line_first) {
|
if (line_first) {
|
||||||
line_first=false;
|
line_first=false;
|
||||||
} else {
|
} else {
|
||||||
glVertex2f(xp,line_last);
|
lines->add(xp,line_last,xp+line_step,h,col);
|
||||||
xp+=line_step;
|
xp+=line_step;
|
||||||
glVertex2f(xp,h);
|
|
||||||
}
|
}
|
||||||
line_last=h;
|
line_last=h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_graph_type==GST_Line) {
|
|
||||||
glEnd();
|
|
||||||
}
|
|
||||||
glPolygonMode(GL_BACK,GL_FILL);
|
|
||||||
glDisable(GL_LINE_SMOOTH);
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ protected:
|
|||||||
QColor m_gradient_color;
|
QColor m_gradient_color;
|
||||||
QColor m_outline_color;
|
QColor m_outline_color;
|
||||||
bool m_empty;
|
bool m_empty;
|
||||||
|
GLBuffer *poly,*lines;
|
||||||
};
|
};
|
||||||
|
|
||||||
class gTAPGraph:public gSegmentChart
|
class gTAPGraph:public gSegmentChart
|
||||||
|
@ -331,20 +331,20 @@ int PRS1Loader::OpenMachine(Machine *m,QString path,Profile *profile)
|
|||||||
//sess->p90(CPAP_EPAP);
|
//sess->p90(CPAP_EPAP);
|
||||||
//sess->p90(CPAP_IPAP);
|
//sess->p90(CPAP_IPAP);
|
||||||
} else {
|
} else {
|
||||||
sess->avg(CPAP_Pressure);
|
//sess->avg(CPAP_Pressure);
|
||||||
sess->wavg(CPAP_Pressure);
|
//sess->wavg(CPAP_Pressure);
|
||||||
sess->p90(CPAP_Pressure);
|
//sess->p90(CPAP_Pressure);
|
||||||
sess->min(CPAP_Pressure);
|
//sess->min(CPAP_Pressure);
|
||||||
sess->max(CPAP_Pressure);
|
//sess->max(CPAP_Pressure);
|
||||||
sess->cph(CPAP_Pressure);
|
//sess->cph(CPAP_Pressure);
|
||||||
|
|
||||||
if (!sess->settings.contains(CPAP_PressureMin)) {
|
if (!sess->settings.contains(CPAP_PressureMin)) {
|
||||||
sess->settings[CPAP_BrokenSummary]=true;
|
sess->settings[CPAP_BrokenSummary]=true;
|
||||||
//sess->set_last(sess->first());
|
//sess->set_last(sess->first());
|
||||||
if (sess->min(CPAP_Pressure)==sess->max(CPAP_Pressure)) {
|
if (sess->min(CPAP_Pressure)==sess->max(CPAP_Pressure)) {
|
||||||
sess->settings["PRS1Mode"]=MODE_CPAP; // no ramp
|
sess->settings[CPAP_Mode]=MODE_CPAP; // no ramp
|
||||||
} else {
|
} else {
|
||||||
sess->settings["PRS1Mode"]=MODE_UNKNOWN;
|
sess->settings[CPAP_Mode]=MODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
//sess->Set("FlexMode",PR_UNKNOWN);
|
//sess->Set("FlexMode",PR_UNKNOWN);
|
||||||
}
|
}
|
||||||
@ -368,6 +368,9 @@ int PRS1Loader::OpenMachine(Machine *m,QString path,Profile *profile)
|
|||||||
//qDebug() << "OpenMachine Done";
|
//qDebug() << "OpenMachine Done";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//bool PRS1Loader::OpenMachine()
|
||||||
|
//{
|
||||||
|
//}
|
||||||
|
|
||||||
bool PRS1Loader::OpenSummary(Session *session,QString filename)
|
bool PRS1Loader::OpenSummary(Session *session,QString filename)
|
||||||
{
|
{
|
||||||
|
59
daily.cpp
59
daily.cpp
@ -54,6 +54,10 @@ Daily::Daily(QWidget *parent,Profile * _profile,gGraphView * shared, MainWindow
|
|||||||
GraphView=new gGraphView(ui->graphMainArea,shared);
|
GraphView=new gGraphView(ui->graphMainArea,shared);
|
||||||
GraphView->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
GraphView->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
snapGV=new gGraphView(ui->graphMainArea,shared);
|
||||||
|
snapGV->setMinimumSize(172,172);
|
||||||
|
snapGV->hideSplitter();
|
||||||
|
snapGV->hide();
|
||||||
scrollbar=new MyScrollBar(ui->graphMainArea);
|
scrollbar=new MyScrollBar(ui->graphMainArea);
|
||||||
scrollbar->setOrientation(Qt::Vertical);
|
scrollbar->setOrientation(Qt::Vertical);
|
||||||
scrollbar->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Expanding);
|
scrollbar->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Expanding);
|
||||||
@ -63,17 +67,6 @@ Daily::Daily(QWidget *parent,Profile * _profile,gGraphView * shared, MainWindow
|
|||||||
layout->addWidget(GraphView,1);
|
layout->addWidget(GraphView,1);
|
||||||
layout->addWidget(scrollbar,0);
|
layout->addWidget(scrollbar,0);
|
||||||
|
|
||||||
// GAHI=new gGraph(GraphView,"Event Breakdown",default_height);
|
|
||||||
/*gSegmentChart * seg=new gSegmentChart(GST_Pie);
|
|
||||||
seg->AddSlice(CPAP_Hypopnea,QColor(0x40,0x40,0xff,0xff),"H");
|
|
||||||
seg->AddSlice(CPAP_Apnea,QColor(0x20,0x80,0x20,0xff),"A");
|
|
||||||
seg->AddSlice(CPAP_Obstructive,QColor(0x40,0xaf,0xbf,0xff),"OA");
|
|
||||||
seg->AddSlice(CPAP_ClearAirway,QColor(0xb2,0x54,0xcd,0xff),"CA");
|
|
||||||
seg->AddSlice(CPAP_RERA,QColor(0xff,0xff,0x80,0xff),"RE");
|
|
||||||
seg->AddSlice(CPAP_FlowLimit,QColor(0x40,0x40,0x40,0xff),"FL");
|
|
||||||
|
|
||||||
SF->AddLayer(AddCPAP(seg),LayerRight,100); */
|
|
||||||
|
|
||||||
SF=new gGraph(GraphView,"Event Flags",default_height);
|
SF=new gGraph(GraphView,"Event Flags",default_height);
|
||||||
FRW=new gGraph(GraphView,"Flow Rate",default_height);
|
FRW=new gGraph(GraphView,"Flow Rate",default_height);
|
||||||
MP=new gGraph(GraphView,"Mask Pressure",default_height);
|
MP=new gGraph(GraphView,"Mask Pressure",default_height);
|
||||||
@ -95,6 +88,21 @@ Daily::Daily(QWidget *parent,Profile * _profile,gGraphView * shared, MainWindow
|
|||||||
SPO2=new gGraph(GraphView,"SPO2",default_height,1);
|
SPO2=new gGraph(GraphView,"SPO2",default_height,1);
|
||||||
PLETHY=new gGraph(GraphView,"Plethy",default_height,1);
|
PLETHY=new gGraph(GraphView,"Plethy",default_height,1);
|
||||||
|
|
||||||
|
// Event Pie Chart (for snapshot purposes)
|
||||||
|
// TODO: Convert snapGV to generic for snapshotting multiple graphs (like reports does)
|
||||||
|
GAHI=new gGraph(snapGV,"Breakdown",172);
|
||||||
|
gSegmentChart * evseg=new gSegmentChart(GST_Pie);
|
||||||
|
evseg->AddSlice(CPAP_Hypopnea,QColor(0x40,0x40,0xff,0xff),"H");
|
||||||
|
evseg->AddSlice(CPAP_Apnea,QColor(0x20,0x80,0x20,0xff),"A");
|
||||||
|
evseg->AddSlice(CPAP_Obstructive,QColor(0x40,0xaf,0xbf,0xff),"OA");
|
||||||
|
evseg->AddSlice(CPAP_ClearAirway,QColor(0xb2,0x54,0xcd,0xff),"CA");
|
||||||
|
evseg->AddSlice(CPAP_RERA,QColor(0xff,0xff,0x80,0xff),"RE");
|
||||||
|
evseg->AddSlice(CPAP_FlowLimit,QColor(0x40,0x40,0x40,0xff),"FL");
|
||||||
|
|
||||||
|
GAHI->AddLayer(AddCPAP(evseg));
|
||||||
|
GAHI->setMargins(0,0,0,0);
|
||||||
|
//SF->AddLayer(AddCPAP(evseg),LayerRight,100);
|
||||||
|
|
||||||
gFlagsGroup *fg=new gFlagsGroup();
|
gFlagsGroup *fg=new gFlagsGroup();
|
||||||
fg->AddLayer((new gFlagsLine(CPAP_CSR,QColor("light green"),"CSR",false,FT_Span)));
|
fg->AddLayer((new gFlagsLine(CPAP_CSR,QColor("light green"),"CSR",false,FT_Span)));
|
||||||
fg->AddLayer((new gFlagsLine(CPAP_ClearAirway,QColor("purple"),"CA",true)));
|
fg->AddLayer((new gFlagsLine(CPAP_ClearAirway,QColor("purple"),"CA",true)));
|
||||||
@ -389,9 +397,11 @@ void Daily::Load(QDate date)
|
|||||||
UpdateOXIGraphs(oxi);
|
UpdateOXIGraphs(oxi);
|
||||||
UpdateCPAPGraphs(cpap);
|
UpdateCPAPGraphs(cpap);
|
||||||
UpdateEventsTree(ui->treeWidget,cpap);
|
UpdateEventsTree(ui->treeWidget,cpap);
|
||||||
|
snapGV->setDay(cpap);
|
||||||
|
|
||||||
|
|
||||||
GraphView->ResetBounds();
|
GraphView->ResetBounds();
|
||||||
|
//snapGV->ResetBounds();
|
||||||
//GraphView->ResetBounds(1);
|
//GraphView->ResetBounds(1);
|
||||||
|
|
||||||
//GraphView->setEmptyText(tr("No Data")); //tr("No data for ")+date.toString(Qt::SystemLocaleLongDate));
|
//GraphView->setEmptyText(tr("No Data")); //tr("No data for ")+date.toString(Qt::SystemLocaleLongDate));
|
||||||
@ -405,6 +415,7 @@ void Daily::Load(QDate date)
|
|||||||
scrollbar->show();
|
scrollbar->show();
|
||||||
}
|
}
|
||||||
GraphView->updateGL();
|
GraphView->updateGL();
|
||||||
|
snapGV->updateGL();
|
||||||
|
|
||||||
//RedrawGraphs();
|
//RedrawGraphs();
|
||||||
|
|
||||||
@ -490,18 +501,18 @@ void Daily::Load(QDate date)
|
|||||||
// ^^ Scratch that.. pie now includes text..
|
// ^^ Scratch that.. pie now includes text..
|
||||||
|
|
||||||
// if (pref["EnableGraphSnapshots"].toBool()) { // AHI Pie Chart
|
// if (pref["EnableGraphSnapshots"].toBool()) { // AHI Pie Chart
|
||||||
// if (ahi+rei+fli>0) {
|
if (ahi+rei+fli>0) {
|
||||||
// html+="</tr>\n<tr><td colspan=4 align=center><i>"+tr("Event Breakdown")+"</i></td></tr>\n";
|
html+="</tr>\n"; //<tr><td colspan=4 align=center><i>"+tr("Event Breakdown")+"</i></td></tr>\n";
|
||||||
// G_AHI->setFixedSize(gwwidth,120);
|
//G_AHI->setFixedSize(gwwidth,120);
|
||||||
// QPixmap pixmap=G_AHI->renderPixmap(gwwidth,120,false); //gwwidth,gwheight,false);
|
QPixmap pixmap=snapGV->renderPixmap(172,172,false); //gwwidth,gwheight,false);
|
||||||
// QByteArray byteArray;
|
QByteArray byteArray;
|
||||||
// QBuffer buffer(&byteArray); // use buffer to store pixmap into byteArray
|
QBuffer buffer(&byteArray); // use buffer to store pixmap into byteArray
|
||||||
// buffer.open(QIODevice::WriteOnly);
|
buffer.open(QIODevice::WriteOnly);
|
||||||
// pixmap.save(&buffer, "PNG");
|
pixmap.save(&buffer, "PNG");
|
||||||
// html += "<tr><td colspan=4 align=center><img src=\"data:image/png;base64," + byteArray.toBase64() + "\"></td></tr>\n";
|
html += "<tr><td colspan=4 align=center><img src=\"data:image/png;base64," + byteArray.toBase64() + "\"></td></tr>\n";
|
||||||
// } else {
|
} else {
|
||||||
// html += "<tr><td colspan=4 align=center><img src=\"qrc:/docs/0.0.gif\"></td></tr>\n";
|
html += "<tr><td colspan=4 align=center><img src=\"qrc:/docs/0.0.gif\"></td></tr>\n";
|
||||||
// }
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
html+="</table>";
|
html+="</table>";
|
||||||
@ -762,7 +773,7 @@ void Daily::UpdateCPAPGraphs(Day *day)
|
|||||||
for (QList<Layer *>::iterator g=CPAPData.begin();g!=CPAPData.end();g++) {
|
for (QList<Layer *>::iterator g=CPAPData.begin();g!=CPAPData.end();g++) {
|
||||||
(*g)->SetDay(day);
|
(*g)->SetDay(day);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
void Daily::UpdateOXIGraphs(Day *day)
|
void Daily::UpdateOXIGraphs(Day *day)
|
||||||
{
|
{
|
||||||
|
3
daily.h
3
daily.h
@ -91,10 +91,9 @@ private:
|
|||||||
//QVBoxLayout *splitter;
|
//QVBoxLayout *splitter;
|
||||||
QMenu *show_graph_menu;
|
QMenu *show_graph_menu;
|
||||||
|
|
||||||
gGraphView *GraphView;
|
gGraphView *GraphView,*snapGV;
|
||||||
MyScrollBar *scrollbar;
|
MyScrollBar *scrollbar;
|
||||||
QHBoxLayout *layout;
|
QHBoxLayout *layout;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DAILY_H
|
#endif // DAILY_H
|
||||||
|
Loading…
Reference in New Issue
Block a user