mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-08 04:00:44 +00:00
Even prettier Pie Chart
This commit is contained in:
parent
6f0d0cc6f2
commit
d733a08a38
@ -33,14 +33,14 @@ void gPieChart::Plot(gGraphWindow & w,float scrx,float scry)
|
||||
|
||||
double j=0.0;
|
||||
double sum=0.0;
|
||||
double step=1.0/360.0;
|
||||
double step=1.0/45.0;
|
||||
float px,py;
|
||||
//glEnable(GL_TEXTURE_2D);
|
||||
//glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_BLEND);
|
||||
//glEnable(GL_POLYGON_SMOOTH);
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
glLineWidth(1);
|
||||
glLineWidth(1.5);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
//glBlendFunc( GL_SRC_ALPHA_SATURATE, GL_ONE );
|
||||
//glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
||||
@ -49,30 +49,38 @@ void gPieChart::Plot(gGraphWindow & w,float scrx,float scry)
|
||||
j=(data->point[0][i].y()/total); // ratio of this pie slice
|
||||
QColor col1=color[i % color.size()];
|
||||
w.qglColor(col1);
|
||||
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
||||
glPolygonMode(GL_BACK,GL_FILL);
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex2f(start_px+radius+4, start_py+radius+4);
|
||||
|
||||
for (double q=sum;q<sum+j;q+=step) {
|
||||
double q;
|
||||
for (q=sum;q<sum+j;q+=step) {
|
||||
px=start_px+radius+4+sin(q*2*M_PI)*radius;
|
||||
py=start_py+radius+4+cos(q*2*M_PI)*radius;
|
||||
glVertex2f(px,py);
|
||||
}
|
||||
q=sum+j;
|
||||
px=start_px+radius+4+sin(q*2*M_PI)*radius;
|
||||
py=start_py+radius+4+cos(q*2*M_PI)*radius;
|
||||
glVertex2f(px,py);
|
||||
glEnd();
|
||||
|
||||
glPolygonMode(GL_BACK,GL_LINE);
|
||||
w.qglColor(Qt::black);
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex2f(start_px+radius+4, start_py+radius+4);
|
||||
for (double q=sum;q<sum+j;q+=step) {
|
||||
for (q=sum;q<sum+j;q+=step) {
|
||||
px=start_px+radius+4+sin(q*2*M_PI)*radius;
|
||||
py=start_py+radius+4+cos(q*2*M_PI)*radius;
|
||||
glVertex2f(px,py);
|
||||
}
|
||||
q=sum+j;
|
||||
px=start_px+radius+4+sin(q*2*M_PI)*radius;
|
||||
py=start_py+radius+4+cos(q*2*M_PI)*radius;
|
||||
glVertex2f(px,py);
|
||||
glEnd();
|
||||
|
||||
|
||||
sum+=j;
|
||||
sum=q;
|
||||
}
|
||||
glDisable(GL_POLYGON_SMOOTH);
|
||||
glDisable(GL_BLEND);
|
||||
|
@ -690,7 +690,7 @@ void gGraphWindow::Render(float w, float h)
|
||||
glEnd();
|
||||
} else {
|
||||
|
||||
glClearColor(0,0,0,255);
|
||||
glClearColor(255,255,255,255);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
// glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
|
||||
l->color.push_back(QColor(20,20,20,255));
|
||||
l->color.push_back(QColor("light green"));
|
||||
G_AHI->AddLayer(l);
|
||||
//G_AHI->SetDrawBackground(false);
|
||||
G_AHI->SetDrawBackground(false);
|
||||
//G_AHI->setMaximumSize(2000,30);
|
||||
//TAP->setMaximumSize(2000,30);
|
||||
NoData=new QLabel(tr("No CPAP Data"),gSplitter);
|
||||
|
Loading…
Reference in New Issue
Block a user