GD::Graph::pie Code


Very few new ideas have been introduced here over the 'lines' graph example.

Certain properties have been added to the 'set' method to insert a graphic, increase the default legend spacing and dictate a 'max value' for the y axis.

The 'Y' axis is here where the 'X' axis would normally be – it's a 'horizontal bar' graph.

A legend is set with 3 values.


the above graph did not show on the slide clearly enough – the default fonts chosen by GD::Graph weren't big enough to be legible.

To rectify this, prior to the 'plot' function, the following was inserted:

my $font_spec = "./Dustismo_Sans";

$my_graph->set_y_label_font($font_spec, 12);
$my_graph->set_x_label_font($font_spec, 12);
$my_graph->set_y_axis_font($font_spec, 10);
$my_graph->set_x_axis_font($font_spec, 10);
$my_graph->set_title_font($font_spec, 20);
$my_graph->set_legend_font($font_spec, 8);
$my_graph->set_values_font($font_spec, 8);

the 'Dustismo_Sans.ttf' font file can be found in the GD::Graph distribution