Skip to content
PHP Class for generating Toast UI Charts
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
PhpTuiChart
examples
.gitignore
README.md

README.md

php-tui-chart

A PHP wrapper class for generating Toast UI Charts.

Example use:

Include the js and css for TUI Chart:

<link rel="stylesheet" type="text/css" href="https://uicdn.toast.com/tui.chart/latest/tui-chart.min.css" />
<script type="text/javascript" src="https://rawgit.com/nhnent/tui.code-snippet/v1.3.0/dist/tui-code-snippet.js"></script>
<script type="text/javascript" src="https://rawgit.com/nhnent/raphael/v2.2.0b/raphael.js"></script>
<script type="text/javascript" src="https://uicdn.toast.com/tui.chart/latest/tui-chart.min.js"></script>

Page HTML Content:

<div id="chart"></div> <!-- this is where the chart will load in -->

PHP Code:

<?php 
include('../PhpTuiChart/vendor/autoload.php');

    $data = [
    'container_id' =>'chart',
    'keypair' => true,
    'data' => [
        [
            'Tesla' => 20,
            'Chevy' => 40,
            'Chrysler' => 60,
            'Ford' => 80
        ],
        [
            'Tesla' => 30,
            'Chevy' => 40,
            'Chrysler' => 50,
            'Ford' => 10
        ],
        [
            'Tesla' => 50,
            'Chevy' => 60,
            'Chrysler' => 10,
            'Ford' => 70
        ]
    ],
    'categories' => ['Canada', 'China', 'South America'],
    'width' => 800,
    'height' => 400,
    'title' => 'Vehicle Sales for 2017',
    'yAxisLabel' => 'Brands',
    'xAxisLabel' => 'Sales in Millions',

];

$chart = new PhpTuiChart\Draw('lineChart',$data);  // lib uses TUI Chart names: lineChart, barChart, columnChart

echo $chart;
?>

Live examples:

You can’t perform that action at this time.