}
    return array(floor($aVal / 3), "", $c);
}
// Setup a basic graph
$graph = new Graph(400, 300, 'auto');
$graph->SetScale("linlin");
$graph->img->SetMargin(40, 100, 40, 40);
$graph->SetShadow();
$graph->title->Set("Example of ballon scatter plot");
// Use a lot of grace to get large scales
$graph->yaxis->scale->SetGrace(50, 10);
// Make sure X-axis as at the bottom of the graph
$graph->xaxis->SetPos('min');
// Create the scatter plot
$sp1 = new ScatterPlot($datay, $datax);
$sp1->mark->SetType(MARK_FILLEDCIRCLE);
// Uncomment the following two lines to display the values
$sp1->value->Show();
$sp1->value->SetFont(FF_FONT1, FS_BOLD);
// Specify the callback
$sp1->mark->SetCallback("FCallback");
// Setup the legend for plot
$sp1->SetLegend('Year 2002');
// Add the scatter plot to the graph
$graph->Add($sp1);
// ... and send to browser
$graph->Stroke();
?>


Example #2
0
$graph->ynaxis[1]->title->SetFont(FF_FONT1, FS_BOLD, 12);
$graph->ynaxis[1]->SetTitleMargin(45);
$graph->ynaxis[1]->SetColor("black", "black");
$graph->ynaxis[1]->SetLabelFormat('%0.3f');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->Pos(0.01, 0.05);
$graph->legend->SetFont(FF_FONT1, FS_BOLD, 14);
// Create the linear plot
$lineplot = new LinePlot($mph, $times);
$lineplot->SetLegend("Instant Wind Speed");
$lineplot->SetColor("red");
$lineplot2 = new LinePlot($alti, $times);
$lineplot2->SetLegend("Pressure");
$lineplot2->SetColor("black");
//if ($hasgust == 1){
// Create the linear plot
//  $lp1=new LinePlot($gust);
//  $lp1->SetLegend("Peak Wind Gust");
//  $lp1->SetColor("black");
//}
// Create the linear plot
$sp1 = new ScatterPlot($drct, $times);
$sp1->mark->SetType(MARK_FILLEDCIRCLE);
$sp1->mark->SetFillColor("blue");
$sp1->mark->SetWidth(3);
$sp1->SetLegend("Wind Direction");
$graph->Add($sp1);
$graph->AddY(0, $lineplot);
$graph->AddY(1, $lineplot2);
//$graph->AddY2($lp1);
$graph->Stroke();
    }
    //===========
    $graph = new Graph(750, 450);
    $graph->img->SetMargin(40, 40, 40, 80);
    $graph->img->SetAntiAliasing();
    $graph->SetScale("textlin");
    $graph->SetShadow();
    $graph->title->Set(strtoupper($pabrik) . "  FFA " . $periode);
    $graph->title->SetFont(FF_DEFAULT, FS_NORMAL, 14);
    $graph->xaxis->SetFont(FF_DEFAULT, FS_NORMAL, 11);
    $graph->xaxis->SetTickLabels($labels);
    $graph->xaxis->SetLabelAngle(45);
    $p1 = new ScatterPlot($datay1);
    $p2 = new ScatterPlot($datay2);
    $p1->SetLegend('CPO');
    $p2->SetLegend('Kernel');
    $graph->legend->Pos(0.02, 0.03);
    $p1->mark->SetType(MARK_SQUARE);
    $p1->SetImpuls();
    $p1->mark->SetFillColor("red");
    $p1->mark->SetWidth(4);
    $p1->SetColor("blue");
    $p2->mark->SetType(MARK_FILLEDCIRCLE);
    $p2->SetImpuls();
    $p2->mark->SetFillColor("orange");
    $p2->mark->SetWidth(4);
    $p2->SetColor("black");
    $p1->SetCenter();
    $graph->Add(array($p1, $p2));
    $graph->Stroke();
}
Example #4
0
// Set legend box specification
$graph->legend->SetFillColor("white");
$graph->legend->SetLineWeight(2);
// Set X-axis at the minimum value of Y-axis (default will be at 0)
$graph->xaxis->SetPos("min");
// "min" will position the x-axis at the minimum value of the Y-axis
// Extend the margin for the labels on the Y-axis and reverse the direction
// of the ticks on the Y-axis
$graph->yaxis->SetLabelMargin(12);
$graph->xaxis->SetLabelMargin(6);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->xaxis->SetTickSide(SIDE_DOWN);
// Add mark graph with static lines
$line = new PlotLine(HORIZONTAL, 0, "black", 2);
$graph->AddLine($line);
// Create a new impuls type scatter plot
$sp1 = new ScatterPlot($datay, $datax);
$sp1->mark->SetType(MARK_SQUARE);
$sp1->mark->SetFillColor("red");
$sp1->mark->SetWidth(3);
$sp1->SetImpuls();
$sp1->SetColor("blue");
$sp1->SetWeight(1);
$sp1->SetLegend("Non-causal signal");
$graph->Add($sp1);
// Create the envelope plot
$ep1 = new LinePlot($datayenv, $datax);
$ep1->SetStyle("dotted");
$ep1->SetLegend("Positive envelope");
$graph->Add($ep1);
$graph->Stroke();
Example #5
0
    $graph->Add($sp);
    if (count($rv)) {
        if (isset($rvMedianValue)) {
            $datax = array();
            $datay = array();
            foreach ($rv as $x => $y) {
                $datax[] = $x;
                $datay[] = $rvMedianValue;
            }
            $lp = new LinePlot($datay, $datax);
            $lp->SetColor('red');
            $lp->SetWeight(1);
            $graph->Add($lp);
        }
        $datax = array();
        $datay = array();
        foreach ($rv as $x => $y) {
            $datax[] = $x;
            $datay[] = $y;
        }
        $sp = new ScatterPlot($datay, $datax);
        $sp->mark->SetFillColor('red');
        $sp->SetLegend('Repeat View');
        $graph->Add($sp);
    }
}
if (isset($graph)) {
    $graph->Stroke();
} else {
    header("HTTP/1.0 404 Not Found");
}
    }
    //===========
    $graph = new Graph(750, 450);
    $graph->img->SetMargin(70, 40, 40, 80);
    $graph->img->SetAntiAliasing();
    $graph->SetScale("textlin");
    $graph->SetShadow();
    $graph->title->Set(strtoupper($pabrik) . "  Tbs Diolah dan Sisa " . $periode);
    $graph->title->SetFont(FF_DEFAULT, FS_NORMAL, 14);
    $graph->xaxis->SetFont(FF_DEFAULT, FS_NORMAL, 11);
    $graph->xaxis->SetTickLabels($labels);
    $graph->xaxis->SetLabelAngle(45);
    $p1 = new ScatterPlot($datay1);
    $p2 = new ScatterPlot($datay2);
    $p1->SetLegend('Diolah');
    $p2->SetLegend('Sisa');
    $graph->legend->Pos(0.02, 0.03);
    $p1->mark->SetType(MARK_SQUARE);
    $p1->SetImpuls();
    $p1->mark->SetFillColor("red");
    $p1->mark->SetWidth(4);
    $p1->SetColor("blue");
    $p2->mark->SetType(MARK_FILLEDCIRCLE);
    $p2->SetImpuls();
    $p2->mark->SetFillColor("orange");
    $p2->mark->SetWidth(4);
    $p2->SetColor("black");
    $p1->SetCenter();
    $graph->Add(array($p1, $p2));
    $graph->Stroke();
}
Example #7
0
$graph->title->SetFont(FF_FONT1, FS_BOLD, 12);
$graph->yaxis->SetTitle("Wind Direction [Deg]");
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD, 12);
$graph->xaxis->SetTitle("Local Valid Time");
$graph->y2axis->SetTitle("Wind Speed [knots]");
$graph->y2axis->title->SetFont(FF_FONT1, FS_BOLD, 12);
$graph->y2axis->SetTitleMargin(35);
$graph->xaxis->SetTitleMargin(55);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD, 12);
if ($i > 72) {
    $graph->xaxis->SetTextTickInterval(6);
}
//$graph->y2axis->SetColor("blue");
$graph->yaxis->SetColor("blue");
// Create the linear plot
$sp1 = new ScatterPlot($ydata1);
$sp1->mark->SetType(MARK_FILLEDCIRCLE);
$sp1->mark->SetFillColor("blue");
$sp1->mark->SetWidth(3);
$sp1->SetLegend("Wind Dir");
// Create the linear plot
$lineplot1 = new LinePlot($ydata2);
$lineplot1->SetColor("black");
$lineplot1->SetLegend("Wind Speed");
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->Pos(0.1, 0.06, "right", "top");
// Add the plot to the graph
$graph->Add($sp1);
$graph->AddY2($lineplot1);
// Display the graph
$graph->Stroke();