This demo shows how to use the GoogleChartRenderer PHP class to dynamically render all types of Google Charts.
src/GoogleChartRenderer.php- The reusable chart rendering classsrc/index.php- Sample usage rendering a Pie Chart
- PHP 7.x or higher
- A web server (e.g., Apache, Nginx) or PHP's built-in server
php -S localhost:8000 -t srcThen open your browser at: http://localhost:8000
Upload the src/ directory to your web server's root and access index.php.
In index.php, you can change:
new GoogleChartRenderer('chartId', 'ChartType')- Chart types:
PieChart,BarChart,GeoChart,LineChart, etc. addColumn(type, label)for defining columnsaddRow([data])to add chart datasetOptions([])to customize appearance