PHP code example of tmilos / google-charts

1. Go to this page and download the library: Download tmilos/google-charts library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tmilos / google-charts example snippets



$dataTable = new DataTable([
    Column::create(ColumnType::STRING())->setLabel('Month'),
    Column::create(ColumnType::NUMBER())->setLabel('Active Members'),
]);
$dataTable->addRows([
    ['July', 123],
    ['Aug', 221],
    ['Sep', 97],
]);

print json_encode($dataTable); // {"cols":[{"type":"string","label":"Month"},{"type":"number","label":"Active Members"}],"rows":[{"c":[{"v":"July"},{"v":123}]},{"c":[{"v":"Aug"},{"v":221}]},{"c":[{"v":"Sep"},{"v":97}]}]}