$vAxisColor = imagecolorallocate($vImage, 0, 0, 0); $vDotColor = imagecolorallocate($vImage, 192, 64, 64); imagefill($vImage, 0, 0, $vBgColor); $oPlot = new Plot($aCoords); $oPlot->drawDots($vImage, $vDotColor, 10, GRAPH_HEIGHT, 8); $oCurve = new CubicSplines(); $vColor = imagecolorallocate($vImage, 225, 64, 64); $iStart = microtime(1); if ($oCurve) { $oCurve->setInitCoords($aCoords, 1); $r = $oCurve->processCoords(); if ($r) { $curveGraph = new Plot($r); } else { continue; } } else { $curveGraph = $oPlot; } $curveGraph->drawLine($vImage, $vColor, 10, GRAPH_HEIGHT); // unset($oCurve); $sTime = sprintf("%1.4f", microtime(1) - $iStart); imagefilledrectangle($vImage, 0, GRAPH_HEIGHT, GRAPH_WIDTH + 50, $vImagegHeight, $vBgColor); $oPlot->drawAxis($vImage, $vAxisColor, 10, GRAPH_HEIGHT); $iPanelY = GRAPH_HEIGHT; imagefilledrectangle($vImage, 10, $iPanelY + 10, 20, $iPanelY + 20, $vColor); imagerectangle($vImage, 10, $iPanelY + 10, 20, $iPanelY + 20, $vAxisColor); imagettftext($vImage, 10, 0, 30, $iPanelY + 20, $vTextColor, 'Ds-digib.ttf', 'Cubic splines in PHP for graphs: ' . $sTime . ' sec'); header("Content-type: image/png"); imagepng($vImage); imagedestroy($vImage);