[PATCH] drawScatterBestFit return Slope and Intercept
Return an array with 'm' and 'b'. [SeriesYName]['b'] and [SeriesYName]['m']
I'm not sure is the best way... maybe a functiont getMB or something like that?
Code:
--- pScatter.class.php (revisione 180)
+++ pScatter.class.php (copia locale)
@@ -864,6 +864,7 @@
{
$M = (($n*$Sxy)-($Sx*$Sy)) / (($n*$Sxx)-($Sx*$Sx));
$B = (($Sy)-($M*$Sx))/($n);
+ $Result[$Series["Y"]] = array("m" => $M, "b" => $B);
$X1 = $this->getPosArray($Data["Axis"][$SerieXAxis]["ScaleMin"],$SerieXAxis);
$Y1 = $this->getPosArray($M * $Data["Axis"][$SerieXAxis]["ScaleMin"] + $B,$SerieYAxis);
@@ -881,6 +882,7 @@
$this->pChartObject->drawLine($X1,$Y1,$X2,$Y2,$Color);
}
}
+ return $Result;
}
function writeScatterLabel($ScatterSerieID,$Points,$Format="")