2013-06-20 Miguel de Dios <miguel.dedios@artica.es>

* include/graphs/pChart/pPie.class.php, include/graphs/fgraph.php:
	fixed the htmlentities in the pie chart legend, the border was
	fixed for older commits.
	
	MERGED FROM THE BRANCH PANDORA_4.0




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8357 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-06-20 08:20:11 +00:00
parent 9460be66f2
commit 2c3bf6ff9a
3 changed files with 73 additions and 48 deletions

View File

@ -1,3 +1,11 @@
2013-06-20 Miguel de Dios <miguel.dedios@artica.es>
* include/graphs/pChart/pPie.class.php, include/graphs/fgraph.php:
fixed the htmlentities in the pie chart legend, the border was
fixed for older commits.
MERGED FROM THE BRANCH PANDORA_4.0
2013-06-20 Junichi Satoh <junichi@rworks.jp>
* include/help/ja/help_alerts_config.php: Added a new help.

View File

@ -465,6 +465,13 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height,
// This library allows only 8 colors
$max_values = 8;
//Remove the html_entities
$temp = array();
foreach ($chart_data as $key => $value) {
$temp[io_safe_output($key)] = $value;
}
$chart_data = $temp;
if (count($chart_data) > $max_values) {
$chart_data_trunc = array();
$n = 1;

View File

@ -512,54 +512,64 @@
for($j=0;$j<count($Plots);$j=$j+2) { $Top[] = $Plots[$j]; $Top[] = $Plots[$j+1]- $SliceHeight; }
$this->pChartObject->drawPolygon($Top,$Settings);
}
/* Second pass to smooth the angles */
if ( $SecondPass )
{
$Step = 360 / (2 * PI * $Radius);
$Offset = 360; $ID = 0;
foreach($Values as $Key => $Value)
{
$FirstPoint = TRUE;
if ( $Shadow )
$Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
else
{
if ( $Border )
{ $Settings = array("R"=>$Palette[$ID]["R"]+30,"G"=>$Palette[$ID]["G"]+30,"B"=>$Palette[$ID]["B"]+30,"Alpha"=>$Palette[$ID]["Alpha"]); }
else
$Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
}
$EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
if ($DataGapAngle == 0)
{ $X0 = $X; $Y0 = $Y- $SliceHeight; }
else
{
$Angle = ($EndAngle - $Offset)/2 + $Offset;
$X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
$Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius*$SkewFactor + $Y - $SliceHeight;
}
$Plots[] = $X0; $Plots[] = $Y0;
for($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
{
$Xc = cos(($i-90)*PI/180) * $Radius + $X;
$Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y - $SliceHeight;
if ( $FirstPoint ) { $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); } { $FirstPoint = FALSE; }
$this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings);
if ($i < 270 && $i > 90 ) { $this->pChartObject->drawAntialiasPixel($Xc,$Yc+$SliceHeight,$Settings); }
}
$this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings);
$Offset = $i - $DataGapAngle; $ID++;
}
}
/* Second pass to smooth the angles */
if ( $SecondPass )
{
$Step = 360 / (2 * PI * $Radius);
$Offset = 360; $ID = 0;
foreach($Values as $Key => $Value)
{
$FirstPoint = TRUE;
if ( $Shadow )
$Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
else
{
if ( $Border )
{
$Settings = array(
"R" => $Palette[$ID]["R"] + 30,
"G" => $Palette[$ID]["G"] + 30,
"B" => $Palette[$ID]["B"] + 30,
"Alpha" => $Palette[$ID]["Alpha"]);
}
else
$Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
}
$EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
if ($DataGapAngle == 0)
{ $X0 = $X; $Y0 = $Y- $SliceHeight; }
else
{
$Angle = ($EndAngle - $Offset)/2 + $Offset;
$X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
$Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius*$SkewFactor + $Y - $SliceHeight;
}
$Plots[] = $X0; $Plots[] = $Y0;
for ($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
{
$Xc = cos(($i-90)*PI/180) * $Radius + $X;
$Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y - $SliceHeight;
if ( $FirstPoint )
{ $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); }
else
{ $FirstPoint = FALSE; }
$this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings);
if ($i < 270 && $i > 90 )
{ $this->pChartObject->drawAntialiasPixel($Xc,$Yc+$SliceHeight,$Settings); }
}
$this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings);
$Offset = $i - $DataGapAngle; $ID++;
}
}
if ( $WriteValues != NULL )
{
$Step = 360 / (2 * PI * $Radius);