1. Go to this page and download the library: Download catchamonkey/phighcharts 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/ */
catchamonkey / phighcharts example snippets
use Phighchart\Chart;
use Phighchart\Options\Container;
use Phighchart\Options\ExtendedContainer;
use Phighchart\Data;
use Phighchart\Renderer\Pie;
use Phighchart\Renderer\Line;
$extOptions = new ExtendedContainer();
$extOptions->setStickyColour('apples', '#629632');
$extOptions->setStickyColour('oranges', '#CD3700');
$options = new Container('chart');
$options->setRenderTo('chart_example_59');
$options->setMarginRight(130);
$options->setMarginBottom(25);
$titleOptions = new Container('title');
$titleOptions->setText('Monthly Details');
$titleOptions->setX(-20);
$data = new Data();
$data
->addCount('Apples', 32)
->addCount('Oranges', 68)
->addSeries('Apples', array(
'2012-05-01' => 12,
'2012-05-02' => 3,
'2012-05-03' => 33
))
->addSeries('Oranges', array(
'2012-05-01' => 32,
'2012-05-02' => 36,
'2012-05-03' => 18
));
// put it all together
$chart = new Chart();
$chart
->addOptions($options)
->addOptions($titleOptions)
->addOptions($extOptions)
->setData($data)
->setRenderer(new Pie());
// a line chart is similar, and our data container holds series data for this
$lineChart = clone $chart;
$options = new Container('chart');
$options->setRenderTo('chart_example_60');
$options->setMarginRight(130);
$options->setMarginBottom(25);
$lineChart->addOptions($options)->setRenderer(new Line());
// and render in the template
$chart->renderContainer();
// or to change the element rendered
// $chart->renderContainer('span');
$chart->render();
// and for the line
$lineChart->renderContainer();
$lineChart->render();
use Phighchart\Format\Datetime;
//set up chart and chart data
$dateTimeFormat = new Datetime();
$chart->setFormat($dateTimeFormat);
use Phighchart\Format\Datetime;
//set up chart and chart data
$dateTimeFormat = new Datetime();
//for parsing date time string of pattern "1st August, 2012 12:09:32"
$dateTimeFormat->setDateTimeFormat('jS F, Y H:i:s');
$chart->setFormat($dateTimeFormat);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.