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

Hi, I'm having a graph made with GD::Graph::lines. Does anyone know if there is a way to overrule the 'display' values of the x and y axes ? The graph is calculated with some values but I want to show % values (from 0 to 100%) on both axes. These % values are only layout related. Now the default calculated values are always displayed. Vanstra

2005-03-11 Edited by Arunbear: Changed title from 'GD::Graph', as per Monastery guidelines

  • Comment on GD::Graph - how to overrule the display labels of x and y axes?

Replies are listed 'Best First'.
Re: GD::Graph - how to overrule the display labels of x and y axes?
by brian_d_foy (Abbot) on Mar 09, 2005 at 15:12 UTC

    GD::Graph has the options x_number_format and y_number_format that will create the tick label passed on whatever sub you want to give to it (so it doesn't even have to be a number).

    --
    brian d foy <bdfoy@cpan.org>
      That's exactly what I'm looking for. I didn't know that the y_number_format (also x_number_format) also pass a label which doesn't have to be a number. Thanks.
Re: GD::Graph - how to overrule the display labels of x and y axes?
by moot (Chaplain) on Mar 09, 2005 at 14:59 UTC
    Just scale the data values to 0-100 before submitting them to plot(). Change your axis labels accordingly.
      Before trying that, I was hoping there is an easier way of doing this.