| View previous topic :: View next topic |
| Author |
Message |
Ekate
Joined: 17 Apr 2007 Posts: 15
|
Posted: Tue Apr 17, 2007 5:40 pm Post subject: How to build CHARTS? |
|
|
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
|
|
| Back to top |
|
 |
Ekate
Joined: 17 Apr 2007 Posts: 15
|
Posted: Fri Apr 20, 2007 8:34 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
Ekate
Joined: 17 Apr 2007 Posts: 15
|
Posted: Mon Apr 23, 2007 12:05 pm Post subject: |
|
|
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
|
Posted: Mon Apr 23, 2007 12:50 pm Post subject: |
|
|
| 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
|
Posted: Mon Apr 23, 2007 2:53 pm Post subject: |
|
|
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
 |
|
| Back to top |
|
 |
cweiske
Joined: 08 Dec 2005 Posts: 454 Location: Leipzig/Germany
|
Posted: Mon Apr 23, 2007 4:59 pm Post subject: |
|
|
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
|
Posted: Mon Apr 23, 2007 10:24 pm Post subject: |
|
|
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
|
Posted: Mon Apr 23, 2007 10:40 pm Post subject: |
|
|
| I just forgot to announce that I'mon Windows XP and have all this GNOPE stuf installed. |
|
| Back to top |
|
 |
|