Lire::ChartType(3pm)

Lire::ChartType3pm

Base interface for all charttype.

Usage

  use base qw/ Lire::ChartType /;

Overview

This package defines the interface which is implemented by all the different charts that Lire is able to produce using the ploticus pl(1) command.

A chart type will generate a chart using data from a subreport.

Meta information methods

The Lire::ChartType interface extends the Lire::Plugin interface, so they must implement all standard meta-information methods (name(), title(), description()).

Generating a chart

write_chart( $chart_config, $subreport, [ %params ] )

This will write a chart from the data contained in the Lire::Report::Subreport $subreport using the configuration $chart_config. Additional parameters are passed in 'key' => $value form. The $chart_config parameters should be a Lire::Config::Dictionary object instantiated from a Lire::Config::ChartSpec.

outputdir

Directory where the file will be created. Use the working directory by default.

format

One of eps, png, jpeg or gif. Default to the configuration variable lr_image_format.

The function returns the path to the created file. The filename is generated base on the 'name' configuration value or the subreport's id if the other isn't defined. The extension is added based on the output format.

It returns the file where the chart was written.

prefab()

This method must be implemented by the subclass and should return a string representing the first parameters to pass to ploticus (that is either -prefab name or the path to a script file).

write_parameters( $chart_config, $fh )

This method is used to write parameters to the ploticus file handle. This is the place to use the #set command to set all of the prefabs parameters. Subclass must chain to this implementation for the standard chart parameters. It also write '#set name' directives for each numerical variables defined by get_vars().

write_data( $chart_config, $subreport, $fh )

This method is used by the write_chart() implementation to write the chart data from $subreport to the Ploticus commond opened on $fh. It uses the get_vars() method to obtain the numerical variables that should be written to the stream and the encode_value() method to marshall values before writing them. Before any data is written to $fh the maximum value on the Y axis is determined and output as a ploticus setting. (ploticus fails if this is not set, a single bar is drawn and the value is greater than 1.1e9.)

get_vars( $chart_config )

This method should be overriden by subclasses to return an array reference containing the Lire::Report::ColumnInfo specifying the numerical column's of data that should be written. This is usually specified using a ReferenceSpec with the 'numerical_variables' index.

These variables will start at the ploticus index 2 (@2).

encode_value( $value )

By default, this method just returns the 'content' component of the item when the $value is a name and the 'value' component otherwise. It can used for data type that needs special encoding (like datetime).

Version

$Id: ChartType.pm,v 1.17 2006/07/29 18:01:14 vanbaal Exp $

Releases

6 releases since Debian 3.1 (Sarge); the text changed 5 times.

  1. 3.1
  2. 4.0
  3. 5.0
  4. 6.0
  5. 7
  6. Arch

Author

Francis J. Lacoste <[email protected]>

From lire 2.1.1-8 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.