Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // include your classes above this code
- $data1y=array(10,55,50,110);
- // Create the graph. These two calls are always required
- $graph = new Graph(800,457,'auto');
- $graph->SetScale("textlin");
- $theme_class=new UniversalTheme;
- $graph->SetTheme($theme_class);
- $graph->SetBox(false);
- $graph->ygrid->SetFill(false);
- $graph->xaxis->SetTickLabels(array('Minimum Score', 'Section Average', 'Your Score', 'Maximum Score'));
- $graph->yaxis->HideLine(false);
- $graph->yaxis->HideTicks(false,false);
- // Create the bar plots
- $b1plot = new BarPlot($data1y);
- // ...and add it to the graph
- $graph->Add($b1plot);
- $graph->title->Set("Demo Graph Test");
- $contentType = 'image/png';
- $gdImgHandler = $graph->Stroke(_IMG_HANDLER);
- // @see http://stackoverflow.com/a/9084110/126431
- ob_start(); // start buffering
- $graph->img->Stream(); // print data to buffer
- $graphData = ob_get_contents(); // retrieve buffer contents
- ob_end_clean(); // stop buffer
- // outputting this in a HTML tag would work like this:
- // $graphBase64 = "data:$contentType;base64," . base64_encode($graphData);
- // echo sprintf('<img src="%s" alt="Graph">', $graphBase64);
- $pdf->Image('@'.$graphData);
Add Comment
Please, Sign In to add comment