1. Go to this page and download the library: Download wobeto/easychart 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/ */
wobeto / easychart example snippets
use Wobeto\EasyChart\VerticalBarChart;
use Wobeto\EasyChart\Model\XYDataSet;
use Wobeto\EasyChart\Model\Point;
$chart = new VerticalBarChart(500,250);
$dataSet = new XYDataSet();
$dataSet->addPoint(new Point("2014", 285));
$dataSet->addPoint(new Point("2015", 34));
$chart->setDataSet($dataSet);
$chart->setTitle("Annual usage for easychart");
echo $chart->render();
use Wobeto\EasyChart\HorizontalBarChart;
use Wobeto\EasyChart\Model\XYDataSet;
use Wobeto\EasyChart\Model\Point;
use Wobeto\EasyChart\View\Primitive\Padding;
$chart = new HorizontalBarChart(500, 250);
$dataSet = new XYDataSet();
$dataSet->addPoint(new Point("/wiki/Instant_messenger", 20));
$dataSet->addPoint(new Point("/wiki/Web_Browser", 35));
$dataSet->addPoint(new Point("/wiki/World_Wide_Web", 68));
$chart->setDataSet($dataSet);
$chart->getPlot()->setGraphPadding(new Padding(5, 30, 20, 140));
$chart->setTitle("Most visited pages");
echo $chart->render();
use Wobeto\EasyChart\PieChart;
use Wobeto\EasyChart\Model\XYDataSet;
use Wobeto\EasyChart\Model\Point;
$chart = new PieChart(500, 300);
$dataSet = new XYDataSet();
$dataSet->addPoint(new Point("Mozilla Firefox", 46));
$dataSet->addPoint(new Point("Chrome", 40));
$dataSet->addPoint(new Point("Internet Explorer", 12));
$dataSet->addPoint(new Point("Others", 2));
$chart->setDataSet($dataSet);
$chart->setLabelFormat('%01.2f%%');
$chart->setTitle("User agents for www.example.com");
echo $chart->render();