From b1efb4f536d4c663fbedbe19c1c2c49681622560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franc=CC=A7ois-Guillaume=20RIBREAU?= Date: Thu, 7 Nov 2019 15:57:08 +0100 Subject: [PATCH 1/2] fix(): google image charts is deprecated and will shutdown soon, replace it with Image-Charts.com --- README.md | 14 +++++++------- gchart/gChart.php | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 7af77ec..e2a2b06 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -PHP Object wrapper for the Google Chart API +*FORK* PHP Object wrapper for the ~Google Chart~ [Image-Charts](https://www.image-charts.com) 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. +A simple PHP Object wrapper for the [Image-Charts API](https://www.image-charts.com) (a drop-in-replacement and backward compatible chart API with [Google Image-Charts](http://code.google.com/apis/chart/image_charts.html)). 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. @@ -14,14 +14,14 @@ Use the master branch for stable release, the experimental branch for the develo 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")); @@ -34,8 +34,8 @@ 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: { @@ -43,7 +43,7 @@ Create a composer.json file in your project root: "gchartphp/gchartphp": "dev-master" } } - + Then run the install: php composer.phar install diff --git a/gchart/gChart.php b/gchart/gChart.php index 9fe08ff..51bff1d 100644 --- a/gchart/gChart.php +++ b/gchart/gChart.php @@ -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. @@ -257,14 +257,14 @@ private function simpleEncodeData($data) * @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 + * @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 + * 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: + * Refer to official documentation at: * http://code.google.com/apis/chart/image/docs/gallery/bar_charts.html#axis_labels */ public function addAxisStyle($axisIndex, $axisStyle) @@ -275,18 +275,18 @@ public function addAxisStyle($axisIndex, $axisStyle) * @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() + * @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: + * 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. * * This specifies integer values from 0-4095, inclusive, encoded by two alphanumeric characters. @@ -747,7 +747,7 @@ public function renderImage($post = false) { header('Content-type: image/png'); if ($post) { $this->setDataSetString(); - $url = 'http://chart.apis.google.com/chart?chid=' . md5(uniqid(rand(), true)); + $url = 'http://image-charts.com/chart?chid=' . md5(uniqid(rand(), true)); $context = stream_context_create( array('http' => array( 'method' => 'POST', From 3850bca0a86ca24eb8d2af696abb7b0e9e841cc6 Mon Sep 17 00:00:00 2001 From: Francois-Guillaume Ribreau Date: Thu, 7 Nov 2019 15:58:45 +0100 Subject: [PATCH 2/2] Update README.md --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e2a2b06..0a1c236 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ -*FORK* PHP Object wrapper for the ~Google Chart~ [Image-Charts](https://www.image-charts.com) API +> Google Image Charts API is **deprecated in 2012** and was **turned off on March 18, 2019**. This fork use [Image-Charts.com](https://www.image-charts.com) API instead. + + +PHP Object wrapper for the ~Google Chart~ [Image-Charts](https://www.image-charts.com) API =========================================== -A simple PHP Object wrapper for the [Image-Charts API](https://www.image-charts.com) (a drop-in-replacement and backward compatible chart API with [Google Image-Charts](http://code.google.com/apis/chart/image_charts.html)). 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 [Image-Charts API](https://www.image-charts.com) (a drop-in-replacement and backward compatible chart API with [Google Image-Charts](http://code.google.com/apis/chart/image_charts.html)). Should help anyone who needs to automate the building of the 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.