NAME

Image::Magick::Chart::HorizontalBars - Use Image::Magick to create charts.

Synopsis

#!/usr/bin/perl

use Image::Magick::Chart::HorizontalBars;

Image::Magick::Chart::HorizontalBars -> new
(
	antialias				=> 0,	# 0 => No antialias; 1 => Antialias.
	bar_width				=> 8,	# Pixels.
	bg_color				=> 'white',
	colorspace				=> 'RGB',
	depth					=> 8,	# Bits per channel.
	fg_color				=> 'blue',
	font					=> 'Courier',
	frame_color				=> 'black',
	frame_option			=> 1,	# 0 => None; 1 => Draw it.
	height					=> 0,
	image					=> '',
	output_file_name		=> 'image-1.png',
	padding					=> [30, 30, 30, 30],	# [12 noon, 3, 6, 9].
	pointsize				=> 14,	# Points.
	tick_length				=> 4,	# Pixels.
	title					=> 'Percent (%)',
	width					=> 0,
	x_axis_data				=> [0, 20, 40, 60, 80, 100],
	x_axis_labels			=> [0, 20, 40, 60, 80, 100],
	x_axis_labels_option	=> 1,	# 0 => None; 1 => Draw them.
	x_axis_ticks_option		=> 2,	# 0 => None; 1 => Below x-axis; 2 => Across frame.
	x_data					=> [15, 5, 70, 25, 45, 20, 65],
	x_data_option			=> 1,
	x_pixels_per_unit		=> 3,	# Horizontal width of each data unit.
	y_axis_data				=> [1 .. 7, 8], # 8 data points, plus 1 to make result pretty.
	y_axis_labels			=> [(map{"($_)"} reverse (1 .. 7) ), ''],
	y_axis_labels_option	=> 1,	# 0 => None; 1 => Draw them.
	y_axis_ticks_option		=> 1,	# 0 => None; 1 => Left of y-axis; 2 => Across frame.
	y_pixels_per_unit		=> 20,
) -> draw();

This code is part of examples/test-chart.pl.

Note: You do not need to specify all the options above, of course, but only those you wish to differ from the defaults. I've included all options in examples/test-chart.pl just to save you the effort of having to type them in.

Description

Image::Magick::Chart::HorizontalBars is a pure Perl module.

This module uses Image::Magick to create simple charts (images consisting of horizontal bars) with optional axes, axis labels, etc.

See examples/image-*.png for sample output, and examples/test-chart.pl for the program which created those samples.

See the docs for Image::Magick::Chart for details.

Distributions

This module is available both as a Unix-style distro (*.tgz) and an ActiveState-style distro (*.ppd). The latter is shipped in a *.zip file.

See http://savage.net.au/Perl-modules.html for details.

See http://savage.net.au/Perl-modules/html/installing-a-module.html for help on unpacking and installing each type of distro.

Constructor and initialization

new(...) returns a Image::Magick::Chart::HorizontalBars object.

This is the class's contructor.

Any parameter which is supported by the parent class, Image::Magick::Chart, can be used in the call the new() in this class. So, see the docs for Image::Magick::Chart.

Method: draw()

Output the chart.

Method: new(...)

Returns a object of type Image::Magick::Chart::HorizontalBars.

See above, in the section called 'Constructor and initialization'.

Required Modules

Carp
Image::Magick.

Author

Image::Magick::Chart::HorizontalBars was written by Ron Savage <ron@savage.net.au> in 2005.

Home page: http://savage.net.au/index.html

Copyright

Australian copyright (c) 2005, Ron Savage. All rights reserved.

All Programs of mine are 'OSI Certified Open Source Software';
you can redistribute them and/or modify them under the terms of
The Artistic License, a copy of which is available at:
http://www.opensource.org/licenses/index.html