Custom Charts w/ Perl and GD 112
An anonymous reader writes "This article describes techniques you can use to create new levels of usefulness in your dynamically generated charts with Perl and GD. Cook up some automatically generated graphs for your organizational meetings or live enterprise directory data. Annotate the charts with readable text that delivers more information than the standard pie chart. Using the power of GD and Perl, you can link various data and images together to create sophisticated charts that will help bring visual interest to your applications."
Re: (Score:1, Troll)
Re: (Score:2)
Re: (Score:1)
This one isn't a dupe, isn't cussing microsoft, doesn't mention open source and has no reference to apple!
I'm dissapointed. Those standards are slipping boys!
Re: (Score:2)
Re:Don't get it.. (Score:5, Funny)
Maybe they should email a link to Edward Tufte...amybe he'll be insterested. Data graphic geniuses these folks.
Re: (Score:3, Interesting)
My solution was to use Perl and Win32::OLE to interface with Excel 2003 using VBA scripting within Perl. Sure, it's a Windows-only solution, and it's not open source, but it was an intranet problem that needed to be solved.
Re: (Score:2, Interesting)
Re: (Score:1)
Re: (Score:1)
Re: (Score:1, Offtopic)
Yeah this GD/Perl stuff is old news, I use flash for charts, fusion charts.
These charts look like shit (Score:2, Interesting)
Re: (Score:3, Funny)
I'm better at making code than graphics [deviantart.com].
Now, if only other people were better at waiting on my every graphical need, free of charge...
-:sigma.SB
Re:These charts look like shit (Score:4, Informative)
The code looks easy enough to experiment with your own artwork, so I look forward to seeing how much better you can do.
Re:These charts look like shit (Score:5, Insightful)
Re: (Score:1)
Re: (Score:2)
I think this is indicative of a disconnect.
There is an underlying assumption that even though the coders apparently can't do graphic design worth jack, that graphic designers can somehow code worth jack. Most graphic designers aren't coders, and most coders aren't graphic designers. The disciplines aren't mutually exclusive, but most in one field can't do much of value in the arts of the other field. Usually, it's bet
Re:These charts look like shit (Score:4, Insightful)
I agree with what you're saying, but I think you've got the onus wrong. As someone with design and coding experience, I can say that FOSS programmers often bend over backwards to package things nicely, but are often rebuffed by non-programmers if the interface is not 100% to their liking.
There is a disconnect, but IME it comes from people who think that being a user entitles them to sit back and wait for manna to drop from heaven. The bottom line is simply this: If you're going to work in FOSS, then you have to get your hands dirty. This almost necessarily means learning a little about areas that are not your forte. In order for there to be reasonable cooperation, we need to speak the same language. In the Perl community especially, there is a real desire to learn new things and share knowledge, but if designers et alia aren't willing to learn at least a little Perl, then there's not much to be done.
"Don't make me look at code" is, unfortunately, not often a valid condition for any FOSS participant, regardless of their other talents.
Re: (Score:1)
But graphic artists can contribute without knowing an
Re: (Score:2)
Re: (Score:2)
In all fairness, there wasn't a multiple level undo until much later [version 5 or so], so you would have needed to save prior to doing multiple changes.
Re: (Score:2)
If there is any question in people's mind about whether or not Linux or FOSS software is is ready for the average user's desktop, maybe it can be answered here. Users can't expect to just get software and have it work. Before they can do their work (or play,
Re: (Score:1)
Besides you, who said anything about requiring any users to become developers? Contributors, yes. Developers, no.
Re: (Score:2)
It's like requiring users to be car mechanics in order to drive an FOSS car.
I would think that it's more like belonging to a focus group discussing a concept car. The developers need [useful] feedback.
Saying, "I hate it. What is it?" won't help. Saying, "I don't like having to go seven layers into a menu to do this common procedure" will help.
That so many in FOSS can't see the inefficiency of requiring all users, to be some level of developer, on every tool they use
Have you ever made a recommendation for process improvement? Have you ever contributed to a project that required your special skills or unique insight? Have you been passed up for a promotion based on your recommendations or insight on a pr
Re: (Score:2)
This is, basically, my point. When will "Linux" or "FOSS" (the terms are both vaguely defined) be ready for the corporate or home desktop? At that point, you are mostly talking _users_ of computers that know little or nothing about computer
Re: (Score:2)
Re:These charts look like shit (Score:4, Insightful)
Re: (Score:2)
Someone at a conference (Aaron Siego, KDE dev, IIRC) explained this little tidbit about usability:
The usability people who volunteered to try and help the KDE developers were speaking their own language, not one the programmers understood. Once that little hurdle was found, both sides got together and figured out common ground. The thing is that you have to learn to communicate with the programmers in the FOS
Re: (Score:3)
KDE have a quite a few very good contributors who are of the more graphical persuation. I believe firefox have a few as well. But they are always in short supply even compared to coders, so if you know any, please direct them to the appropriate sites. (I'm sure it is the same with Gnome, but I agree with Linus on that one).
Re: (Score:2)
These charts look like shit? No they don't. (Score:3, Interesting)
). Anti-aliased lines and text
Let's compare this to what I'd get if I asked most professionals for a chart. (These were the first ones from google). The lack of anti-aliasing hurts one's eye, these all look like they're from 1995.
http://support.alphasoftware.com/images/XD_Interac tive_Pie_Chart.gif [alphasoftware.com]
http://msdn2.microsoft.com/en-us/library/aa [microsoft.com]
Re: (Score:2)
My partner, a graphic designer, says the same thing about the artwork in the Dungeons and Dragons manuals... I guess geeks everywhere and in every age think they can draw or something...
Re: (Score:1)
wow! (Score:3, Funny)
Re:wow! (Score:5, Informative)
If that's still not tickling your fancy then I would suggest matplotlib [sourceforge.net] which is actually pretty versatile, and produces good looking plots. There's also PyX [sourceforge.net] if you're looking for slightly more raw graphical interaction with nice output. Truth be told, however, after messing around with many of the same options you have, I've found that Gnuplot, once you get over the initial learning hurdle and figure out how to turn out nice looking plots, is the fastest and easiest way to turn out plots and charts.
Re: (Score:2)
Re: (Score:3, Informative)
Re:wow! (Score:5, Interesting)
To get you started (there could be errors here, I'm doing this from memory, but Octave code something similar to this:
plot blah
hold on
plot something
plot otherstuff
hold off
gset term postscript eps color 22
gset output someplot.eps
replot
gset output foo %bad shit happens to your plot output if you don't change the output file when setting the term back to X11
gset term x11
Would do the following:
Plot multiple things in a plot to the screen
Output that plot to an EPS file
Reset the output so the next plot would go back to the screen
You could then run the
(There are a lot of details I'm not mentioning here of course, unfortunately there really isn't any single good central HOWTO for doing all sorts of useful stuff in LaTeX.)
Re: (Score:3, Interesting)
And LyX is very convenient. Especially for typesetting those pesky equations. Much less flaky than MS Office, or even OO.org. In fact, I'd classify its equation modes as not flaky at all. Of course, it's convenient that anything they don't support can simply be escaped and typed in pure latex...
My favorite thing abou
Gnuplot?? for other than XY charts? (Score:2)
I looked for some tutorials on the web to do bar plots but they consisted in half assed hacks (translate the data point, surround it by a bounding box etc etc) which is too much work for
Re: (Score:2)
Marketing/Management friendly... (Score:1)
With enough animated transitions to last you a good 3-4 promotions you should be set
Re: (Score:2)
Gnuplot rocks (Score:2)
My intro was on DOS plotting time series data to screen or an Epson MX80 printer.
I used Excel (4) which had serious issues with time series and Kaleidagraph on a Mac.
It's always there on Unix and I think there is/was a macintosh version.
gnuplot is timeless.
That said, for long term time series with thousands of data points, I like RRDtool. It deals well with consolidating the data.
Re: (Score:1)
And now back to your regularly scheduled program...
Yes, actually. (Score:3)
With a general purpose language tied to a drawing library I can make custom graphics? Holy crap, who would have thought.
LibGD was made for this but does more now. There are lots of applications to do the same but "use libGD" is a good tip for people who want to make dynamic images and graphs for web pages from data.
For those of us who just want to generate some simple graphs for papers and such, what do people use? I've messed with Excel, gnuplot, R, and now I'm using ploticus.
gnuplot is very powe
Re: (Score:1)
For paper presentation I'd go with gnuplot. It requires some work to get it right, but results are impressive and can be easily embedded in LaTeX environment.
As for TFA, I would think that with a programming language and graphics library we would be able to see so
Re: (Score:2, Interesting)
> Anyone have better solutions?
Yes.
eZComponents Graph [ez.no], from the developers of the eZpublish CMS. It's FLOSS, easy to use, and works very well for some automatically generated graphs [carroll.org.uk] I made that needed to update every week.
Grace (Score:2)
So close (Score:5, Funny)
Re: (Score:2, Insightful)
Heh. Congrats on being modded 'interesting' for that.
Any chance I can get funny moderation? Or insightful, maybe?
Re: (Score:1)
Re: (Score:2)
I use perl more or less every day, too. See my sig ;)
Re: (Score:3, Funny)
Edward Tufte weeps... (Score:3, Insightful)
I think I can hear Edward Tufte weeping...
And the only chart they implement is the pie chart:
http://www.usf.uni-osnabrueck.de/~breiter/tools/p
Xix.
hmm (Score:2)
Re: (Score:2)
There's always Acme::Bleach [cpan.org] if you're having trouble making it a one-liner.
Re: (Score:2)
I wasn't under the impression that Perl *required* newlines anywhere.. can't you just take an existing perl script, delete all newlines and it will compile/run just as before?
For the Pythonista wanting charts and graphs... (Score:3, Informative)
ChartDirector (Score:3, Interesting)
R is very cool (Score:2)
Xix.
Re: (Score:2)
But our product is commercial. I would really love to see a solution for my OS projects. The aa in the article is horrible, GD just doesn't cut it.
We all know... (Score:5, Funny)
from the make-a-pac-man-pie-chart-now dept. (Score:1)
Re:Killing an ant with a thermonuclear bomb... (Score:5, Funny)
If you're organization is so dynamic that your org. chart NEEDs to be generated at runtime by a script on your web server, then maybe writing perl scripts to auto-generate org charts shouldn't be your highest priority.
The right tool for the right job (Score:5, Insightful)
If you want to do something like graphing, then why not learn a language like R, where you can easily and interactively create amazing visuals in very little time? I write code in Java, python, bash, and interact with Oracle and MySQL database. R fits in as a nice way to visualize data, and it's very easy to script up solutions that you can plug into your programming pipeline.
Check out http://addictedtor.free.fr/graphiques/index.php [addictedtor.free.fr] for examples (with source code)
Re: (Score:2)
If you want to do something like graphing, then why not learn a language like R, where you can easily and interactively create amazing visuals in very little time? I write code in Java, python, bash, and interact with Oracle and MySQL database. R fits in as a nice way to visualize data, and it's very easy to script up solutions that you can plug into your programming pipeline.
There's Flash for Linux/Windows/Mac, and it can ren
Re: (Score:2)
The examples I can find in flash are 1-2 liners in R. Seriously, plotting a bar graph or pie graph or scatter plot is 2 lines (1 line input the data, 1 line to plot the graph.) Now, do something complicated and interesting as shown above. Do a multi-dimensonal plot. Do a box and
Re:The right tool for the right job (Score:4, Interesting)
Lookup Flex Charts. An open-source Flash library for rendering charts, by Adobe.
It can renders charts if you just feed it the data (in XML format) and what chart type you want.
Re: (Score:2)
Yes, you don't use your nice new wood chisel to pry the lid off a can of paint. But you might use it instead of driving down to the home depot to get a specialized router attachment, if you can do the job with the chisel in less time than the drive would take. If you plan on doing this operation hundreds of times over the next few months, then by all means drive down to the store and get the specialized attachment.
Re: (Score:2)
Ruby / Gruff (Score:3, Informative)
Very useful... (Score:2)
SVG and ImageMagick (Score:2, Insightful)
Bugzilla way. (Score:1)
For now, I'll avoid Perl if I can.
What's the "GD" for? (Score:1)
Re: (Score:3, Informative)
You can probably emulate a bar graph using tables, if you're particularly anal about doing it in HTML. Hell, you could probably do a line graph with a whole tonne of 1-pixel cells in a table, but
This would have been so much simpler (Score:1)
Use JPGraph instead (Score:3, Informative)
I think it's dual licensed, with a very modest fee for commercial use.
Re: (Score:2)
Gantt-like chart code (Score:2)
I ended up rolling my own in GD with perl (making a wxPerl gui app). Reading this made me think (why doesn't he put it on CPAN) and then my next thought was (maybe I should put my own code up there before talking).
Not sure when I'll have time but anyway keep up the good work.
For everyone talking about design, yes it would not be a bad thing to take a first step to seeking designers interested in workin
Do you like my dynamic GD::Graphs? (Score:1)
They're quite pretty in my opinion, but having read this thread, I realised they are not anti-aliased and that's not easy to do in GD::Graph at the moment (while drawing the lines, at least - I just read there is a trick one can do with resampling a 4x image).
Also, there's a problem with the lines not really being the desired thickness perpendicular to the directi
Ah, charts in Perl... (Score:5, Interesting)
There just isn't a general purpose charting package for Perl that would even come close to JFreeChart [jfree.org]. Grace [weizmann.ac.il] can produce some nice results, but the Perl interface to it is just a wrapper around their terrible command line interface (maybe it's improved in the last few years, but when I tried it it was almost entirely undocumented and nigh-unusable).
So, if you want publication quality charts you basically still have to learn gnuplot, which is great, but sometimes just a little too involved.
At least this thread gives a nice summary of what the other languages have to offer: the PHP [aditus.nu] and Ruby [nubyonrails.com] packages aren't faring any better, but Python's matplotlib [sourceforge.net] looks freaking beautiful.
Re: (Score:3, Informative)
I like grace a lot. I use it through the GUI & occasionally through python, so can't comment extensively on the perl interfaces. Neither Chart::GRACE [cpan.org] nor Chart::Graph::Xmgrace [caida.org] seem TOO obscure.
The command line interface of grace isn't terrible--it is MUCH mo
Getting GD::Graph on Windows (Score:2)
For the longest time I have been without it since I updated ActivePerl, and there was no PPM available for GD::Graph on the ActiveState repository
http://ppm.activestate.com/BuildStatus/5.8-G.html [activestate.com]
After looking at the site, I found the link at the bottom of this page [activestate.com] that says you can install GD from Univ of Winnipeg, and I was able to install GD Graph from their repository.
You can draw charts on the client side instead (Score:1, Informative)
Some examples:
Dojo Toolkit [ajaxian.com]
I think I've seen a live charting demo on Dojo's official website, but it seems to be no longer there.
WT Toolkit [sourceforge.net]
This one seems to be a new project, judging from the activity charts on their SourceForge page [sourceforge.net]. The way they can draw 3D charts (like, pie cha
AIX & the GD library (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)