Barbie > GD-Chart-Radial-0.08 > GD::Chart::Radial

Download:
GD-Chart-Radial-0.08.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.08   Source  

NAME ^

GD::Chart::Radial - plot and output Radial or Radar charts using the GD library.

SYNOPSIS ^

  use GD::Chart::Radial;

  my $chart = GD::Chart::Radial->new($width, $height);
  $chart->set(title=>"This is a chart");
  $chart->plot(\@data);
  print OUTFILE $chart->png;

DESCRIPTION ^

This module allows you to plot and output Radial or Radar charts using the GD library. The module is based on GD::Graph in how it can be used where possible.

A radial chart has multiple axis spread out from the centre, like spokes on a wheel. Each axis represents a particular measurement. Values are plotted by marking the value for what is being measured on each axis and optionally joining these points. The result can look like a spiderweb or a radar depending on how you plot the values.

METHODS ^

new

This constructor method creates a new chart object.

  my $chart = GD::Chart::Radial->new($width,$height);

set

This accessor sets attributes of the graph such as the Title

  $chart->set(title=>"This is a chart");

or

  $chart->set(
        legend            => [qw/april may/],
        title             => 'Some simple graph',
        y_max_value       => $max,
        y_tick_number     => 5,
        style             => 'Notch',
        colours           => [qw/white black red blue green/],
       );

Style can be Notch, Circle, Polygon or Fill. The default style is Notch. Where style is set to Fill, the data sets are also filled, as opposed to lines drawn for all other styles

Colours can be any of the following: white, black, red, blue, purple, green, grey, light_grey, dark_grey, cream, yellow, orange. The first colour is used for the background colour, the second is used for the scale markings, while the remaining colours represent the different data sets. If there are less colours than data sets, colours will be taken from the unused set of defined colours.

The default list of colours are white, black, red, blue and green, i.e. white background, black scale markings and data sets in red blue and green.

Both legend and title can be undefined. If this is the case then the relavent entry will not appear on the graph. This is useful if you plan to use other forms of labelling along with the graph, and only require the image.

plot

This method plots the chart based on the data provided and the attributes of the graph.

  my @data = ([qw/A B C D E F G/],
              [12,21,23,30,23,22,5],
              [10,20,21,24,28,15,9]);
  $chart->plot(\@data);

png

returns a PNG image for output to a file or wherever.

  open(IMG, '>test.png') or die $!;
  binmode IMG;
  print IMG $chart->png;
  close IMG

jpg

returns a JPEG image for output to a file or elsewhere, see png.

gif

returns a GIF image for output to a file or elsewhere, see png.

gd

returns a GD image for output to a file or elsewhere, see png.

Internal Methods

In order to draw the points on the chart, the following 6 shape drawing functions are used:

draw_shape
draw_diamond
draw_square
draw_circle
draw_triangle
draw_cross

TODO ^

SEE ALSO ^

GD, GD::Graph, Imager::Chart::Radial

AUTHOR ^

  Original Author: Aaron J Trevena <aaron@droogs.org>
  Current Maintainer: Barbie <barbie@missbarbell.co.uk>

COPYRIGHT & LICENSE ^

  Copyright (C) 2002,2004-2007 Aaron Trevena
  Copyright (C) 2007-2013 Barbie

  This module is free software; you can redistribute it or modify it
  under the same terms as Perl itself.
syntax highlighting: