PHP code example of ondram / graphite-graph
1. Go to this page and download the library: Download ondram/graphite-graph 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/ */
ondram / graphite-graph example snippets
$graphUrl = Graphite\GraphBuilder::builder()
->title('Memory')
->vtitle('MiB')
->width(800)
->height(600)
->from('-2days')
->buildSeries('memory-free')
->cactiStyle()
->color('green')
->alias('Free')
->scale(1 / (1024 * 1024)) // B to MiB
->build()
->build()
;
echo '<img src="http://graphite.example.com/render?' . $graphUrl . '">';