$graph = new Graph(400, 300); $lineplot = new LinePlot([1, 3, 2, 5]); $graph->Add($lineplot); $graph->Stroke();
$graph = new Graph(400, 300); $barplot = new BarPlot([10, 20, 30, 40]); $graph->Add($barplot); $graph->Stroke();
$data = [30, 50, 20]; $graph = new PieGraph(400, 300); $pieplot = new PiePlot($data); $graph->Add($pieplot); $graph->Stroke();
$graph = new Graph(400, 300); $scatterplot = new ScatterPlot([[-1, 2], [3, 5], [5, 3]]); $graph->Add($scatterplot); $graph->Stroke();This code creates a scatter plot with three data points. Package library: JpGraph Overall, there are multiple package libraries that can be used for PHP Graph draw, such as JpGraph, PHPlot, and ChartDirector.