TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack (21) Thread Tools Search this Thread Display Modes
Old 02-22-2008, 07:03 PM   #21 (permalink)
The Visitor
 
Join Date: Feb 2008
Posts: 3
Thanks: 1
Witt is on a distinguished road
Default

Thanks for posting this, Good Stuff!

It looks like there is only support for axis labels for pie charts (i.e. no 'chxl'). Is that correct or am I missing something, before I go off and add it?

Witt
Witt is offline  
Reply With Quote
Old 02-24-2008, 02:39 PM   #22 (permalink)
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

No I don't think I added support for that. So yeh, unfortunately you may have to add it yourself :(
__________________
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
Karl is offline  
Reply With Quote
The Following User Says Thank You to Karl For This Useful Post:
Witt (02-26-2008)
Old 03-28-2008, 11:49 AM   #23 (permalink)
The Visitor
 
adamcharnock's Avatar
 
Join Date: Mar 2008
Posts: 4
Thanks: 1
adamcharnock is on a distinguished road
Default

Hey All,

I have been hunting around for a PHP wrapper for the Google Chart API and from what I have seen this is definitely the best out there at the moment.

I was wondering if there is any site for this project, or if it is just on this thread at the moment? I would like to contribute to it in order to get the axis labels working (if this has not yet been done by someone else).

I think that this could end up being the way for PHP devs to work with the chart API, but it could really do with some sort of project page, svn repo, wiki etc.

Anyway, I guess my questions are:
1) Does such a project area exist?
2) Does the axis-label code already exist?

Thanks,

Adam

PS. Just FYI: Uploading an Avatar from a URL (rather than a local file) seems to be broken on the forum's 'Edit Avatar' page (cannot the write temp file).

Last edited by adamcharnock : 03-28-2008 at 12:12 PM.
adamcharnock is offline  
Reply With Quote
Old 03-28-2008, 03:04 PM   #24 (permalink)
The Visitor
 
Join Date: Feb 2008
Posts: 3
Thanks: 1
Witt is on a distinguished road
Default

Adam,

I can't answer question 1, but I did add some code that creates y axis labels for bar charts (should work with line charts too.) I also added the ability to automatically generate the axis labels based on the data.

I put in just what I needed to accomplish my goals, but I'd be happy to share if you're interested.

Witt
Witt is offline  
Reply With Quote
Old 03-28-2008, 03:25 PM   #25 (permalink)
The Visitor
 
adamcharnock's Avatar
 
Join Date: Mar 2008
Posts: 4
Thanks: 1
adamcharnock is on a distinguished road
Default

Hi Witt,

If you don't mind sharing what you have done that would be great! Do you mind posting it on the form?

Thank you!

Adam
adamcharnock is offline  
Reply With Quote
Old 03-28-2008, 05:17 PM   #26 (permalink)
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

Hi Adam,

Thanks for the post, it's always nice to see some positive comments. I havn't really done much with the project, so, to answer your questions:

1) Nope
2) Nope (Edit: I see Witt has though. Thanks Witt)

As for a project page, that would be great, but it's something I've never actually done myself, maybe you can steer me in the right direction or set it up yourself? With other people contributing, I'd probably contribute more myself too.

Looking forward to your reply :)
__________________
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
Karl is offline  
Reply With Quote
Old 03-30-2008, 02:22 PM   #27 (permalink)
The Visitor
 
adamcharnock's Avatar
 
Join Date: Mar 2008
Posts: 4
Thanks: 1
adamcharnock is on a distinguished road
Default

Hi Karl,

Sorry for taking a while to get back. I have been working on seting up a project site for this, but have have been a little busy over the past couple of days, and I need to go and see a client on Monday/Tuesday, so you can probably expect some progress on this later in the week.

One thing though - do you have any project name in mind? I came up with gPhart, for Google PHP Chart :p

I'll be in touch again soon!

Adam
adamcharnock is offline  
Reply With Quote
Old 04-02-2008, 12:36 PM   #28 (permalink)
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

Hi Adam,

No I currently don't have any product name in mind, I was gunna keep it simple with something like GPChart, but I guess we could have the cheekier variant, GPhart :)

Karl
__________________
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
Karl is offline  
Reply With Quote
Old 04-22-2008, 08:18 PM   #29 (permalink)
The Visitor
 
Join Date: Feb 2008
Posts: 3
Thanks: 1
Witt is on a distinguished road
Default Y-Axis labels for bar graph

Sorry it's taken me so long to get back to you on this. The attached code adds the ability to automatically generate y-axis labels for bar charts based on the data (it may work for line charts too.)

Here's an example of how the new code is used:
PHP Code:
    $chartData = new GChart_Data_Generic($data''$layer->getFieldPresNames($fields), array(),
                                         
'336699'$layerData[$layerAppName]->numYAxisDigits);
    
$chart = new GChart();
    
$chart->setSize('auto',200)
          ->
setType(GChart::TYPE_BAR_VGROUPED)
          ->
setTitle($layerData[$layerAppName]->title'336699'14)
          ->
setDataEncoding(GChart_Data_Encoder_Factory::TEXT_W_SCALING_ENCODING)
          ->
setBackgroundFill(new GChart_Fill_Solid('B1BBC5'))
          ->
setMaxValue($chartData->getMaxValue())
          ->
addAxis(new GChart_Axis('x,y'))
          ->
setAutoBarWidth(true)
          ->
addData($chartData);


    
//error_log($chart->render());

    
echo '<img onload="graphImageLoaded();" src="' .
            
$chart->render() . '" alt="'.$layerData[$layer]->title.'"/>'
I couldn't figure how how to make the y-axis labels be consistent with how google scales the data using simple encoding, so I switched to Text encoding with scaling and added a new class to GChart/Data/Encoder to support that (the existing Text class didn't support scaling).

Please be aware that I only added what I needed to get my project done.

On another note, I think I found a bug in GChart.php on line 148. It's setting $this->m_szDataEncoding; I think it should be $this->m_szEncoding.

Let me know if you have any questions.
Witt
Attached Files
File Type: zip gchart-witt.tar.zip (7.5 KB, 33 views)
Witt is offline  
Reply With Quote
Old 06-24-2008, 08:35 PM   #30 (permalink)
The Visitor
 
Doughboy's Avatar
 
Join Date: Jun 2008
Posts: 1
Thanks: 0
Doughboy is on a distinguished road
Default Problem extracting ZIP file

I got an error while trying to unzip gchart-witt.tar.zip from Witt's post on 4-22, did it work for anyone else?

Here is the error msg:

End-of-central-directory signature not found. Either this file is not a Zip file, or it constitutes one disk of a multi-part Zip file.

Thanks!
Doughboy is offline  
Reply With Quote
Old 10-06-2008, 09:35 PM   #31 (permalink)
The Visitor
 
cheesegrits's Avatar
 
Join Date: Oct 2008
Posts: 1
Thanks: 0
cheesegrits is on a distinguished road
Default

Out of interest, does the wrapper do data scaling?

So for instance if the dataset for a pie chart has values exceeding 4096, will the wrapper scale the whole dataset to bring all values below 4096?

OBTW, I get the same problem with Witt's ZIP.

-- hugh
cheesegrits is offline  
Reply With Quote
Old 02-06-2011, 02:13 PM   #32 (permalink)
The Visitor
 
Join Date: Feb 2011
Posts: 2
Thanks: 0
baradhili is on a distinguished road
Default

Just wondering if someone could post an sample for using witt's version of the class? I'm getting a bit stuck getting past the sample he posted - which seems to refer to a bunch of stuff not in the sample :(..

Thanks :)
baradhili is offline  
Reply With Quote
Old 02-07-2011, 07:10 AM   #33 (permalink)
The Acquainted
 
Join Date: Nov 2009
Location: nr Stratford-Upon-Avon
Posts: 134
Thanks: 3
maeltar is on a distinguished road
Default

it is over 2 years old...
__________________
Thanks... Simon

Sex, Drugs & Linux Rules
Send a message via MSN to maeltar
maeltar is offline  
Reply With Quote
Old 02-07-2011, 08:04 AM   #34 (permalink)
The Visitor
 
Join Date: Feb 2011
Posts: 2
Thanks: 0
baradhili is on a distinguished road
Default

Hi Simon,
yes I saw that... never the less people read these forums right :)
baradhili is offline  
Reply With Quote
Old 02-08-2011, 07:13 AM   #35 (permalink)
The Acquainted
 
Join Date: Nov 2009
Location: nr Stratford-Upon-Avon
Posts: 134
Thanks: 3
maeltar is on a distinguished road
Default

I guess they must, to be honest I do go through some of the older posts as there is some good hints, tips and snippets here.
__________________
Thanks... Simon

Sex, Drugs & Linux Rules
Send a message via MSN to maeltar
maeltar is offline  
Reply With Quote
Old 11-30-2011, 08:42 AM   #36 (permalink)
The Visitor
 
Francis's Avatar
 
Join Date: Nov 2011
Posts: 3
Thanks: 0
Francis is on a distinguished road
Default

I have been experimenting with Google charts. Are there any alternatives that are reasonably as expressive but can be installed locally on your own web server? I don't like the idea of relying on an outside entity for a feature to work. Even if it is for cost, it would be preferable. Any suggestions?
Francis is offline  
Reply With Quote
Reply


LinkBacks (?)
LinkBack to this Thread: http://www.talkphp.com/script-giveaway/1704-googlecharts.html
Posted By For Type Date
Advanced PHP Wrapper Class for Google Charts This thread Refback 01-11-2008 03:55 PM
Google Chart API: Simple and Awesome « Reverberations This thread Refback 01-10-2008 02:57 PM
Google Charts and Graphs | MindTouch Blog This thread Refback 01-08-2008 02:54 PM
userslib.com » links for 2007-06-07 This thread Refback 01-08-2008 02:11 PM
Advanced PHP Wrapper Class for Google Charts This thread Refback 01-08-2008 04:08 AM
NamePros.Com - Advanced PHP Wrapper Class for Google Charts This thread Refback 01-08-2008 03:40 AM
g :: Google Chart API Revisited This thread Refback 01-06-2008 11:03 PM
Gem ajánló: Google Chart API wrapper : Pixelszabászat This thread Refback 01-05-2008 06:06 PM
Creating Charts - SitePoint Forums This thread Refback 01-03-2008 11:36 PM
Andrew Ferguson dot NET » Google Chart API This thread Refback 01-03-2008 09:52 AM
Solutoire.com › GChart 0.2 alpha released This thread Refback 12-30-2007 08:11 AM
PHP / Javascript Wrappers for Google | David Bisset: Web Designer, Coder, Wordpress Guru This thread Refback 12-28-2007 06:15 PM
Dynamic Google Charting API - Google Blogoscoped Forum This thread Refback 12-26-2007 08:56 PM
Create Charts Online with Google Chart API This thread Refback 12-26-2007 08:28 PM
TomSoft » Google Chart API This thread Refback 12-26-2007 05:00 PM
Daily Dose of Excel » Blog Archive » Google Chart API This thread Refback 12-26-2007 11:23 AM
Javascript | David Bisset: Web Designer, Coder, Wordpress Guru This thread Refback 12-26-2007 03:31 AM
Phil Windley's Technometria | Google Chart API This thread Refback 12-25-2007 02:29 AM
24 ways: Tracking Christmas Cheer with Google Charts This thread Refback 12-22-2007 11:10 PM
Google Chart API released - Download Squad This thread Refback 12-22-2007 04:07 PM
Google Chart API « Sciolism Rocks This thread Refback 12-21-2007 10:51 PM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:11 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design