I have an array with a few elements:
MSN = 34.3433423432434%
Chrome = 12.4343434353534%
Gtalk = 32.23233543543532%
…
And I’m passing this array as y-axis labels to use with a module called GD::Graph. The problem I am facing right now, is that the number are so big on the graph that they overlap with the adjacent entry and make it unreadable.
Is there a way where I can round off ALL the elements in an array to just 2 decimal places? And make it xx.xx%?
Also, anyone familar with using GD::Graph, do you know how can I increase the text-size on the graph? I can increase Title / Legend size fine, but the actual text as in ‘Gtalk’ or ‘32.23233543543532%’ is really small and I’ve tried a lot of the commands from http://search.cpan.org/dist/GDGraph/Graph.pm, but they don’t seem to work for me!
Output:
If you want to extract values in a specific order, use a hash slice:
or, if you just want keys and values to line up in the
plotcall:Note: To increase the text size on a
GD::Graph, use a larger font for the element. See Methods for charts with axes.Using
GD::Graph, you really should not have to modify the values yourself. Just provide the string'.2f%%'as the argument toy_number_format.