Blog Help & Support Contact About Login

 Show Nav

PHP Graphs Wrapper

Use this wrapper to make and customize interactive PHP graphs with ZingChart. No JavaScript required.


You can easily install ZingChart via GitHub or Composer.

  • GitHub

    git clone
  • Composer

    composer require zingchart/php_wrapper


You can quickly render charts and graphs easily with these simple steps:

$zc = new ZC(“myGraph”);
$zc->setSeriesData(0, [1,4,2,6,4]);
A simple area chart made with PHP


Quick start with the basics, or use the full functionality options for more extensive customizations with the ZingChart library. These options refer to ‘levels 2 and 3’ in our GitHub’s readme file.

To set an individual attribute or node you may use the following ‘level 2’ function which employs the dot notation syntax:

$zc->setConfig(“legend.header.text”, “Apples vs Oranges”);

With the example above and adding this one line of code we get the following chart.

A simple area chart with a legend, created with PHP

There is another function that you can use if you are already familiar with JSON syntax. This is the ‘level 3’ function. This function accepts a string or json object and will overwrite your previously set configuration:

$config = <<< EOT
  "type": "area",
  "title": {
    "text": "Bushels"
  "subtitle": {
    "text": "Average Consumed"
      "text": "Apples and Oranges"
  "scaleX": {
    "label": {
      "text": "Days"
  "scaleY": {
    "label": {
      "text": "# Bushels"


This will produce:

An area chart with a title, legend, and scales, all made in PHP

Fully Capable

This is simply a wrapper around ZingChart. It allows users to use all the capabilities of the library to quickly build beautiful interactive charts and graphs in PHP.


If you set your graph’s width and/or height attribute(s) to a percentage, then they will scale nicely with your browser window size. To see this effect, click on these PHP graph demos and then resize your browser window by dragging on one of the corners of the window.

Next Steps

Want to learn more about the PHP graph wrapper? Want to start using it?

Fork on GitHub Read our Blog Post