PHP code example of ghunti / highcharts-php

1. Go to this page and download the library: Download ghunti/highcharts-php 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/ */

    

ghunti / highcharts-php example snippets


//This will create a highchart chart with the jquery js engine
$chart = new Highchart();

//To create a highstock chart with the jquery js engine
$stockChart = new Highchart(Highchart::HIGHSTOCK);

//Create a highchart chart with the mootools js engine
$chartWithMootools = new Highchart(null, Highchart::ENGINE_MOOTOOLS);

$chart->title = array('text' => 'Monthly Average Temperature', 'x' => -20);
or
$chart->title->text = 'Monthly Average Temperature';
$chart->title->x = -20;

$chart->series[] = array('name' => 'Tokyo', 'data' => array(7.0, 6.9, 9.5));
or
$chart->series[0] = array('name' => 'Tokyo', 'data' => array(7.0, 6.9, 9.5));
or
$chart->series[0]->name = 'Tokyo';
$chart->series[0]->data = array(7.0, 6.9, 9.5);

$chart->printScripts();

$chart->printScripts(true);

echo $chart->render("chart");

$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=range.json&callback=?', function(data) {
    $('#container').highcharts( echo $chart->renderOptions(); 

$chart->tooltip->formatter = new HighchartJsExpr("function() {
        return '' + this.series.name + this.x + ': ' + this.y + '°C';
    }"
);

$chart->addExtraScript('export', 'http://code.highcharts.com/modules/', 'exporting.js');

$chart->

$chart->

$chart->

$chart = new Highchart();
$chart->

$backgroundOptions = new HighchartOption();
$backgroundOptions->radialGradient = array(
    'cx' => 0.5,
    'cy' => -0.4,
    'r' => 1.9
);
...
$chart->pane->background[] = array(
    new stdClass(),
    array('backgroundColor' => new HighchartJsExpr('Highcharts.svg ? ' .
        HighchartOptionRenderer::render($backgroundOptions) . ' : null')
    )
);

$option = new HighchartOption();
$option->global->useUTC = false;
echo Highchart::setOptions($option);

$theme = new HighchartOption();
//Code your theme as if this was a chart
$theme->colors = array('#058DC7', '#50B432', '#ED561B');
...
echo Highchart::setOptions($theme);

$chart = new Highchart();
$chart->setConfigurations(
    array(
        'jQuery' => array(
            'name' => 'anotherName'
        )
    )
);
json
{
    "hunti/highcharts-php": "^4"
    }
}