|
NAMEImager::Graph::Pie - a tool for drawing pie charts on Imager images SYNOPSISuse Imager::Graph::Pie; my $chart = Imager::Graph::Pie->new; # see Imager::Graph for options my $img = $chart->draw( data => [ $first_amount, $second_amount ], size => 350); DESCRIPTIONImager::Graph::Pie is intender to make it simple to use Imager to create good looking pie graphs.Most of the basic layout and color selection is handed off to Imager::Graph.
FEATURESAs described in Imager::Graph you can enable extra features for your graph. The features you can use with pie graphs are:
Inherited features:
PIE CHART STYLESThe following style values are specific to pie charts:Controlling callouts, the "callout" option:
The outline, line option controls the color of the pie segment outlines, if enabled with the "outline" feature. Under "pie":
The top level "otherlabel" setting controls the label for the "others" segment, default "(others)". EXAMPLESAssuming:# from the Netcraft September 2001 web survey # http://www.netcraft.com/survey/ my @data = qw(17874757 8146372 1321544 811406 ); my @labels = qw(Apache Microsoft i_planet Zeus ); my $pie = Imager::Graph::Pie->new; First a simple graph, normal size, no labels: my $img = $pie->draw(data=>\@data) or die $pie->error; label the segments: # error handling omitted for brevity from now on $img = $pie->draw(data=>\@data, labels=>\@labels, features=>'labels'); just percentages in the segments: $img = $pie->draw(data=>\@data, features=>'labelspconly'); add a legend as well: $img = $pie->draw(data=>\@data, labels=>\@labels, features=>[ 'labelspconly', 'legend' ]); and a title, but move the legend down, and add a dropshadow: $img = $pie->draw(data=>\@data, labels=>\@labels, title=>'Netcraft Web Survey', legend=>{ valign=>'bottom' }, features=>[ qw/labelspconly legend dropshadow/ ]); something a bit prettier: $img = $pie->draw(data=>\@data, labels=>\@labels, style=>'fount_lin', features=>'legend'); suitable for monochrome output: $img = $pie->draw(data=>\@data, labels=>\@labels, style=>'mono', features=>'legend'); INTERNAL FUNCTIONSThese are used in the implementation of Imager::Graph, and are documented for debuggers and developers.
AUTHORTony Cook <tony@develop-help.com>SEE ALSOImager::Graph(3), Imager(3), perl(1)
Visit the GSP FreeBSD Man Page Interface. |