1. Go to this page and download the library: Download iliaal/fastchart 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/ */
iliaal / fastchart example snippets
(new FastChart\LineChart(640, 320))
->setTitle('Daily active users')
->setSeries([['data' => [820, 940, 870, 1020, 1180, 1250, 1340]]])
->setCategoryLabels(['Mon','Tue','Wed','Thu','Fri','Sat','Sun'])
->renderToFile('/tmp/dau.png');
$chart->setJpegQuality(75); // sticks on the chart instance;
$chart->renderJpeg(); // ...used by every render call
$chart->renderJpeg(95); // per-call override (1..100)
$chart->renderWebp(); // default quality 90
$chart->renderWebp(60); // smaller, lossier (1..100)
$chart->setPngCompressionLevel(9); // zlib 0..9 (default 6);
$chart->renderPng(); // ...PNG stays lossless
$chart->renderToFile('/tmp/out.webp'); // setJpegQuality only affects
// .jpg; renderToFile uses the
// built-in WebP default
$chart->setWebpMode(FastChart\Chart::WEBP_LOSSLESS); // archival
$chart->setWebpMode(FastChart\Chart::WEBP_FAST); // preview pipelines
$chart->setWebpMode(FastChart\Chart::WEBP_PHOTO); // photo backgrounds
$chart->setWebpMode(FastChart\Chart::WEBP_DRAWING); // back to default
$chart = (new FastChart\LineChart(640, 320))
->setTitle('Daily active users')
->setSeries([['data' => [820, 940, 870, 1020, 1180, 1250, 1340]]])
->setCategoryLabels(['Mon','Tue','Wed','Thu','Fri','Sat','Sun']);
$svg = $chart->renderSvg(); // full <?xml
$chart->setSvgTextMode(FastChart\Chart::SVG_TEXT_NATIVE);
$svg = $chart->renderSvg(); // ~30% smaller; needs consumer text support
$pdf = $chart->renderPdf(); // PDF document bytes
$chart->renderToFile('/tmp/dau.pdf'); // inferred from the extension