#1173 Changed the legend text format in the pie chart

This commit is contained in:
Jacob Støren 2017-02-13 08:33:14 +01:00
parent 2e806e0cb7
commit 4d1c4031ef
2 changed files with 3 additions and 3 deletions

View File

@ -371,7 +371,7 @@ void Nightcharts::drawLegend(QPainter *painter)
float x = lX+dist;
float y = lY+dist+i*(painter->fontMetrics().height()+2*dist);
painter->drawRect(x,y,painter->fontMetrics().height(),painter->fontMetrics().height());
painter->drawText(x+painter->fontMetrics().height()+dist,y+painter->fontMetrics().height()/2+dist,pieces[i].pname + " - " + QString::number(pieces[i].pPerc)+"%");
painter->drawText(x+painter->fontMetrics().height()+dist,y+painter->fontMetrics().height()/2+dist,pieces[i].pname + " (" + QString::number(pieces[i].pPerc, 'd', 0)+"%)");
}
break;
}
@ -463,7 +463,7 @@ void pieceNC::setPerc(float Percentage)
pPerc = Percentage;
}
int Nightcharts::pieceCount()
int Nightcharts::pieceCount() const
{
return pieces.count();
}

View File

@ -62,7 +62,7 @@ public:
int setFont(QFont f);
int draw(QPainter *painter);
void drawLegend(QPainter *painter);
int pieceCount();
int pieceCount() const;
double palpha;
private: