Actions
Bug #3533
closedWPieChart label percentages are sometimes wrong
Start date:
08/19/2014
Due date:
% Done:
0%
Estimated time:
Description
Hi,
see attached screenshot. More than 100% ;-)
To resolve this issue I would propose to add a setPercentagePrecision() method:
emun Precision
{
PrecisionAuto, ///< %.3g
Precision0, ///< %.0f
Precision1, ///< %.1f
Precision2, ///< %.2f
Precision3, ///< %.3f
};
WPieChart::setPercentagePrecision(Precision prec)
{
prec_ = prec;
}
WPieChart::labelText()
{
...
double per = val / total * 100.0;
switch(prec_) {
case PrecisionAuto:
snprintf(buf, sizeof(buf), "%.3g%%", pre);
break;
case Precision0:
snprintf(buf, sizeof(buf), "%.0f%%", pre);
break;
case Precision1:
snprintf(buf, sizeof(buf), "%.1f%%", pre);
break;
....
}
...
}
and using:
setPercentagePrecision(Precision2);
Any comments?
Stefan
Files
Updated by Stefan Ruppert over 10 years ago
Here are the counts:
Good count: 6824
Not Stopped count: 1
Total count: 6825
Updated by Koen Deforche about 10 years ago
- Status changed from New to InProgress
- Assignee set to Koen Deforche
- Target version set to 3.3.4
Updated by Koen Deforche about 10 years ago
- Status changed from InProgress to Resolved
We've added a WPieChart::setLabelFormat() method which behaves in the same way as WAxis::setLabelFormat().
In this way you can use setLabelFormat(".2f%");
Updated by Koen Deforche about 10 years ago
- Status changed from Resolved to Closed
Actions