From 6f0d0cc6f2d804da26a687b81bfd639adda45a2f Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Wed, 29 Jun 2011 01:30:43 +1000 Subject: [PATCH] Slightly prettier Pie Chart --- Graphs/gpiechart.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Graphs/gpiechart.cpp b/Graphs/gpiechart.cpp index a5626088..7d937963 100644 --- a/Graphs/gpiechart.cpp +++ b/Graphs/gpiechart.cpp @@ -23,7 +23,7 @@ void gPieChart::Plot(gGraphWindow & w,float scrx,float scry) int height=scry-(w.GetTopMargin()+w.GetBottomMargin()); float diameter=MIN(width,height); - diameter-=4; + diameter-=8; float radius=diameter/2.0; double total=0; @@ -38,11 +38,12 @@ void gPieChart::Plot(gGraphWindow & w,float scrx,float scry) //glEnable(GL_TEXTURE_2D); //glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); - glEnable(GL_POLYGON_SMOOTH); + //glEnable(GL_POLYGON_SMOOTH); glEnable(GL_LINE_SMOOTH); + glLineWidth(1); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //glBlendFunc( GL_SRC_ALPHA_SATURATE, GL_ONE ); - glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); + //glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); for (int i=0;inp[0];i++) { j=(data->point[0][i].y()/total); // ratio of this pie slice @@ -50,11 +51,11 @@ void gPieChart::Plot(gGraphWindow & w,float scrx,float scry) w.qglColor(col1); glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); glBegin(GL_POLYGON); - glVertex2f(start_px+radius+2, start_py+radius+2); + glVertex2f(start_px+radius+4, start_py+radius+4); for (double q=sum;q