The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Imager::Graph::Vertical- A super class for line/bar/column/area charts

SYNOPSIS

  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();

DESCRIPTION

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.

METHODS

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.

set_y_max($value)

Sets the maximum y value to be displayed. This will be ignored if the y_max is lower than the highest value.

set_y_min($value)

Sets the minimum y value to be displayed. This will be ignored if the y_min is higher than the lowest value.

set_column_padding($int)

Sets the padding between columns. This is a percentage of the column width. Defaults to 0.

set_range_padding($percentage)

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.

set_negative_background($color)

Sets the background color or fill used below the x axis.

draw()

Draw the graph

FEATURES

show_horizontal_gridlines()

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

show_graph_outline($flag)

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.

eg.

  $graph->set_graph_fill_style(solid => "FF000020", combine => "normal");
show_area_markers()
show_area_markers($value)

Feature: areamarkers.

If $value is missing or true, draw markers along the top of area data series.

eg.

  $chart->show_area_markers();
show_line_markers()
show_line_markers($value)

Feature: linemarkers.

If $value is missing or true, draw markers on a line data series.

Note: line markers are drawn by default.

use_automatic_axis()

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_y_tics($count)

Set the number of Y tics to use. Their value and position will be determined by the data range.

AUTHOR

Patrick Michaud, Tony Cook.