Fix InlinePie boundaries and use floats for the PieSlice path coordinates

Use floats as path coordinates in PieSlices, to
avoid that the start and ending position of the arc are at the exact same
position. This would cause buggy behavior, when displaying values like "99,999%".

refs #5863
This commit is contained in:
Matthias Jentsch 2014-03-26 17:06:21 +01:00
parent 15723f088b
commit 2360f21b09
4 changed files with 13 additions and 11 deletions

View File

@ -74,14 +74,14 @@ class Inline {
*
* @var int
*/
protected $height = 20;
protected $height = 100;
/**
* The width in percent
*
* @var int
*/
protected $width = 20;
protected $width = 100;
protected function sanitizeStringArray(array $arr)
{

View File

@ -193,7 +193,9 @@ class PieChart extends Chart
$outerBox = new Canvas('outerGraph', new LayoutBox(0, 0, 100, 100));
$innerBox = new Canvas('graph', new LayoutBox(0, 0, 100, 100));
$labelBox = $ctx->getDocument()->createElement('g');
$innerBox->getLayout()->setPadding(10, 10, 10, 10);
if (!$this->noCaption) {
$innerBox->getLayout()->setPadding(10, 10, 10, 10);
}
$this->createContentClipBox($innerBox);
$this->renderPies($innerBox, $labelBox);
$innerBox->addElement(new RawElement($labelBox));

View File

@ -132,10 +132,10 @@ class PieSlice extends Animatable implements Drawable
$pathString = 'M ' . $x . ' ' . $y . ' ';
// The coordinate system is mirrored on the Y axis, so we have to flip cos and sin
$xStart = $x + intval($r * sin($this->startRadian));
$yStart = $y - intval($r * cos($this->startRadian));
$xEnd = $x + intval($r * sin($this->endRadian));
$yEnd = $y - intval($r * cos($this->endRadian));
$xStart = $x + ($r * sin($this->startRadian));
$yStart = $y - ($r * cos($this->startRadian));
$xEnd = $x + ($r * sin($this->endRadian));
$yEnd = $y - ($r * cos($this->endRadian));
// Draw a straight line to the upper part of the arc
$pathString .= 'L ' . $xStart . ' ' . $yStart;

View File

@ -71,16 +71,16 @@ EOD;
/**
* The width of the rendered chart
*
* @var int The value in percent
* @var int The value in px
*/
private $width = 30;
private $width = 31;
/**
* The height of the rendered chart
*
* @var int The value in perecent
* @var int The value in px
*/
private $height = 30;
private $height = 31;
/**
* The title of the chart