diff --git a/Graphs/gCandleStick.cpp b/Graphs/gCandleStick.cpp index bfd5ceea..8f93606a 100644 --- a/Graphs/gCandleStick.cpp +++ b/Graphs/gCandleStick.cpp @@ -51,6 +51,13 @@ void gCandleStick::Plot(gGraphWindow & w,float scrx,float scry) int width=scrx-(w.GetLeftMargin()+w.GetRightMargin())-1; int height=scry-(w.GetTopMargin()+w.GetBottomMargin())-1; + + for (map<MachineCode,int>::iterator m=m_counts.begin();m!=m_counts.end();m++) { + if (!m->second) continue; + int j=float(m->second)/float(m_total); // ratio of this pie slice + //QColor & col1 = m_colors[m->first]; + //QColor & col2 = m_gradient_color; + } /* float sum=0; for (int i=0;i<data->np[0];i++) sum+=data->point[0][i].y(); diff --git a/Graphs/gCandleStick.h b/Graphs/gCandleStick.h index 3bf21447..82ec4994 100644 --- a/Graphs/gCandleStick.h +++ b/Graphs/gCandleStick.h @@ -19,11 +19,15 @@ class gCandleStick:public gLayer virtual void Plot(gGraphWindow & w,float scrx,float scry); void AddSlice(MachineCode code,QColor color,QString name=""); + void setGradientColor(QColor & color) { m_gradient_color=color; } + void setOutlineColor(QColor & color) { m_outline_color=color; } protected: Qt::Orientation m_orientation; map<MachineCode,int> m_counts; map<MachineCode,QString> m_names; map<MachineCode,QColor> m_colors; + QColor m_gradient_color; + QColor m_outline_color; int m_total; }; diff --git a/Graphs/gpiechart.cpp b/Graphs/gpiechart.cpp index cd22ac82..84cd3be9 100644 --- a/Graphs/gpiechart.cpp +++ b/Graphs/gpiechart.cpp @@ -4,6 +4,7 @@ gPieChart::gPieChart(QColor outline_color) :gLayer(MC_UNKNOWN),m_outline_color(outline_color) { + m_gradient_color=QColor(200,200,200); } gPieChart::~gPieChart() { @@ -57,10 +58,12 @@ void gPieChart::Plot(gGraphWindow & w,float scrx,float scry) for (map<MachineCode,int>::iterator m=m_counts.begin();m!=m_counts.end();m++) { if (!m->second) continue; j=float(m->second)/float(m_total); // ratio of this pie slice - w.qglColor(m_colors[m->first]); glPolygonMode(GL_BACK,GL_FILL); glBegin(GL_POLYGON); + bool first_col; + w.qglColor(m_gradient_color); glVertex2f(start_px+radius+4, start_py+radius+4); + w.qglColor(m_colors[m->first]); double q; for (q=sum;q<sum+j;q+=step) { px=start_px+radius+4+sin(q*2*M_PI)*radius; @@ -75,8 +78,12 @@ void gPieChart::Plot(gGraphWindow & w,float scrx,float scry) glPolygonMode(GL_BACK,GL_LINE); w.qglColor(m_outline_color); - glBegin(GL_POLYGON); - glVertex2f(start_px+radius+4, start_py+radius+4); + if (m_total>m->second) { // Draw the center point first + glBegin(GL_POLYGON); + glVertex2f(start_px+radius+4, start_py+radius+4); + } else { // Only one entry, so just draw the circle + glBegin(GL_LINE_LOOP); + } 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; diff --git a/Graphs/gpiechart.h b/Graphs/gpiechart.h index 6912f639..e26d4ac4 100644 --- a/Graphs/gpiechart.h +++ b/Graphs/gpiechart.h @@ -12,6 +12,8 @@ public: virtual void SetDay(Day *d); void AddSlice(MachineCode code,QColor col,QString name=""); + void setGradientColor(QColor & color) { m_gradient_color=color; } + void setOutlineColor(QColor & color) { m_outline_color=color; } protected: map <MachineCode,QString> m_names; @@ -19,6 +21,8 @@ protected: map <MachineCode,QColor> m_colors; int m_total; QColor m_outline_color; + QColor m_gradient_color; + }; #endif // GPIECHART_H diff --git a/daily.cpp b/daily.cpp index 93f8c9cc..cf80abc0 100644 --- a/daily.cpp +++ b/daily.cpp @@ -271,9 +271,10 @@ Daily::Daily(QWidget *parent,QGLWidget * shared) : //gSplitter->setCollapsible(gSplitter->indexOf(SF),false); //gSplitter->setStretchFactor(gSplitter->indexOf(SF),0); - gSplitter->layout(); - splitter_sizes=gSplitter->sizes(); + gSplitter->layout(); + gSplitter->update(); + QTextCharFormat format = ui->calendar->weekdayTextFormat(Qt::Saturday); format.setForeground(QBrush(Qt::black, Qt::SolidPattern));