---
name: "Lire::ChartType"
section: "3pm"
platform: "linux"
package: "lire"
version: "2.1.1-8"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Lire::ChartType"
---

# Lire::ChartType(3pm)

Base interface for all ChartType.

## NAME

Lire::ChartType - Base interface for all ChartType.

## SYNOPSIS

```
  use base qw/ Lire::ChartType /;
```

## DESCRIPTION

This package defines the interface which is implemented by all the different charts that Lire is able to produce using the ploticus [**pl**(1)](/pl/1.md) 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).

## SEE ALSO

```
 Lire::PluginManager(3pm) Lire::Config::ChartSpec(3pm)
```

## AUTHOR

Francis J. Lacoste \<flacoste@logreport.org\>

## VERSION

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

## COPYRIGHT

Copyright (C) 2004 Stichting LogReport Foundation LogReport@LogReport.org

This file is part of Lire.

Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html.
