GIFgraph::WithMap - generates HTML map text while plotting graph
Generates the html map block for a graph so that data series become 'clickable',
This module extends GIFgraph objects such as GIFgraph::lines. You can do everything that you would with a GIFgraph object. In addition, when the data is plotted, it generates some MAP html text.
The series will be labeled 'series 1', 'series 2' etc. unless the $obj->seriesnames has been set. For each series, it will create a polygon area, with the following structure (assuming series is named 'Green', and that the links member array is empty:
<AREA alt="Green" href="#Green" onMouseOver="self.status='Green'; return true" onMouseOut="self.status=''; return true" shape=polygon coords="87, 41, 165, 250, 165, 246, 87, 37">
So - clicking on the series will take you to #Green. If you don't specify #Green in the document, clicking on it will do very little. If you have (e.g. in the key) then it should take you there.
Use something like
$map = new GIFgraph::WithMap(new GIFgraph::lines(400,300));
Once plot has been called, map contains the map text.
print $graphWithMap->map;
This is the up/down fuzz used to construct the ploygon. It defaults to 1 - so the polygon will be three pixles wide (the pixle drawn and one above and below it).
Set this before calling plot. This is the name of the map, as given by usemap="#mapname" in <img>. It is a fatal error to try to plot without a name.
Array of names for the series. If a name is absent for a series (or all series) then it will be named Series #. This must be set before the graph is plotted.
$graphWithMap->seriesnames('name1', 'name2');
Array of links for the series. If a link is absent for a series (or all series) then it will be named #SeriesName (where SeriesName is generated as described in seriwsnames).
This module uses MRP::BaseClass to implement member access functions.
In the constructor, a new object is created that is a meld of an MRP::BaseClass derived object, and the GIFgraph object passed in. The type of that object is stoored in _GIFgraph. In AUTOLOAD, first I check to see if the GIFgraph object's package named in _GIFgraph implements the function. If it does, then I return the value of that function - i.e. it behaves as if the object inherits from that package. If that fails, then I return the value of SUPER::AUTLOLOAD, which will presumably handle it or die gracefully. Hey presto - dynamic parenting.
@ISA does not include anything to implement a GIFgraph object as a parent. However, I have overridden 'isa' to account for this.
1 POD Error
The following errors were encountered while parsing the POD:
Unknown directive: =links
To install GIFgraph::WithMap, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GIFgraph::WithMap
CPAN shell
perl -MCPAN -e shell install GIFgraph::WithMap
For more information on module installation, please visit the detailed CPAN module installation guide.