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_data_series(\@data, $series_name)

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_column_data_series(\@data, $series_name)

Add a column data series to the graph.

add_stacked_column_data_series(\@data, $series_name)

Add a stacked column data series to the graph.

add_line_data_series(\@data, $series_name)

Add a line data series to the graph.

add_area_data_series(\@data, $series_name)

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.

The style of the gridlines can be controlled with the set_horizontal_gridline_style() method (or by setting the hgrid style).

set_horizontal_gridline_style(style => $style, color => $color)

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.

set_graph_outline_style(color => ...)
set_graph_outline_style(style => ..., color => ...)

Style: graph.outline

Sets the style of the graph outline.

Default: the style fg.

set_graph_fill_style(fill parameters)

Style: graph.fill

Set the fill used to fill the graph data area.

Default: the style bg.


  $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.



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.