Author image Barbie
and 1 contributors


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


  use GD::Chart::Radial;

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


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.



This constructor method creates a new chart object.

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


This accessor sets attributes of the graph such as the Title

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


        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.


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/],


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


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


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


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:



  • Allow long labels to run on multiple lines.


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


  Original Author: Aaron J Trevena <>
  Current Maintainer: Barbie <>


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

  This distribution is free software; you can redistribute it or modify it
  under the same terms as Perl itself.