Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

GD::Graph questions

by rpike (Scribe)
on Dec 02, 2010 at 21:45 UTC ( #875012=perlquestion: print w/ replies, xml ) Need Help??
rpike has asked for the wisdom of the Perl Monks concerning the following question:

How do you change the font of the title and the x- and y-axis labels? I'd like the font to be about double the size it currently defaults to. Any help would be appreciated.

Comment on GD::Graph questions
Re: GD::Graph questions
by umasuresh (Hermit) on Dec 02, 2010 at 21:51 UTC
    Did you try the something like this?
    $graph->set_x_axis_font('/fonts/arial.ttf', 20); $graph->set_y_axis_font('/fonts/arial.ttf', 20);
    NOTE: untested! UPDATE: I tried the above and it doesn't work at least in Windows even after specifying the font path. However I tried odha57's suggestion in Using GD on MS Windows and this increased the font size.
    $graph->set_x_axis_font(GD::Font->MediumBold); $graph->set_y_axis_font(GD::Font->MediumBold);
    You may have look into GD::Font to be able to specify the exact font size. Good Luck!
      The title font is easy:
      $graph->set_title_font('/fonts/arial.ttf', 20);
Re: GD::Graph questions
by ww (Bishop) on Dec 02, 2010 at 21:59 UTC
    Did you read the docs, http://search.cpan.org/~mverb/GDGraph-1.43/Graph.pm#USAGE?

    No?     Oh, sorry :-(
     

    - -
    Methods for charts with axes. $graph->set_x_label_font(font specification) $graph->set_y_label_font(font specification) $graph->set_x_axis_font(font specification) $graph->set_y_axis_font(font specification) $graph->set_values_font(font specification) Set the font for the x and y axis label, the x and y axis value la +bels, and for the values printed above the data points. See "FONTS".

    Yeah, may or may not do precisely what you want, but finding that took only a few seconds and there's a rather large part of the doc I haven't read.

    But my cursory effort also uncovered this which may even offer some code to cargo-cult.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2014-11-28 23:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (200 votes), past polls