$max) $max = $v['value']; if (($v['value'] < $min)||($min == -1)) $min = $v['value']; $somme += $v['value']; } if ($min == $max) $max = $min + 1; if ($somme == 0) return; // Plus il y a de transactions plus la couleur de tracé sera transparente $alpha = 115; $nb = count($data); if ($nb < 50) $alpha = 110; if ($nb < 20) $alpha = 105; if ($nb < 5) $alpha = 0; // Dégradé de 360 couleurs entre la couleur de dessin et le blanc $vColor = getGDcolorGradientArray($vImage, 360, $couleurRGB, $fondRGB, $alpha); // Le rayon du cercle dépend du montant de la transaction //$r0 = $width / 3; //if ($n_data > 1) $r0 *= ($transaction['value'] - $min) / ($max - $min); // Un calculateur de Spline $oCurve = new CubicSplines(); $bornes = [[0,180],[180,360]]; $xc = $x + ($width / 2); $yc = $y + ($height / 2); $coef = 0.3; foreach($data as $transaction) { // Le rayon du cercle dépend du montant de la transaction $r0 = $width / 3; if ($n_data > 1) $r0 *= ($transaction['value'] - $min) / ($max - $min); for($i=0;$i<360;$i++) { $xi = $xc + $r0*cos(deg2rad($i)); $yi = $yc + $r0*sin(deg2rad($i)); imagesetpixel($vImage, $xi, $yi, $vColor[$i]->color); } // Pas de splines sur les r0 trop petits if ($r0 < 20) continue; // Un coef aléatoire $coef = 0.1; $c = rand(0,10); if ($c > 5) $coef = 0.3; if ($c > 7) $coef = 0.8; if ($c > 9) $coef = 1.2; foreach($bornes as $b) { // 1er 1/2 cercle $aCoords = array(); $x0 = $xc; $x1 = $xc; for($i=$b[0];$i<$b[1];$i++) { $valeur = hexdec($transaction['hash'][$i%TX_HASH_LEN]) - 8; $r = $r0+($valeur*$coef); $xi = $xc + $r*cos(deg2rad($i)); $yi = $yc + $r*sin(deg2rad($i)); $aCoords[$xi] = $yi; if ($xi < $x0) $x0 = $xi; if ($xi > $x1) $x1 = $xi; } if ($oCurve) { $oCurve->setInitCoords($aCoords); $r = $oCurve->processCoords(); if ($r) { $curveGraph = new Plot($r); $curveGraph->drawLine($vImage, $vColor, $x0, $x1); } } } } } ?>