NAME
GIFgraph::Map - generate HTML map text.
SYNOPSIS
use GIFgraph::Map;
$map = new GIFgraph::Map($gr_object);
$map->set(key1 => value1, key2 => value2 ...);
$HTML_map = $map->imagemap($gr_file, \@data);
DESCRIPTION
Is a perl5 module to generate HTML map text for following graph objects GIFgraph::pie, GIFgraph::bars, GIFgraph::point and GIFgraph::linespoints. As a result of its work is created HTML code containing IMG and MAP tags. You simply need to insert this code into the necessary place of your page. In the inserted thus image, its certain parts are the references and at a choice their mouse in a status line of your browser displays the additional information.(See Samples).
SAMPLES
See the samples directory in the distribution.
USAGE
First of all you must create GIFgraht object, if it necessary set options for its, create array of data and use plot_to_gif routine for create GIF image. For example create GIFgraph::pie object:
$graphic = new GIFgraph::pie;
$graphic->set('title' => 'A Pie Chart',
'label' => 'Label',
'axislabelclr' => 'black',
'pie_height' => 80);
@data = (["1st","2nd","3rd","4th","5th","6th"],
[ 4, 2, 3, 4, 3, 3.5]);
$GIFimage = 'Demo.gif';
$graphic->plot_to_gif($GIFimage, \@data);
Then create Fgraph::Map object. And set options using set routine, or set it in constructor immediately:
$map = new GIFgraph::Map($graphic);
$map->set(info => "%x slice contains %.1p% of %s (%x)");
Create HTML map text using the same name of GIF image and array of data as use GIFgraph::plot_to_gif routine:
$HTML_map = $map->imagemap($GIFimage, \@data);
Now you can insert $HTML_map into the necessary place of your HTML page.
METHODS AND FUNCTIONS
- Constructor
-
Constructor of object has following syntax:
new GIFgraph::Map($gr_object, [key1 => value1, key2 => value2 ...]);
where $gr_object this is one of the following graph objects: GIFgraph::pie, GIFgraph::bars, GIFgraph::point or GIFgraph::linespoints; key1, value1 ... the same as using in set routine. NOTE: Before use constructor you should at first set all properties of graph object.
- imagemap(file, \@data)
-
Generate HTML map text using GIF file $file and reference to array of data - \@data. This parameters must the same as used in plot_to_gif routine.
- set(key1 => value1, key2 => value2 .... )
-
Set options. See OPTIONS.
OPTIONS
- hrefs, lhrefs
-
Set hyper reference for each data (hrefs), and for each legend (lhrefs). Array @hrefs must the same size as arrays in @data list, otherwise null elements of @hrefs set to default. Similarly array @lhrefs must the same size as legend array. Default use the simple JavaScript code 'javascript:;' instead reference, which do nothing.
Example of @hrefs array:
for GIFgraph::pie
if @data = ([ "1st", "2nd", "3rd"], [ 4, 2, 3]);
then @hrefs = ["1.htm","2.htm","3.htm"];
for GIFgraph::bars GIFgraph::point and GIFgraph::linespoints
if @data = ([ "1st", "2nd", "3rd"], [ 5, 12, 24], [ 1, 2, 5]);
then @hrefs = (["1.htm","2.htm","3.htm"], ["4.htm","5.htm","6.htm"]);
Example of @lhrefs array;
if @legend = [ 'one', 'two','three'];
then @lhrefs = ["1.htm","2.htm","3.htm"];
- info, legend
-
Set information string for data and for legend. It will be show in status line of your browser. Format of this string the same for each data, but you may use special symbols for receive individual information. Now available following symbols: %x - Is replaced on x values in @data (first array) %y - Is replaced on y values in @data (other arrays) %s - Is replaced on sum of all y values. Only for GIFgraph::pie object. %p - Is replaced on value, which show what part of all contains this data. Only for GIFgraph::pie object. %l - Is replaced on legend. Only for GIFgraph::bars, GIFgraph::points and GIFgraph::linespoints objects. For %x, %y, %s and %p parameters you may use special format (the same as use sprintf routine) for round data: %.d{x|y|p|s}, where d is a digit from 0 to 9. For example %.0p or %.3x. It is desirable use if %x, %y, %s or %p if floating numbers Default is 'x=%x y=%y' for info, and '%l' for legend.
- img_*
-
You can set any attribute in IMG tag (except UseMap, Src, Width, Height and Border, they will be set automatically) use set routine: set(img_option => value), where option is IMG attribute. For example: routine set(img_Alt => 'Example'); include Alt='Example' to IMG tag.
- newWindow, window_*
-
If newWindow set to TRUE and link does not contain JavaScript code (javascript:...), that link will be open in new navigator window, Parameters of new window you can set using window_* parameters, similarly img_* option.
AUTHOR
Roman Kosenko
Contact info
E-mail: ra@amk.al.lg.ua
Home page: http://amk.al.lg.ua/~ra
Copyright
Copyright (C) 1999 Roman Kosenko. All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 462:
=over should be: '=over' or '=over positive_number'