Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change link from readme. #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 4 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PHP Object wrapper for the Google Chart API
===========================================
A simple PHP Object wrapper for the <a href="http://code.google.com/apis/chart/image_charts.html">Google Chart API</a>. Should help anyone who needs to automate the building of the Google Chart url. Supports (almost) all types of charts.
A simple PHP Object wrapper for the <a href="https://developers.google.com/chart/">Google Chart API</a>. 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.
Expand All @@ -19,46 +19,14 @@ 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->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

$piChart->setColors = array("ff3344", "11ff11", "22aacc", "3333aa");

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.
* The verion that was first committed to GUTHub is the same that is 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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "gChartPhp/gChartPhp",
"name": "gchartphp/gchartphp",
"description": "PHP Object wrapper for the Google Chart API.",
"keywords": ["Google Charts", "wrapper", "php", "charts"],
"homepage": "https://github.com/pacbard/gChartPhp",
Expand Down
40 changes: 3 additions & 37 deletions gchart/gChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class gChart
* @var string
* @usedby getUrl()
*/
private $baseUrl = "chart.apis.google.com/chart?";
private $baseUrl = "image-charts.com/chart?";

/**
* @brief Data set values.
Expand Down Expand Up @@ -254,40 +254,7 @@ private function simpleEncodeData($data)
return $encodedData;
}
/**
* @brief Specifies the style of an axis.
*
* @param $axisIndex Integer This is a zero-based index into the axis array specified by setVisibleAxes
* @param $axisStyle String You can specify the font size, color, and alignment for axis labels, both custom labels and
* default label values. All labels on the same axis have the same format. If you have multiple
* copies of an axis, you can format each one differently. You can also specify the format of a
* label string, for example to show currency symbols or trailing zeroes.
* By default, the top and bottom axes do not show tick marks by the values, while the left and
* right axes do show them.
*
* Refer to official documentation at:
* http://code.google.com/apis/chart/image/docs/gallery/bar_charts.html#axis_labels
*/
public function addAxisStyle($axisIndex, $axisStyle)
{
$this->setProperty('chxs', $axisIndex.','.$this->encodeData($axisStyle, '|'), true);
}
/**
* @brief Specifies the style of an axis.
*
* @param $axisIndex Integer This is a zero-based index into the axis array specified by setVisibleAxes
* @param $axisTickLength Integer You can specify long tick marks for specific axes. Typically this is
* used to extend a tick mark across the length of a chart. Use the addAxisStyle()
* method to change the tick mark color.
*
* Refer to official documentation at:
* http://code.google.com/apis/chart/image/docs/gallery/bar_charts.html#axis_labels
*/
public function addAxisTickMarkStyle($axisIndex, $axisTickLength)
{
$this->setProperty('chxtc', $axisIndex.','.$this->encodeData($axisTickLength, '|'), true);
}
/*
* Extended Text.
* @brief Encodes the data as Extended Text.
*
* This specifies integer values from 0-4095, inclusive, encoded by two alphanumeric characters.
*
Expand Down Expand Up @@ -491,7 +458,6 @@ public function setTitle($title)
{
$title = str_replace("\r\n", "|", $title);
$title = str_replace(" ", "+", $title);
$this->setProperty('chtt', $title);
}
/**
* @brief Sets font size and color of the title
Expand Down Expand Up @@ -718,7 +684,7 @@ public function getUrl()
{
$parms[] = $key.'='.$value;
}
return $fullUrl.implode('&amp;', $parms);
return $fullUrl.implode('&', $parms);
}

/**
Expand Down
Loading