Applied lukasr patch for pchart

This commit is contained in:
fbsanchez 2018-05-22 10:51:03 +02:00
parent 25666e1bff
commit 9f140e6197
1 changed files with 306 additions and 32 deletions

View File

@ -1758,6 +1758,12 @@
$SkippedTickAlpha = isset($Format["SkippedTickAlpha"]) ? $Format["SkippedTickAlpha"] : $TickAlpha-80;
$SkippedInnerTickWidth = isset($Format["SkippedInnerTickWidth"]) ? $Format["SkippedInnerTickWidth"] : 0;
$SkippedOuterTickWidth = isset($Format["SkippedOuterTickWidth"]) ? $Format["SkippedOuterTickWidth"] : 2;
$ScaleModeAuto = isset($Format["ScaleModeAuto"]) ? $Format["ScaleModeAuto"] : FALSE;
$LabelSkipOffset = isset($Format["LabelSkipOffset"]) ? $Format["LabelSkipOffset"] : 0;
$LabelShowBoundaries = isset($Format["LabelShowBoundaries"]) ? $Format["LabelShowBoundaries"] : FALSE;
$DrawXBoundaryLines = isset($Format["DrawXBoundaryLines"]) ? $Format["DrawXBoundaryLines"] : FALSE;
$ScaleModeAutoGridInterval = isset($Format["ScaleModeAutoGridInterval"]) ? $Format["ScaleModeAutoGridInterval"] : 0;
$ScaleModeAutoGridLabel = isset($Format["ScaleModeAutoGridLabel"]) ? $Format["ScaleModeAutoGridLabel"] : FALSE;
/* Floating scale require X & Y margins to be set manually */
if ( $Floating && ( $XMargin == AUTO || $YMargin == 0 ) ) { $Floating = FALSE; }
@ -1884,9 +1890,11 @@
{
$Points = 0;
$AxisName = isset($Data["XAxisName"]) ? $Data["XAxisName"] : NULL;
if (count($Data["Series"]) > 0) {
foreach($Data["Series"] as $SerieID => $SerieParameter)
{ if ( $SerieParameter["isDrawable"] ) { $Points = max($Points,count($SerieParameter["Data"])); } }
}
}
$AxisID = count($Data["Axis"]);
$Data["Axis"][$AxisID]["Identity"] = AXIS_X;
@ -1901,7 +1909,7 @@
if ( $Points == 1 )
$Data["Axis"][$AxisID]["Margin"] = $Height / 2;
else
else if ($Points > 1)
$Data["Axis"][$AxisID]["Margin"] = ($Height/$Points) / 2;
}
else
@ -1938,6 +1946,24 @@
{
if ( $Pos == SCALE_POS_LEFTRIGHT )
{
$Width = ($this->GraphAreaX2 - $this->GraphAreaX1) - $Parameters["Margin"]*2;
if ( $ScaleModeAuto && isset($Data["Series"][$Abscissa]["Data"][0]) ) {
$AbscissaScaleValueMin = $Data["Series"][$Abscissa]["Data"][0];
} else {
$AbscissaScaleValueMin = 0;
}
if ( $ScaleModeAuto && isset($Data["Series"][$Abscissa]["Data"][$Parameters["Rows"]]) ) {
$AbscissaScaleValueMax = $Data["Series"][$Abscissa]["Data"][$Parameters["Rows"]];
} else {
$AbscissaScaleValueMax = $Width;
}
$AbscissaScaleValueWidth = $AbscissaScaleValueMax - $AbscissaScaleValueMin;
if ($AbscissaScaleValueWidth > 0)
$AbscissaScaleFactor = $AbscissaScaleValueWidth / $Width;
else
$AbscissaScaleFactor = 1;
if ( $Parameters["Position"] == AXIS_POSITION_BOTTOM )
{
if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $YLabelOffset = 2; }
@ -1952,14 +1978,22 @@
if ( $DrawArrows ) { $this->drawArrow($this->GraphAreaX2-$Parameters["Margin"],$AxisPos["B"],$this->GraphAreaX2+($ArrowSize*2),$AxisPos["B"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
$Width = ($this->GraphAreaX2 - $this->GraphAreaX1) - $Parameters["Margin"]*2;
if ($Parameters["Rows"] == 0 ) { $Step = $Width; } else { $Step = $Width / ($Parameters["Rows"]); }
$MaxBottom = $AxisPos["B"];
for($i=0;$i<=$Parameters["Rows"];$i++)
{
if ( $ScaleModeAuto && $Abscissa != NULL ) {
if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) {
$AbscissaScaleValue = $Data["Series"][$Abscissa]["Data"][$i] - $AbscissaScaleValueMin;
$XPos = $this->GraphAreaX1 + $Parameters["Margin"] + $AbscissaScaleValue / $AbscissaScaleFactor;
} else {
$XPos = $this->GraphAreaX1 + $Parameters["Margin"] + $Step*$i;
}
} else {
$XPos = $this->GraphAreaX1 + $Parameters["Margin"] + $Step*$i;
}
$YPos = $AxisPos["B"];
if ( $Abscissa != NULL )
@ -1973,7 +2007,7 @@
}
$ID++; $Skipped = TRUE;
if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) )
if ( ($LabelShowBoundaries && ($i==0 || $i==$Parameters["Rows"])) || $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip,$LabelSkipOffset) )
{
$Bounds = $this->drawText($XPos,$YPos+$OuterTickWidth+$YLabelOffset,$Value,array("FontSize"=>$TicksFontSize,"Angle"=>$LabelRotation,"Align"=>$LabelAlign));
$TxtBottom = $YPos+$OuterTickWidth+2+($Bounds[0]["Y"]-$Bounds[2]["Y"]);
@ -1982,6 +2016,11 @@
$Skipped = FALSE;
}
if ( $DrawXBoundaryLines && ($i==0 || $i==$Parameters["Rows"]) )
{
$this->drawLine($XPos,$this->GraphAreaY1+$FloatingOffset,$XPos,$this->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks));
}
if ( $Skipped )
{
if ( $DrawXLines ) { $this->drawLine($XPos,$this->GraphAreaY1+$FloatingOffset,$XPos,$this->GraphAreaY2-$FloatingOffset,$SkippedAxisColor); }
@ -2002,6 +2041,31 @@
}
}
if ( $ScaleModeAuto && ($ScaleModeAutoGridInterval > 0) )
{
$ScaleModeAutoGridIntervalDraw = true;
$ScaleModeAutoGridIntervalStep = 0;
while ($ScaleModeAutoGridIntervalDraw) {
$ScaleModeAutoGridIntervalStep++;
$ScaleModeAutoGridIntervalValue = $ScaleModeAutoGridIntervalStep*$ScaleModeAutoGridInterval;
if ($ScaleModeAutoGridIntervalValue < ($AbscissaScaleValueMax-$AbscissaScaleValueMin)) {
$ScaleModeAutoGridIntervalX = $this->GraphAreaX1 + $Parameters["Margin"] + $ScaleModeAutoGridIntervalValue / $AbscissaScaleFactor;
$this->drawLine($ScaleModeAutoGridIntervalX,$this->GraphAreaY1+$FloatingOffset,$ScaleModeAutoGridIntervalX,$this->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks));
if ($ScaleModeAutoGridLabel) {
$ScaleModeAutoGridLabelDescription = $this->scaleFormat($AbscissaScaleValueMin+$ScaleModeAutoGridIntervalValue,$Data["XAxisDisplay"],$Data["XAxisFormat"],"");
$this->drawText($ScaleModeAutoGridIntervalX,$this->GraphAreaY1+$FloatingOffset+5,$ScaleModeAutoGridLabelDescription,array("Align"=>TEXT_ALIGN_MIDDLERIGHT,"Angle"=>90,"R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>floor($GridAlpha*2)));
}
} else {
$ScaleModeAutoGridIntervalDraw = false;
}
}
}
if ( isset($Parameters["Name"]) )
{
$YPos = $MaxBottom+2;
@ -2028,14 +2092,21 @@
if ( $DrawArrows ) { $this->drawArrow($this->GraphAreaX2-$Parameters["Margin"],$AxisPos["T"],$this->GraphAreaX2+($ArrowSize*2),$AxisPos["T"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
$Width = ($this->GraphAreaX2 - $this->GraphAreaX1) - $Parameters["Margin"]*2;
if ($Parameters["Rows"] == 0 ) { $Step = $Width; } else { $Step = $Width / $Parameters["Rows"]; }
$MinTop = $AxisPos["T"];
for($i=0;$i<=$Parameters["Rows"];$i++)
{
if ( $ScaleModeAuto && $Abscissa != NULL ) {
if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) {
$AbscissaScaleValue = $Data["Series"][$Abscissa]["Data"][$i] - $AbscissaScaleValueMin;
$XPos = $this->GraphAreaX1 + $Parameters["Margin"] + $AbscissaScaleValue / $AbscissaScaleFactor;
} else {
$XPos = $this->GraphAreaX1 + $Parameters["Margin"] + $Step*$i;
}
} else {
$XPos = $this->GraphAreaX1 + $Parameters["Margin"] + $Step*$i;
}
$YPos = $AxisPos["T"];
if ( $Abscissa != NULL )
@ -2049,7 +2120,7 @@
}
$ID++; $Skipped = TRUE;
if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) )
if ( ($LabelShowBoundaries && ($i==0 || $i==$Parameters["Rows"])) || $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip,$LabelSkipOffset) )
{
$Bounds = $this->drawText($XPos,$YPos-$OuterTickWidth-$YLabelOffset,$Value,array("Angle"=>$LabelRotation,"Align"=>$LabelAlign));
$TxtBox = $YPos-$OuterTickWidth-2-($Bounds[0]["Y"]-$Bounds[2]["Y"]);
@ -2058,6 +2129,11 @@
$Skipped = FALSE;
}
if ( $DrawXBoundaryLines && ($i==0 || $i==$Parameters["Rows"]) )
{
$this->drawLine($XPos,$this->GraphAreaY1+$FloatingOffset,$XPos,$this->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks));
}
if ( $Skipped )
{
if ( $DrawXLines ) { $this->drawLine($XPos,$this->GraphAreaY1+$FloatingOffset,$XPos,$this->GraphAreaY2-$FloatingOffset,$SkippedAxisColor); }
@ -2070,6 +2146,31 @@
}
}
if ( $ScaleModeAuto && ($ScaleModeAutoGridInterval > 0) )
{
$ScaleModeAutoGridIntervalDraw = true;
$ScaleModeAutoGridIntervalStep = 0;
while ($ScaleModeAutoGridIntervalDraw) {
$ScaleModeAutoGridIntervalStep++;
$ScaleModeAutoGridIntervalValue = $ScaleModeAutoGridIntervalStep*$ScaleModeAutoGridInterval;
if ($ScaleModeAutoGridIntervalValue < ($AbscissaScaleValueMax-$AbscissaScaleValueMin)) {
$ScaleModeAutoGridIntervalX = $this->GraphAreaX1 + $Parameters["Margin"] + $ScaleModeAutoGridIntervalValue / $AbscissaScaleFactor;
$this->drawLine($ScaleModeAutoGridIntervalX,$this->GraphAreaY1+$FloatingOffset,$ScaleModeAutoGridIntervalX,$this->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks));
if ($ScaleModeAutoGridLabel) {
$ScaleModeAutoGridLabelDescription = $this->scaleFormat($AbscissaScaleValueMin+$ScaleModeAutoGridIntervalValue,$Data["XAxisDisplay"],$Data["XAxisFormat"],"");
$this->drawText($ScaleModeAutoGridIntervalX,$this->GraphAreaY1+$FloatingOffset+5,$ScaleModeAutoGridLabelDescription,array("Align"=>TEXT_ALIGN_MIDDLERIGHT,"Angle"=>90,"R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>floor($GridAlpha*2)));
}
} else {
$ScaleModeAutoGridIntervalDraw = false;
}
}
}
if ( isset($Parameters["Name"]) )
{
$YPos = $MinTop-2;
@ -2085,6 +2186,21 @@
}
elseif ( $Pos == SCALE_POS_TOPBOTTOM )
{
$Height = ($this->GraphAreaY2 - $this->GraphAreaY1) - $Parameters["Margin"]*2;
if ( $ScaleModeAuto && isset($Data["Series"][$Abscissa]["Data"][0]) ) {
$AbscissaScaleValueMin = $Data["Series"][$Abscissa]["Data"][0];
} else {
$AbscissaScaleValueMin = 0;
}
if ( $ScaleModeAuto && isset($Data["Series"][$Abscissa]["Data"][$Parameters["Rows"]]) ) {
$AbscissaScaleValueMax = $Data["Series"][$Abscissa]["Data"][$Parameters["Rows"]];
} else {
$AbscissaScaleValueMax = $Height;
}
$AbscissaScaleValueWidth = $AbscissaScaleValueMax - $AbscissaScaleValueMin;
$AbscissaScaleFactor = $AbscissaScaleValueWidth / $Height;
if ( $Parameters["Position"] == AXIS_POSITION_LEFT )
{
if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = -2; }
@ -2099,14 +2215,21 @@
if ( $DrawArrows ) { $this->drawArrow($AxisPos["L"],$this->GraphAreaY2-$Parameters["Margin"],$AxisPos["L"],$this->GraphAreaY2+($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
$Height = ($this->GraphAreaY2 - $this->GraphAreaY1) - $Parameters["Margin"]*2;
if ($Parameters["Rows"] == 0 ) { $Step = $Height; } else { $Step = $Height / $Parameters["Rows"]; }
$MinLeft = $AxisPos["L"];
for($i=0;$i<=$Parameters["Rows"];$i++)
{
if ( $ScaleModeAuto && $Abscissa != NULL ) {
if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) {
$AbscissaScaleValue = $Data["Series"][$Abscissa]["Data"][$i] - $AbscissaScaleValueMin;
$YPos = $this->GraphAreaY1 + $Parameters["Margin"] + $AbscissaScaleValue / $AbscissaScaleFactor;
} else {
$YPos = $this->GraphAreaY1 + $Parameters["Margin"] + $Step*$i;
}
} else {
$YPos = $this->GraphAreaY1 + $Parameters["Margin"] + $Step*$i;
}
$XPos = $AxisPos["L"];
if ( $Abscissa != NULL )
@ -2120,7 +2243,7 @@
}
$ID++; $Skipped = TRUE;
if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) )
if ( ($LabelShowBoundaries && ($i==0 || $i==$Parameters["Rows"])) || $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip,$LabelSkipOffset) )
{
$Bounds = $this->drawText($XPos-$OuterTickWidth+$XLabelOffset,$YPos,$Value,array("Angle"=>$LabelRotation,"Align"=>$LabelAlign));
$TxtBox = $XPos-$OuterTickWidth-2-($Bounds[1]["X"]-$Bounds[0]["X"]);
@ -2129,6 +2252,11 @@
$Skipped = FALSE;
}
if ( $DrawXBoundaryLines && ($i==0 || $i==$Parameters["Rows"]) )
{
$this->drawLine($this->GraphAreaX1+$FloatingOffset,$YPos,$this->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks));
}
if ( $Skipped )
{
if ( $DrawXLines ) { $this->drawLine($this->GraphAreaX1+$FloatingOffset,$YPos,$this->GraphAreaX2-$FloatingOffset,$YPos,$SkippedAxisColor); }
@ -2141,6 +2269,31 @@
}
}
if ( $ScaleModeAuto && ($ScaleModeAutoGridInterval > 0) )
{
$ScaleModeAutoGridIntervalDraw = true;
$ScaleModeAutoGridIntervalStep = 0;
while ($ScaleModeAutoGridIntervalDraw) {
$ScaleModeAutoGridIntervalStep++;
$ScaleModeAutoGridIntervalValue = $ScaleModeAutoGridIntervalStep*$ScaleModeAutoGridInterval;
if ($ScaleModeAutoGridIntervalValue < ($AbscissaScaleValueMax-$AbscissaScaleValueMin)) {
$ScaleModeAutoGridIntervalY = $this->GraphAreaY1 + $Parameters["Margin"] + $ScaleModeAutoGridIntervalValue / $AbscissaScaleFactor;
$this->drawLine($this->GraphAreaX1+$FloatingOffset,$ScaleModeAutoGridIntervalY,$this->GraphAreaX2-$FloatingOffset,$ScaleModeAutoGridIntervalY,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks));
if ($ScaleModeAutoGridLabel) {
$ScaleModeAutoGridLabelDescription = $this->scaleFormat($AbscissaScaleValueMin+$ScaleModeAutoGridIntervalValue,$Data["XAxisDisplay"],$Data["XAxisFormat"],"");
$this->drawText($this->GraphAreaX2+$FloatingOffset-5,$ScaleModeAutoGridIntervalY,$ScaleModeAutoGridLabelDescription,array("Align"=>TEXT_ALIGN_MIDDLERIGHT,"Angle"=>0,"R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>floor($GridAlpha*2)));
}
} else {
$ScaleModeAutoGridIntervalDraw = false;
}
}
}
if ( isset($Parameters["Name"]) )
{
$XPos = $MinLeft-2;
@ -2167,14 +2320,21 @@
if ( $DrawArrows ) { $this->drawArrow($AxisPos["R"],$this->GraphAreaY2-$Parameters["Margin"],$AxisPos["R"],$this->GraphAreaY2+($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); }
$Height = ($this->GraphAreaY2 - $this->GraphAreaY1) - $Parameters["Margin"]*2;
if ($Parameters["Rows"] == 0 ) { $Step = $Height; } else { $Step = $Height / $Parameters["Rows"]; }
$MaxRight = $AxisPos["R"];
for($i=0;$i<=$Parameters["Rows"];$i++)
{
if ( $ScaleModeAuto && $Abscissa != NULL ) {
if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) {
$AbscissaScaleValue = $Data["Series"][$Abscissa]["Data"][$i] - $AbscissaScaleValueMin;
$YPos = $this->GraphAreaY1 + $Parameters["Margin"] + $AbscissaScaleValue / $AbscissaScaleFactor;
} else {
$YPos = $this->GraphAreaY1 + $Parameters["Margin"] + $Step*$i;
}
} else {
$YPos = $this->GraphAreaY1 + $Parameters["Margin"] + $Step*$i;
}
$XPos = $AxisPos["R"];
if ( $Abscissa != NULL )
@ -2188,7 +2348,7 @@
}
$ID++; $Skipped = TRUE;
if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) )
if ( ($LabelShowBoundaries && ($i==0 || $i==$Parameters["Rows"])) || $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip,$LabelSkipOffset) )
{
$Bounds = $this->drawText($XPos+$OuterTickWidth+$XLabelOffset,$YPos,$Value,array("Angle"=>$LabelRotation,"Align"=>$LabelAlign));
$TxtBox = $XPos+$OuterTickWidth+2+($Bounds[1]["X"]-$Bounds[0]["X"]);
@ -2197,6 +2357,11 @@
$Skipped = FALSE;
}
if ( $DrawXBoundaryLines && ($i==0 || $i==$Parameters["Rows"]) )
{
$this->drawLine($this->GraphAreaX1+$FloatingOffset,$YPos,$this->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks));
}
if ( $Skipped )
{
if ( $DrawXLines ) { $this->drawLine($this->GraphAreaX1+$FloatingOffset,$YPos,$this->GraphAreaX2-$FloatingOffset,$YPos,$SkippedAxisColor); }
@ -2209,6 +2374,31 @@
}
}
if ( $ScaleModeAuto && ($ScaleModeAutoGridInterval > 0) )
{
$ScaleModeAutoGridIntervalDraw = true;
$ScaleModeAutoGridIntervalStep = 0;
while ($ScaleModeAutoGridIntervalDraw) {
$ScaleModeAutoGridIntervalStep++;
$ScaleModeAutoGridIntervalValue = $ScaleModeAutoGridIntervalStep*$ScaleModeAutoGridInterval;
if ($ScaleModeAutoGridIntervalValue < ($AbscissaScaleValueMax-$AbscissaScaleValueMin)) {
$ScaleModeAutoGridIntervalY = $this->GraphAreaY1 + $Parameters["Margin"] + $ScaleModeAutoGridIntervalValue / $AbscissaScaleFactor;
$this->drawLine($this->GraphAreaX1+$FloatingOffset,$ScaleModeAutoGridIntervalY,$this->GraphAreaX2-$FloatingOffset,$ScaleModeAutoGridIntervalY,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks));
if ($ScaleModeAutoGridLabel) {
$ScaleModeAutoGridLabelDescription = $this->scaleFormat($AbscissaScaleValueMin+$ScaleModeAutoGridIntervalValue,$Data["XAxisDisplay"],$Data["XAxisFormat"],"");
$this->drawText($this->GraphAreaX2+$FloatingOffset-5,$ScaleModeAutoGridIntervalY,$ScaleModeAutoGridLabelDescription,array("Align"=>TEXT_ALIGN_MIDDLERIGHT,"Angle"=>0,"R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>floor($GridAlpha*2)));
}
} else {
$ScaleModeAutoGridIntervalDraw = false;
}
}
}
if ( isset($Parameters["Name"]) )
{
$XPos = $MaxRight+4;
@ -2433,12 +2623,12 @@
}
}
function isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip)
function isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip,$LabelSkipOffset=0)
{
if ( $LabelingMethod == LABELING_DIFFERENT && $Value != $LastValue ) { return(TRUE); }
if ( $LabelingMethod == LABELING_DIFFERENT && $Value == $LastValue ) { return(FALSE); }
if ( $LabelingMethod == LABELING_ALL && $LabelSkip == 1 ) { return(TRUE); }
if ( $LabelingMethod == LABELING_ALL && ($ID+$LabelSkip) % ($LabelSkip+1) != 1 ) { return(FALSE); }
if ( $LabelingMethod == LABELING_ALL && $LabelSkip == 0 ) { return(TRUE); }
if ( $LabelingMethod == LABELING_ALL && ($ID+$LabelSkip+$LabelSkipOffset) % ($LabelSkip+1) != 1 ) { return(FALSE); }
return(TRUE);
}
@ -3456,6 +3646,7 @@
$DisplayR = isset($Format["DisplayR"]) ? $Format["DisplayR"] : 0;
$DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0;
$DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0;
$ScaleModeAuto = isset($Format["ScaleModeAuto"]) ? $Format["ScaleModeAuto"] : FALSE;
$Data = $this->DataSet->getData();
list($XMargin,$XDivs) = $this->scaleGetXSettings();
@ -3482,6 +3673,31 @@
$this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0;
$Width = $this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2;
$Height = $this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2;
if ( $ScaleModeAuto && isset($Data["Series"][$Data["Abscissa"]]["Data"][0]) ) {
$AbscissaScaleValueMin = $Data["Series"][$Data["Abscissa"]]["Data"][0];
} else {
$AbscissaScaleValueMin = 0;
}
if ( $ScaleModeAuto && isset($Data["Series"][$Data["Abscissa"]]["Data"][$XDivs]) ) {
$AbscissaScaleValueMax = $Data["Series"][$Data["Abscissa"]]["Data"][$XDivs];
} else {
$AbscissaScaleValueMax = $Width;
}
$AbscissaScaleValueWidth = $AbscissaScaleValueMax - $AbscissaScaleValueMin;
if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
if ($AbscissaScaleValueWidth > 0)
$AbscissaScaleFactor = $AbscissaScaleValueWidth / $Width;
else
$AbscissaScaleFactor = 1;
} else {
if ($AbscissaScaleValueWidth > 0)
$AbscissaScaleFactor = $AbscissaScaleValueWidth / $Height;
else
$AbscissaScaleFactor = 1;
}
if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
{
if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; }
@ -3491,6 +3707,11 @@
$LastGoodY = NULL; $LastGoodX = NULL; $Init = FALSE;
foreach($PosArray as $Key => $Y)
{
if ($ScaleModeAuto) {
$AbscissaScaleValue = $Data["Series"][$Data["Abscissa"]]["Data"][$Key] - $AbscissaScaleValueMin;
$X = $this->GraphAreaX1 + $XMargin + $AbscissaScaleValue / $AbscissaScaleFactor;
}
if ( $DisplayValues && $Serie["Data"][$Key] != VOID )
{
if ( $Y <= $LastY ) { $Align = TEXT_ALIGN_BOTTOMMIDDLE; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_TOPMIDDLE; $Offset = -$DisplayOffset; }
@ -3523,8 +3744,11 @@
if ( !$Init && $ReCenter ) { $X = $X - $XStep/2; $Init = TRUE; }
$LastX = $X; $LastY = $Y;
if ( $LastX < $this->GraphAreaX1 + $XMargin ) { $LastX = $this->GraphAreaX1 + $XMargin; }
if (!$ScaleModeAuto) {
$X = $X + $XStep;
}
}
if ( $ReCenter ) { $this->drawLine($LastX,$LastY,$this->GraphAreaX2 - $XMargin,$LastY,$Color); }
}
else
@ -3536,6 +3760,11 @@
$LastGoodY = NULL; $LastGoodX = NULL; $Init = FALSE;
foreach($PosArray as $Key => $X)
{
if ($ScaleModeAuto) {
$AbscissaScaleValue = $Data["Series"][$Data["Abscissa"]]["Data"][$Key] - $AbscissaScaleValueMin;
$Y = $this->GraphAreaY1 + $XMargin + $AbscissaScaleValue / $AbscissaScaleFactor;
}
if ( $DisplayValues && $Serie["Data"][$Key] != VOID )
{
if ( $X >= $LastX ) { $Align = TEXT_ALIGN_MIDDLELEFT; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_MIDDLERIGHT; $Offset = -$DisplayOffset; }
@ -3565,8 +3794,11 @@
if ( !$Init && $ReCenter ) { $Y = $Y - $YStep/2; $Init = TRUE; }
$LastX = $X; $LastY = $Y;
if ( $LastY < $this->GraphAreaY1 + $XMargin ) { $LastY = $this->GraphAreaY1 + $XMargin; }
if (!$ScaleModeAuto) {
$Y = $Y + $YStep;
}
}
if ( $ReCenter ) { $this->drawLine($LastX,$LastY,$LastX,$this->GraphAreaY2 - $XMargin,$Color); }
}
}
@ -3585,6 +3817,7 @@
$DisplayG = isset($Format["DisplayG"]) ? $Format["DisplayG"] : 0;
$DisplayB = isset($Format["DisplayB"]) ? $Format["DisplayB"] : 0;
$AroundZero = isset($Format["AroundZero"]) ? $Format["AroundZero"] : TRUE;
$ScaleModeAuto = isset($Format["ScaleModeAuto"]) ? $Format["ScaleModeAuto"] : FALSE;
$Data = $this->DataSet->getData();
list($XMargin,$XDivs) = $this->scaleGetXSettings();
@ -3609,6 +3842,31 @@
$this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0;
$Width = $this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2;
$Height = $this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2;
if ( $ScaleModeAuto && isset($Data["Series"][$Data["Abscissa"]]["Data"][0]) ) {
$AbscissaScaleValueMin = $Data["Series"][$Data["Abscissa"]]["Data"][0];
} else {
$AbscissaScaleValueMin = 0;
}
if ( $ScaleModeAuto && isset($Data["Series"][$Data["Abscissa"]]["Data"][$XDivs]) ) {
$AbscissaScaleValueMax = $Data["Series"][$Data["Abscissa"]]["Data"][$XDivs];
} else {
$AbscissaScaleValueMax = $Width;
}
$AbscissaScaleValueWidth = $AbscissaScaleValueMax - $AbscissaScaleValueMin;
if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) {
if ($AbscissaScaleValueWidth > 0)
$AbscissaScaleFactor = $AbscissaScaleValueWidth / $Width;
else
$AbscissaScaleFactor = 1;
} else {
if ($AbscissaScaleValueWidth > 0)
$AbscissaScaleFactor = $AbscissaScaleValueWidth / $Height;
else
$AbscissaScaleFactor = 1;
}
if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT )
{
if ( $YZero > $this->GraphAreaY2-1 ) { $YZero = $this->GraphAreaY2-1; }
@ -3623,6 +3881,11 @@
$LastGoodY = NULL; $LastGoodX = NULL; $Points = ""; $Init = FALSE;
foreach($PosArray as $Key => $Y)
{
if ($ScaleModeAuto) {
$AbscissaScaleValue = $Data["Series"][$Data["Abscissa"]]["Data"][$Key] - $AbscissaScaleValueMin;
$X = $this->GraphAreaX1 + $XMargin + $AbscissaScaleValue / $AbscissaScaleFactor;
}
if ( $Y == VOID && $LastX != NULL && $LastY != NULL && $Points !="" )
{
$Points[] = $LastX; $Points[] = $LastY;
@ -3646,8 +3909,11 @@
if ( !$Init && $ReCenter ) { $X = $X - $XStep/2; $Init = TRUE; }
$LastX = $X; $LastY = $Y;
if ( $LastX < $this->GraphAreaX1 + $XMargin ) { $LastX = $this->GraphAreaX1 + $XMargin; }
if (!$ScaleModeAuto) {
$X = $X + $XStep;
}
}
if ( $ReCenter )
{
@ -3671,6 +3937,11 @@
$LastGoodY = NULL; $LastGoodX = NULL; $Points = "";
foreach($PosArray as $Key => $X)
{
if ($ScaleModeAuto) {
$AbscissaScaleValue = $Data["Series"][$Data["Abscissa"]]["Data"][$Key] - $AbscissaScaleValueMin;
$Y = $this->GraphAreaY1 + $XMargin + $AbscissaScaleValue / $AbscissaScaleFactor;
}
if ( $X == VOID && $LastX != NULL && $LastY != NULL && $Points !="" )
{
$Points[] = $LastX; $Points[] = $LastY;
@ -3694,8 +3965,11 @@
if ( $LastX == NULL && $ReCenter ) { $Y = $Y - $YStep/2; }
$LastX = $X; $LastY = $Y;
if ( $LastY < $this->GraphAreaY1 + $XMargin ) { $LastY = $this->GraphAreaY1 + $XMargin; }
if (!$ScaleModeAuto) {
$Y = $Y + $YStep;
}
}
if ( $ReCenter )
{