bonjour,
j'ai le message d'erreur suivant que je ne sais pas comment resoudre :

Division by zero in C:\wamp\www\Dashboard\jpgraph-3.5.0b1\src\jpgraph_utils.inc.php on line 641

pour le code suivant

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
   // create the date  
   require $_SERVER['DOCUMENT_ROOT'].'Dashboard/math/Forecast.php';
 
    $Forecast = new PHPFinance\Forecast($barre); 
 
    $barre =  $Forecast->exponentialSmoothing($this->tempsforcast,1);
    // create the time forcast  month 
    $datedebut = explode("-",$time[count($time)-1]);
 
    for ($index = 0; $index < $this->tempsforcast; $index++) { 
       $datedebut[0]+=1 ; 
       if ($datedebut[0]>12 ) {$datedebut[0] = 1;
                                $datedebut[1] += 1; } 
 
       $time [] =  $datedebut[0]."-".$datedebut[1] ;      
   }
 
       // Create the regression line
       $lr = new LinearRegression($time,$barre);
 
       list( $stderr, $corr ) = $lr->GetStat();
       list( $xd, $yd ) = $lr->GetY(0,count($barre));
      $lplot2 = new LinePlot($yd);
       $lplot2->SetLegend('extrapolation line');
          $this->graph->Add($lplot2);
       $lplot2->SetWeight(2);
       $lplot2->SetColor('navy');
       $this->graph->xaxis->SetTickLabels($time);
contenu des tableaus :

Array ( [0] => 1-2013 [1] => 2-2013 [2] => 3-2013 [3] => 4-2013 [4] => 5-2013 [5] => 6-2013 [6] => 7-2013 [7] => 8-2013 [8] => 9-2013 [9] => 10-2013 [10] => 11-2013 [11] => 12-2013 [12] => 1-2014 [13] => 2-2014 [14] => 3-2014 [15] => 4-2014 [16] => 5-2014 [17] => 6-2014 )

Array ( [0] => 1 [1] => 1 [2] => 1 [3] => 1 [4] => 1 [5] => 1 [6] => 1 [7] => 1 [8] => 1 [9] => 1 [10] => 1 [11] => 1 [12] => 1 [13] => 1 [14] => 1 [15] => 1 [16] => 1 [17] => 1 )

merci d'avance