示例#1
0
}
// new Graph\Graph with a background image and drop shadow
$graph = new Graph\Graph(450, 300);
$graph->SetBackgroundImage("tiger_bkg.png", BGIMG_FILLFRAME);
$graph->SetShadow();
// Use an integer X-scale
$graph->SetScale("intlin");
// Set title and subtitle
$graph->title->Set("Combined bar and line plot");
$graph->subtitle->Set("(\"left\" aligned bars)");
// Use built in font
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Make the margin around the plot a little bit bigger
// then default
$graph->img->SetMargin(40, 120, 40, 40);
// Slightly adjust the legend from it's default position in the
// top right corner to middle right side
$graph->legend->Pos(0.05, 0.5, "right", "center");
// Create a red line plot
$p1 = new Plot\LinePlot($datay, $datax);
$p1->SetColor("red");
$p1->SetLegend("Status one");
$graph->Add($p1);
// Create the bar plot
$b1 = new Plot\BarPlot($databary, $databarx);
$b1->SetLegend("Status two");
$b1->SetAlign("left");
$b1->SetShadow();
$graph->Add($b1);
// Finally output the  image
$graph->Stroke();
示例#2
0
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 15);
$graph->title->Set("Cash flow ");
$graph->subtitle->Set("(Department X)");
// Show both X and Y grid
$graph->xgrid->Show(true, false);
// Add 10% grace ("space") at top and botton of Y-scale.
$graph->yscale->SetGrace(10, 10);
// Turn the tick mark out from the plot area
$graph->xaxis->SetTickSide(SIDE_DOWN);
$graph->yaxis->SetTickSide(SIDE_LEFT);
// Create a bar pot
$bplot = new Plot\BarPlot($datay);
$bplot->SetFillColor("orange");
$bplot->SetShadow();
// Show the actual value for each bar on top/bottom
$bplot->value->Show();
$bplot->value->SetFormat("%02d kr");
// Position the X-axis at the bottom of the plotare
$graph->xaxis->SetPos("min");
// .. and add the plot to the graph
$graph->Add($bplot);
// Add mark graph with static lines
$graph->AddLine(new PlotLine(HORIZONTAL, 0, "black", 2));
$graph->AddLine(new PlotLine(VERTICAL, 3, "black", 2));
//$graph->title->Set("Test of bar gradient fill");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");
$graph->yaxis->title->SetFont(FF_ARIAL, FS_BOLD, 11);
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 11);
示例#3
0
$graph->xaxis->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->SetColor('navy');
$graph->yaxis->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->SetColor('navy');
//$graph->ygrid->Show(false);
$graph->ygrid->SetColor('white@0.5');
// Setup graph title
$graph->title->Set('Using a country flag background');
// Some extra margin (from the top)
$graph->title->SetMargin(3);
$graph->title->SetFont(FF_ARIAL, FS_NORMAL, 12);
// Create the three var series we will combine
$bplot1 = new Plot\BarPlot($datay1);
$bplot2 = new Plot\BarPlot($datay2);
$bplot3 = new Plot\BarPlot($datay3);
// Setup the colors with 40% transparency (alpha channel)
$bplot1->SetFillColor('yellow@0.4');
$bplot2->SetFillColor('red@0.4');
$bplot3->SetFillColor('darkgreen@0.4');
// Setup legends
$bplot1->SetLegend('Label 1');
$bplot2->SetLegend('Label 2');
$bplot3->SetLegend('Label 3');
// Setup each bar with a shadow of 50% transparency
$bplot1->SetShadow('black@0.4');
$bplot2->SetShadow('black@0.4');
$bplot3->SetShadow('black@0.4');
$gbarplot = new Plot\GroupBarPlot(array($bplot1, $bplot2, $bplot3));
$gbarplot->SetWidth(0.6);
$graph->Add($gbarplot);
$graph->Stroke();
示例#4
0
$graph->SetShadow();
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 15);
$graph->title->Set("Cash flow ");
$graph->subtitle->Set("Use of static line, 3D and solid band");
// Turn off Y-grid (it's on by default)
$graph->ygrid->Show(false);
// Add 10% grace ("space") at top of Y-scale.
$graph->yscale->SetGrace(10);
$graph->yscale->SetAutoMin(-20);
// Turn the tick mark out from the plot area
$graph->xaxis->SetTickSide(SIDE_DOWN);
$graph->yaxis->SetTickSide(SIDE_LEFT);
// Create a bar pot
$bplot = new Plot\BarPlot($datay);
$bplot->SetFillColor("orange");
$bplot->SetShadow("darkblue");
// Show the actual value for each bar on top/bottom
$bplot->value->Show(true);
$bplot->value->SetFormat("%02d kr");
// Position the X-axis at the bottom of the plotare
$graph->xaxis->SetPos("min");
// .. and add the plot to the graph
$graph->Add($bplot);
// Add upper and lower band and use no frames
$band[0] = new Plot\PlotBand(HORIZONTAL, BAND_3DPLANE, "min", 0, "blue");
$band[0]->ShowFrame(false);
$band[0]->SetDensity(20);
$band[1] = new Plot\PlotBand(HORIZONTAL, BAND_SOLID, 0, "max", "steelblue");
$band[1]->ShowFrame(false);
$graph->Add($band);
$graph->Add(new PlotLine(HORIZONTAL, 0, "black", 2));