|
B |
GIFgraph::Map - generate HTML map text.
use GIFgraph::Map;
$map = new GIFgraph::Map($gr_object);
$map->set(key1 => value1, key2 => value2 ...);
$HTML_map = $map->imagemap($gr_file, \@data);
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).
See the samples directory in the distribution.
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.
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.
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''];
Roman Kosenko
E-mail: ra@amk.al.lg.ua
Home page: http://amk.al.lg.ua/~ra
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.
|
B |