Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

An alternative for Gd?

by atemerev (Beadle)
on Apr 15, 2008 at 11:33 UTC ( #680480=perlquestion: print w/ replies, xml ) Need Help??
atemerev has asked for the wisdom of the Perl Monks concerning the following question:

I'm going to write a module for creating financial charts from Perl, like the ones you might have seen at Yahoo Finance. I know some Gd-fu, but last time I have used Gd around 4 years ago, so there's a question: maybe now, in year 2008, there are some modern alternatives to Gd? (particularly I'd appreciate logical coordinate space / vector rescaling). Or Gd is still as good as sliced bread, and there is no point in all this TMTOWTDI-ness?

Moreover, probably someone has already written a financial charting package in Perl, put it on CPAN, and I just haven't heard of it?

Comment on An alternative for Gd?
Re: An alternative for Gd?
by moritz (Cardinal) on Apr 15, 2008 at 11:55 UTC
    If you don't like GD::Graph you could try Chart.

    And since perl is a glue language you can also use it quite easily to generate gnuplot or grace files. (The homepage says that it's a WYSIWYG tool, but under the hood it uses script files just like gnuplot).

    And with those two tools you can do nearly everything you want.

Re: An alternative for Gd?
by marto (Chancellor) on Apr 15, 2008 at 12:00 UTC

      For information:

      I installed Chart::OFC with cpan shell under Debian without problem.
      Not the same thing with a Fedora server ): Some troubles with weak references.
      Reinstalling Scalar::Util from cpan solved the problem.

      See this node

      hth,
      PooLpi

      'Ebry haffa hoe hab im tik a bush'. Jamaican proverb
Re: An alternative for Gd?
by stvn (Monsignor) on Apr 15, 2008 at 15:05 UTC

    I have always used GD for my graphs too, but recent experimenting with Imager has produced some results, you might want to give it a look.

    -stvn
Re: An alternative for Gd?
by zentara (Archbishop) on Apr 15, 2008 at 15:40 UTC
    You could look at Cairo (which Gtk2 is based on). Cairo will produce svg's from the commandline (it dosn't need X). The only drawback is you will need to manually make your axis.

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: An alternative for Gd?
by samtregar (Abbot) on Apr 15, 2008 at 16:44 UTC
    I would most definitely use Google Charts for this. I used it on some time-series data recently and it was a breeze. With any luck I may never have to touch GD again!

    -sam

      Since it's going to be a public service with (hopefully) heavy loads, I don't think deferring chart processing to Google Charts is a good idea. Or it is? Have to check first.
        Google seems to be pretty good at supporting heavy load! Lots of heavy traffic sites use their free Google Maps service, for example. There's no limit on usage, but they do ask that you inform them if you expect to generate more than 250,000 charts per day (!).

        -sam

        If by public service, you mean browser based, perhaps you should bypass Perl for a purely browser based, Javascripted solution, namely, <canvas>. In which case, not only do you avoid the hit for pushing the data to Google, you can actually avoid the hit for processing in your server, and let the browser do the rendering.

        <canvas> does have some issues (no native text drawing, no native IE support, hard to get static copies of the image, etc.), but its a fairly serviceable solution.

        Here's some pointers:


        Perl Contrarian & SQL fanboy
      With any luck I may never have to touch GD again!

      Just curious: what don't you like about GD?

        Just about everything. The installation, the API, the docs, the way the output from GD::Graph looks, the speed, the font support hassles. About the only good think I can say is that it does work.

        On the other hand, Google Charts has great docs, works fast, looks great, has great anti-aliased fonts and has a decent API (could be better).

        -sam

Re: An alternative for Gd?
by superfrink (Curate) on Apr 15, 2008 at 19:27 UTC
    I used gnuplot a while ago because I didn't want to have to deal with the line-drawing logic GD required. (I also haven't used GD in a couple years.) With gnuplot the script just generats a text file and runs gnuplot.

    http://www.gnuplot.info/demo/finance.html has some financial graphing using gnuplot.

    There is also flot that does all the graphing in javascript.

      It seems to be exactly what I need. I will surely give it a try.

      Thank you.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://680480]
Approved by wfsp
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (14)
As of 2014-08-27 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (253 votes), past polls