gnope php gtk gui gnope.org  

How to build CHARTS?

 
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners
View previous topic :: View next topic  
Author Message
Ekate



Joined: 17 Apr 2007
Posts: 15

PostPosted: Tue Apr 17, 2007 5:40 pm    Post subject: How to build CHARTS? Reply with quote

Hello

I'm just wondering,how I can build the charts in php-gtk2

(for php we can use gd2 library,but here I don't know,I really need to build some nice diagramms)

Thank you very much,
best regards
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Tue Apr 17, 2007 6:39 pm    Post subject: Reply with quote

I suggest you use PEAR's Image_Graph package which is suited ideally for this: http://pear.php.net/package/Image_Graph
Back to top
Ekate



Joined: 17 Apr 2007
Posts: 15

PostPosted: Fri Apr 20, 2007 8:34 pm    Post subject: Reply with quote

Thank you very much for advise.
Actually I've never work with pear and have quite haze understanding what it is,but I'll try ...
Thank you,
best regards Smile
Back to top
Ekate



Joined: 17 Apr 2007
Posts: 15

PostPosted: Mon Apr 23, 2007 12:05 pm    Post subject: Reply with quote

now the problem is that I can't install pear packages.
The mistake is pear/Image_Color requires PHP extension "gd".
As I correctly undertstood I need to have this gd library in my ext directory , but again GNOPE doesn't include it.
What to do?
Could you please help me?

Best regards,
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Mon Apr 23, 2007 12:50 pm    Post subject: Reply with quote

You need to load it in your php.ini. There should be lines around "extension=somefile.dll"
Back to top
Ekate



Joined: 17 Apr 2007
Posts: 15

PostPosted: Mon Apr 23, 2007 2:53 pm    Post subject: Reply with quote

Yes,I know

I did it (I have php_gd2.dll in ext directory),installed Image_Graph and Image_Canvas and Image_Color,
but when I'm trying to execute the following script
Code:

 <?php
/**
* Using Image_Graph to create a chart and displaying it directly
* in a GtkImage widget, getting it to there with the
* GdkPixbuf::new_from_gd() method.
*
* The Image_Graph code is a slightly modified version of the
* simple.php example.
*
* You need Image_Graph version 0.7.3 or higher (0.7.2 doesn't
* support the required "none" output switch)
*/
 
include 'lib/pear/Image/Graph.php';
 
//we want to use the gd library
$Graph = Image_Graph::factory('graph', array(array('width' => 400, 'height' => 300, 'canvas' => 'gd')));
 
//prepare the chart
$Plotarea = $Graph->addNew('plotarea');
$Dataset = Image_Graph::factory('dataset');
$Dataset->addPoint('Denmark', 10);
$Dataset->addPoint('Norway', 3);
$Dataset->addPoint('Sweden', 8);
$Dataset->addPoint('Finland', 5);
$Plot = $Plotarea->addNew('bar', $Dataset);
$Plot->setLineColor('blue@0.2');
 
//This is the key: Don't output anything, just finish it
$Graph->done(array('output' => 'none'));
 
//get the gd object
$canvas = $Graph->_getCanvas();
$gd = $canvas->_canvas;
 
//Create GdkPixbuf from the GD object
$pixbuf = GdkPixbuf::new_from_gd($gd);
 
//Display the pixbuf by using a GtkImage widget
$wnd = new GtkWindow();
$wnd->connect_simple('destroy', array('Gtk', 'main_quit'));
$wnd->add(GtkImage::new_from_pixbuf($pixbuf));
$wnd->show_all();
Gtk::main();

?>


I have 3 short sound warning, a lot of ASCII symbols and the following error message:
Fatal error:PHP-GTK was not compiled against PHP with bundled GD library in line 37

I DUNNO WHAT TO DO
Sad
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Mon Apr 23, 2007 4:59 pm    Post subject: Reply with quote

That is a bug in PHP-Gtk and should be fixed in the latest sources.
So you have two possibilities:
- Compile your own version of php-gtk
- Wait for a new release which fixes this and save the chart into a file and display it from the file in the meantime.
Back to top
Ekate



Joined: 17 Apr 2007
Posts: 15

PostPosted: Mon Apr 23, 2007 10:24 pm    Post subject: Reply with quote

Shocked Shocked Shocked Shocked Shocked Shocked Shocked
Are there another ways to build charts?
Please help,anybody....
I guess that it is quite usual question,and I'm sure that someone definitely built charts with PHP-Gtk2!!!
I need your help!
Back to top
Ekate



Joined: 17 Apr 2007
Posts: 15

PostPosted: Mon Apr 23, 2007 10:40 pm    Post subject: Reply with quote

I just forgot to announce that I'mon Windows XP and have all this GNOPE stuf installed.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Templates enhanced by DigiWiki. Hosting by Tradebit.