Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am graphing some large numbers with GD::Graph::lines which caused GD::Graph to extrapolate y-axis values such as "10000000".

It sure would be swell if I could get these values commified as in "10,000,000". Is there a way to get GD::Graph to commify the values it auto-generates to label the axes?

Thanks for any candor shared.

  • Comment on commifying charts generated from GD::Graph::lines?

Replies are listed 'Best First'.
Re: commifying charts generated from GD::Graph::lines?
by roboticus (Chancellor) on Dec 13, 2008 at 12:56 UTC
    Anonymous Monk:

    GD::Graph offers you the x_number_format and y_number_format hooks in which you could plug the commifying code. Read the docs under the 'Options for graphs with axes' section for an example.

    Disclaimer: I have never used GD::Graph, so this is just what I can guess from a quick look at the documentation for the module...

    ...roboticus

      Thanks for your reply!

      y_number_format worked as advertized.

Re: commifying charts generated from GD::Graph::lines?
by n3toy (Hermit) on Dec 13, 2008 at 04:53 UTC
    I came across Tie::Comma the other day just browsing CPAN. Not sure if it will work, but maybe a good place to start.

    Jamie