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> 2013-06-20 Junichi Satoh <junichi@rworks.jp>
* include/help/ja/help_alerts_config.php: Added a new help. * 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 // This library allows only 8 colors
$max_values = 8; $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) { if (count($chart_data) > $max_values) {
$chart_data_trunc = array(); $chart_data_trunc = array();
$n = 1; $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; } for($j=0;$j<count($Plots);$j=$j+2) { $Top[] = $Plots[$j]; $Top[] = $Plots[$j+1]- $SliceHeight; }
$this->pChartObject->drawPolygon($Top,$Settings); $this->pChartObject->drawPolygon($Top,$Settings);
} }
/* Second pass to smooth the angles */ /* Second pass to smooth the angles */
if ( $SecondPass ) if ( $SecondPass )
{ {
$Step = 360 / (2 * PI * $Radius); $Step = 360 / (2 * PI * $Radius);
$Offset = 360; $ID = 0; $Offset = 360; $ID = 0;
foreach($Values as $Key => $Value) foreach($Values as $Key => $Value)
{ {
$FirstPoint = TRUE; $FirstPoint = TRUE;
if ( $Shadow ) if ( $Shadow )
$Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa); $Settings = array("R"=>$this->pChartObject->ShadowR,"G"=>$this->pChartObject->ShadowG,"B"=>$this->pChartObject->ShadowB,"Alpha"=>$this->pChartObject->Shadowa);
else else
{ {
if ( $Border ) 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(
$Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]); "R" => $Palette[$ID]["R"] + 30,
} "G" => $Palette[$ID]["G"] + 30,
"B" => $Palette[$ID]["B"] + 30,
$EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; } "Alpha" => $Palette[$ID]["Alpha"]);
}
if ($DataGapAngle == 0) else
{ $X0 = $X; $Y0 = $Y- $SliceHeight; } $Settings = array("R"=>$Palette[$ID]["R"],"G"=>$Palette[$ID]["G"],"B"=>$Palette[$ID]["B"],"Alpha"=>$Palette[$ID]["Alpha"]);
else }
{
$Angle = ($EndAngle - $Offset)/2 + $Offset; $EndAngle = $Offset-($Value*$ScaleFactor); if ( $EndAngle < 0 ) { $EndAngle = 0; }
$X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
$Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius*$SkewFactor + $Y - $SliceHeight; if ($DataGapAngle == 0)
} { $X0 = $X; $Y0 = $Y- $SliceHeight; }
$Plots[] = $X0; $Plots[] = $Y0; else
{
for($i=$Offset;$i>=$EndAngle;$i=$i-$Step) $Angle = ($EndAngle - $Offset)/2 + $Offset;
{ $X0 = cos(($Angle-90)*PI/180) * $DataGapRadius + $X;
$Xc = cos(($i-90)*PI/180) * $Radius + $X; $Y0 = sin(($Angle-90)*PI/180) * $DataGapRadius*$SkewFactor + $Y - $SliceHeight;
$Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y - $SliceHeight; }
$Plots[] = $X0; $Plots[] = $Y0;
if ( $FirstPoint ) { $this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings); } { $FirstPoint = FALSE; }
for ($i=$Offset;$i>=$EndAngle;$i=$i-$Step)
$this->pChartObject->drawAntialiasPixel($Xc,$Yc,$Settings); {
if ($i < 270 && $i > 90 ) { $this->pChartObject->drawAntialiasPixel($Xc,$Yc+$SliceHeight,$Settings); } $Xc = cos(($i-90)*PI/180) * $Radius + $X;
} $Yc = sin(($i-90)*PI/180) * $Radius*$SkewFactor + $Y - $SliceHeight;
$this->pChartObject->drawLine($Xc,$Yc,$X0,$Y0,$Settings);
if ( $FirstPoint )
$Offset = $i - $DataGapAngle; $ID++; { $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 ) if ( $WriteValues != NULL )
{ {
$Step = 360 / (2 * PI * $Radius); $Step = 360 / (2 * PI * $Radius);