View unanswered posts | View active topics It is currently Sat Apr 27, 2024 9:01 pm



Reply to topic  [ 1 post ] 
[PATCH] drawScatterBestFit return Slope and Intercept 
Author Message
Regular pChart user
Regular pChart user

Joined: Mon Dec 19, 2011 12:19 am
Posts: 14
Post [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="")


Wed Jan 04, 2012 11:53 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron