Coder Social home page Coder Social logo

gchartphp's Introduction

PHP Object wrapper for the Google Chart API

A simple PHP Object wrapper for the Google Chart API. Should help anyone who needs to automate the building of the Google Chart url. Supports (almost) all types of charts. Prerequisites

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

This project was migrated from a Google Code project. This project will continue to be mirrored on its Google Code page.

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).

Pie Chart Example

Pie chart using the gPieChart class generated by this code:

 $piChart = new gPieChart();
 // or if you installed via composer
 // $piChart = new gchart\gPieChart();
 
 $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

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": {
           "gchartphp/gchartphp": "dev-master"
      }
 }

Then run the install:

 php composer.phar install

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

 <?php
 require 'vendor/autoload.php';

More info on using Composer: https://getcomposer.org/doc/00-intro.md

Notes

  • The version that was first committed to GITHub is the same that the one on Google Code. Future commits will be reserved to GITHub.
  • I am pleased with how the code is shaping up. I haven't had much of an opportunity in the past to play with inheritence and polymorphism in PHP.

Change Log

20110903 - Fixed encodeData2 bug in gChart.php 20110816 - PEAR branch merged in master. Legacy branch created with the old files

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.