Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

There is one important instance where GD::Graph::lines does not suffice. That is the case where you require two Y axes (left & right) with more than two data curves to trace.

So I have cobbled together a module (my first ever OO) which covers that instance where GD::Graph::lines is lacking. May it serve as a tide-over until the day (month?, year?) when GD::Graph::lines shall be repaired.

This is a self-actualizing demo of the module, part of a utility I'm working on to graph strain gage rosette data. It generates fake data, saves it to a file, reads it back in, adds some calcualted-result channels, graphs it both in GD as *.png and in PostScript as an *.eps file

That's right, the output is PostScript. So you'll need a viewer (gv on UNIX, GSView on Win32) to view it. Running the file also calls up whichever of those is appropriate for your OS to display the graph.

It only does line graphs but does them quite prettily...except for the example given...which is deliberately hideous to show off user options for colors, fonts, etc. (I'm not really color-blind.)

Graphing Module Demo

There isn't any real Perl magic here, though. It's PostScript which performs all the tricks. I dredged up an old standalone PostScript graphing program which I'd written way back in 1992, tidied it a bit, broke it into pieces and married those pieces to Perl to make this happen.

You can choose any web safe color for back- and fore-grounds, lines, etc. You can choose any of the 35 fonts. And it auto-reconciles the Y1 and Y2 axes for best resolution of the data traces. That is to say, for each axis, at least one trace will course nearly the whole vertical area.

Its one big flaw is that no single data trace may number more than 65,535 data points. This is due to PostScript's internal addressing limitation...which I have yet to creatively overcome. At some point later on, after I've tinkered with it a bit more, I'll put in in CPAN. For now it's embeded in the demo script.

Gan Uesli Starling
Kalamazoo MI USA


In reply to New Graphing Module by aplonis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-04-23 20:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found