Imager::Graph::Vertical- A super class for line/bar/column/area charts
use Imager::Graph::Vertical; my $vert = Imager::Graph::Vertical->new; $vert->add_column_data_series(\@data, "My data"); $vert->add_area_data_series(\@data2, "Area data"); $vert->add_stacked_column_data_series(\@data3, "stacked data"); $vert->add_line_data_series(\@data4, "line data"); my $img = $vert->draw(); use Imager::Graph::Column; my $column = Imager::Graph::Column->new; $column->add_data_series(\@data, "my data"); my $img = $column->draw();
This is a base class that implements the functionality for column, stacked column, line and area charts where the dependent variable is represented in changes in the vertical position.
The subclasses, Imager::Graph::Column, Imager::Graph::StackedColumn, Imager::Graph::Line and Imager::Graph::Area simply provide default data series types.
Add a data series to the graph, of the default type. This requires that the graph object be one of the derived graph classes.
Add a column data series to the graph.
Add a stacked column data series to the graph.
Add a line data series to the graph.
Add a area data series to the graph.
Sets the maximum y value to be displayed. This will be ignored if the y_max is lower than the highest value.
Sets the minimum y value to be displayed. This will be ignored if the y_min is higher than the lowest value.
Sets the padding between columns. This is a percentage of the column width. Defaults to 0.
Sets the padding to be used, as a percentage. For example, if your data ranges from 0 to 10, and you have a 20 percent padding, the y axis will go to 12.
Defaults to 10. This attribute is ignored for positive numbers if set_y_max() has been called, and ignored for negative numbers if set_y_min() has been called.
Sets the background color or fill used below the x axis.
Draw the graph
Feature: horizontal_gridlines
Enables the horizontal_gridlines feature, which shows horizontal gridlines at the y-tics.
horizontal_gridlines
The style of the gridlines can be controlled with the set_horizontal_gridline_style() method (or by setting the hgrid style).
Style: hgrid.
Set the style and color of horizonal gridlines.
See: "Line styles" in Imager::Graph
Feature: graph_outline
If no flag is supplied, unconditionally enable the graph outline.
If $flag is supplied, enable/disable the graph_outline feature based on that.
Enabled by default.
Style: graph.outline
Sets the style of the graph outline.
Default: the style fg.
fg
Style: graph.fill
Set the fill used to fill the graph data area.
Default: the style bg.
bg
eg.
$graph->set_graph_fill_style(solid => "FF000020", combine => "normal");
Feature: areamarkers.
If $value is missing or true, draw markers along the top of area data series.
$chart->show_area_markers();
Feature: linemarkers.
If $value is missing or true, draw markers on a line data series.
Note: line markers are drawn by default.
Automatically scale the Y axis, based on Chart::Math::Axis. If Chart::Math::Axis isn't installed, this sets an error and returns undef. Returns 1 if it is installed.
Set the number of Y tics to use. Their value and position will be determined by the data range.
Patrick Michaud, Tony Cook.
To install Imager::Graph, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Imager::Graph
CPAN shell
perl -MCPAN -e shell install Imager::Graph
For more information on module installation, please visit the detailed CPAN module installation guide.