aeroswat Posted March 16, 2010 Share Posted March 16, 2010 I am trying to find a solution to my problem. I need a graph creating library that will allow me to display the graph in a pdf with the fpdf library. The second problem is it can't require me to compile it with PHP because its not my server. Link to comment https://forums.phpfreaks.com/topic/195451-fpdf-with-graphs/ Share on other sites More sharing options...
nafetski Posted March 16, 2010 Share Posted March 16, 2010 Well, there are a few options. Your best option is using a graphing library that outputs it as an image (which can then be added to FPDF) jpgraph is a PHP based solution that uses GD to render the images, so it would probably be the easiest solution. They have both a free and commercial license. However, if you find yourself in a situation where you are running a lot of reports (typically reporting requests snowball after they get that first one. Suddenly they are asking for a report for every damn thing under the sun) there are PLENTY of open source solutions that might make your life far easier. OpenReports is decent..and just happens to be what my previous employer used. I wasn't crazy about it (java based) but it did the job, and was easy Hopefully some of what I just said points you in the right direction, and let me know if you have any problems Link to comment https://forums.phpfreaks.com/topic/195451-fpdf-with-graphs/#findComment-1027033 Share on other sites More sharing options...
aeroswat Posted March 16, 2010 Author Share Posted March 16, 2010 Thank you. JpGraph isn't just an included library tho is it? I haven't been able to take a look in the compressed folder yet but it sounded like it from what I was reading. I don't have access to the server so it's not exactly an option. I'm trying to grab a program to un-compress it real fast tho. Link to comment https://forums.phpfreaks.com/topic/195451-fpdf-with-graphs/#findComment-1027037 Share on other sites More sharing options...
nafetski Posted March 16, 2010 Share Posted March 16, 2010 Um. Well, jpgraph is just a file that you can include. You dont' have to "install" anything. Either way, if you don't have access to the server (to upload php files) then you can't really do anything Link to comment https://forums.phpfreaks.com/topic/195451-fpdf-with-graphs/#findComment-1027040 Share on other sites More sharing options...
aeroswat Posted March 16, 2010 Author Share Posted March 16, 2010 Um. Well, jpgraph is just a file that you can include. You dont' have to "install" anything. Either way, if you don't have access to the server (to upload php files) then you can't really do anything Not talking about to upload files lol. Was talking about to mess with the PHP configuration. I found out that really the only thing that's required is that the GD library be enabled on the PHP config. Now I have to go learn how to create pie charts with this thing. Know of any sites where I could go that could give me a little tutorial on it? Their documentation for this library is massive Link to comment https://forums.phpfreaks.com/topic/195451-fpdf-with-graphs/#findComment-1027044 Share on other sites More sharing options...
nafetski Posted March 16, 2010 Share Posted March 16, 2010 It's not hard. Read the links before you ask more questions about configuration and setup..if you spent 1 minute you'd see it's a class library you just upload and include. Seriously, it's not hard. Link to comment https://forums.phpfreaks.com/topic/195451-fpdf-with-graphs/#findComment-1027047 Share on other sites More sharing options...
aeroswat Posted March 16, 2010 Author Share Posted March 16, 2010 It's not hard. Read the links before you ask more questions about configuration and setup..if you spent 1 minute you'd see it's a class library you just upload and include. Seriously, it's not hard. You're not reading what I'm typing I said that I figured out that it was a library... I asked for a tutorial on creating a pie graph. I didn't ask anything else about configuration and setup. Link to comment https://forums.phpfreaks.com/topic/195451-fpdf-with-graphs/#findComment-1027051 Share on other sites More sharing options...
nafetski Posted March 16, 2010 Share Posted March 16, 2010 Sorry, your first response was the one I was referring to. I read your posts. Seriously - read the documentation a bit. They have a "how-to" section, and with a little googling I'm sure you can find some examples. If you're just creating a pretty simple pie chart it shouldn't be a problem. I love helping people learn - but I'm impatient when they don't fend for themselves at least a little bit. If you become a serious developer, you will want to get VERY good at reading technical documentation (because you will spend hundreds of hours doing so as a professional) Try first, and if you fail post your errors/code. I'll then tell you how to fix it...I promise Link to comment https://forums.phpfreaks.com/topic/195451-fpdf-with-graphs/#findComment-1027060 Share on other sites More sharing options...
aeroswat Posted March 16, 2010 Author Share Posted March 16, 2010 Sorry, your first response was the one I was referring to. I read your posts. Seriously - read the documentation a bit. They have a "how-to" section, and with a little googling I'm sure you can find some examples. If you're just creating a pretty simple pie chart it shouldn't be a problem. I love helping people learn - but I'm impatient when they don't fend for themselves at least a little bit. If you become a serious developer, you will want to get VERY good at reading technical documentation (because you will spend hundreds of hours doing so as a professional) Try first, and if you fail post your errors/code. I'll then tell you how to fix it...I promise Gonna hold you to that because I have tried I have write permission errors its telling me. I want to save my pie graph to a file. At the end I do this $graph->Stroke(getcwd() . "/graph1.png"); And it tells me that it can't write to file and to check that the process running php has the correct permissions. I can't seem to find in the documentation where to check for said permissions though. I've been looking since about 2 minutes after I wrote my last post Anywho I'm heading to lunch and will be back in like an hour. I'll check back then. Thanks for the help and I don't mean to sound unappreciative so I apologize if I do. Link to comment https://forums.phpfreaks.com/topic/195451-fpdf-with-graphs/#findComment-1027075 Share on other sites More sharing options...
nafetski Posted March 16, 2010 Share Posted March 16, 2010 No sweat Alright, so that does make sense tho (that error). jpgraph is trying to write to the filesystem, and it doesn't look like it has access to. What you want to do is set write permissions for your web server user on that particular directory or file it's complaining about. If you don't know that answer (what the web server is running under) go ahead and chmod 777 the file and see if that works. Link to comment https://forums.phpfreaks.com/topic/195451-fpdf-with-graphs/#findComment-1027078 Share on other sites More sharing options...
aeroswat Posted March 16, 2010 Author Share Posted March 16, 2010 No sweat Alright, so that does make sense tho (that error). jpgraph is trying to write to the filesystem, and it doesn't look like it has access to. What you want to do is set write permissions for your web server user on that particular directory or file it's complaining about. If you don't know that answer (what the web server is running under) go ahead and chmod 777 the file and see if that works. Err... I'm getting a strange error. Also in FileZilla I checked the write access under group permissions and do it to all sub-directories and files in the sub-directories. So it ran a chmod 777 on everything. Then I go to right click my public_html folder (main folder where everything is) and look at the permissions again. It has write unchecked >< To complicate things further I now get this error when I run the script to create the pie chart Fatal error: Unknown: Failed opening required '/www/www.****.com/create.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in Unknown on line 0 Here is the code that i'm using include ("jpgraph/jpgraph.php" ); include ("jpgraph/jpgraph_pie.php"); $data = array(40,60, 21,33); $graph = new PieGraph (300,200); $graph->SetShadow(); $graph->title-> Set("A simple Pie plot"); $p1 = new PiePlot($data); $graph->Add( $p1); $graph->Stroke(getcwd() . "/graph1.png"); Fuck me >< Now everything that uses in include, require_once, etc on my site no longer works and gives that same error Link to comment https://forums.phpfreaks.com/topic/195451-fpdf-with-graphs/#findComment-1027127 Share on other sites More sharing options...
aeroswat Posted March 16, 2010 Author Share Posted March 16, 2010 Nevermind... Stupid FileZilla was doing 770 not 777 >< I was taking away permissions instead of adding them rofl. Thanks for the help broski! I got the graph working too! Link to comment https://forums.phpfreaks.com/topic/195451-fpdf-with-graphs/#findComment-1027141 Share on other sites More sharing options...
nafetski Posted March 16, 2010 Share Posted March 16, 2010 Glad to help Link to comment https://forums.phpfreaks.com/topic/195451-fpdf-with-graphs/#findComment-1027176 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.