PHPackages                             imgchartphp/imgchartphp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. imgchartphp/imgchartphp

ActiveLibrary[Image &amp; Media](/categories/media)

imgchartphp/imgchartphp
=======================

PHP Object wrapper for imagecharts, the drop-in replacement for the Google Image Charts API.

0541PHP

Since Apr 5Pushed 7y ago1 watchersCompare

[ Source](https://github.com/OBCENEIKON/imgchartphp)[ Packagist](https://packagist.org/packages/imgchartphp/imgchartphp)[ RSS](/packages/imgchartphp-imgchartphp/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (2)Used By (0)

PHP Object wrapper for the [imagecharts](https://www.image-charts.com/), the drop in replacement for Google Image Charts API.
=============================================================================================================================

[](#php-object-wrapper-for-the-imagecharts-the-drop-in-replacement-for-google-image-charts-api)

Should help anyone who needs to automate the building of the imagecharts url. Supports (almost) all types of charts. Prerequisites
----------------------------------------------------------------------------------------------------------------------------------

[](#should-help-anyone-who-needs-to-automate-the-building-of-the-imagecharts-url-supports-almost-all-types-of-chartsprerequisites)

To use this API, you should have a little PHP experience; a little patience to read the documentation; and a little persistence to keep trying if your first charts don't look as you expect them to.

Project migration
-----------------

[](#project-migration)

This project was forked from [pacbard/gChartPhp](https://github.com/pacbard/gChartPhp). The original project was migrated from a Google Code project. The original project will continue to be mirrored on its [Google Code page](http://code.google.com/p/gchartphp/).

Use the master branch for stable release, the experimental branch for the development release, and the legacy branch for the old release of the wrapper (this branch will not be actively updated).

Enterprise Credentials
----------------------

[](#enterprise-credentials)

If you've paid for the enterprise version of imagecharts to have the watermark removed. Simply define your account ID and secret key.

Example:

```
define('IC_ACCOUNT_ID', 'YourAccountID');
define('IC_SECRET_KEY', '123YourSecretKeyabc');

```

These values can also be passed in as arguments when building a chart.

Example:

```
$piChart = new imgPieChart(350, 200, 'YourAccountID', '123YourSecretKeyabc');

```

Pie Chart Example
-----------------

[](#pie-chart-example)

[![](https://camo.githubusercontent.com/23b759b327e9fe1c914078fd736b206f7c0fa31661ed2516434141aa3b5a699e/68747470733a2f2f696d6167652d6368617274732e636f6d2f63686172743f6368743d70266368733d33353078323030266368643d743a3131322c3331352c36362c3430266368646c3d66697273747c7365636f6e647c74686972647c666f75727468266368636f3d6666333334342c3131666631312c3232616163632c3333333361612663686c3d66697273747c7365636f6e647c74686972647c666f7572746826696d6167652e706e67)](https://camo.githubusercontent.com/23b759b327e9fe1c914078fd736b206f7c0fa31661ed2516434141aa3b5a699e/68747470733a2f2f696d6167652d6368617274732e636f6d2f63686172743f6368743d70266368733d33353078323030266368643d743a3131322c3331352c36362c3430266368646c3d66697273747c7365636f6e647c74686972647c666f75727468266368636f3d6666333334342c3131666631312c3232616163632c3333333361612663686c3d66697273747c7365636f6e647c74686972647c666f7572746826696d6167652e706e67)

Pie chart using the gPieChart class generated by this code:

```
 $piChart = new imgPieChart();
 // or if you installed via composer
 // $piChart = new imgchart\imgPieChart();

 $piChart->addDataSet(array(112,315,66,40));
 $piChart->setLabels(array("first", "second", "third","fourth"));
 $piChart->setLegend(array("first", "second", "third","fourth"));
 $piChart->setColors(array("ff3344", "11ff11", "22aacc", "3333aa"));
 echo $piChart->getImgCode();

```

Installation via Composer
-------------------------

[](#installation-via-composer)

To install using the Composer framework, first install Composer:

```
 curl -s https://getcomposer.org/installer | php

```

Create a composer.json file in your project root:

```
 {
      "require": {
           "imgchart/imgchartphp": "dev-master"
      }
 }

```

Then run the install:

```
 php composer.phar install

```

Then add this line to your application’s index.php file:

```
