ChartType(3pm)
π ChartType(3pm) β Lire::ChartType, bestie edition
okay so real talk, this is a page from LogReport's Lire Documentation and it's literally the blueprint page β the base interface vibe that every other chart type copies. iykyk π
β¨ NAME β¨
Lire::ChartType β the Base interface for all ChartType. she's the blueprint, the moment, the main character of chart interfaces π
πΈ SYNOPSIS πΈ
use base qw/ Lire::ChartType /;
that's it. that's the whole flex. π«Ά
π¦ DESCRIPTION π¦
So this package defines the interface that every single different chart Lire can produce has to implement β and Lire makes those charts using the ploticus pl(1) command. no cap, that's the whole setup β¨
And what does a chart type actually do? A chart type will generate a chart using data from a subreport. that's the assignment, that's the job, periodt π
π META INFORMATION METHODS π
okay so the Lire::ChartType interface extends the Lire::Plugin interface, which means subclasses must implement all the standard meta-information methods β name(), title(), description(). all three, no skipping, no shortcuts π₯
π§ 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. Extra parameters get passed in 'key' => $value form. The $chart_config parameters should be a Lire::Config::Dictionary object instantiated from a Lire::Config::ChartSpec. iconic behavior tbh π
outputdir
- Directory where the file will be created. Uses the working directory by default. π
format
- One of
eps,png,jpegorgif. Defaults to the configuration variablelr_image_format. π¨
The function returns the path to the created file. The filename is generated based on the 'name' configuration value β or the subreport's id if the other one isn't defined. Then the extension gets added based on the output format. slay π
It returns the file where the chart was written. yes, again. she said it twice. it's that important π«Ά
β prefab()
This method must be implemented by the subclass, and it should return a string representing the first parameters to pass to ploticus. that's either -prefab name or the path to a script file. pick your fighter βοΈ
β 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 prefab's parameters. Subclasses must chain to this implementation for the standard chart parameters. π
It also writes '#set name' directives for each of the numerical variables defined by get_vars(). every single one, we don't leave anyone out π
β 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 command 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 marshal values before writing them. β¨
β οΈ okay this part is important bestie: before any data is written to $fh, the maximum value on the Y axis is determined and output as a ploticus setting. why? because ploticus fails if this is not set (specifically: a single bar is drawn and the value is greater than 1.1e9). so like... set it. please. π
β get_vars( $chart_config )
This method should be overridden by subclasses to return an array reference containing the Lire::Report::ColumnInfo specifying the numerical columns of data that should be written. This is usually specified using a ReferenceSpec with the 'numerical_variables' index. π
And heads up: these variables will start at the ploticus index 2 (@2). not 1. 2. don't come for me, that's just how it is π«Ά
β 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 be used for data types that need special encoding (like datetime). β°π
π SEE ALSO π
go read those too, bestie, the lore is deep πβ¨
π AUTHOR π
Francis J. Lacoste <flacoste@logreport.org> β legend behavior π
π 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.
π also the manual page says it'sLire 2.1.1and dated2025-09-28
and that's the page!! mwah π go write a chart type, bestie β Lire 2.1.1, dated 2025-09-28, signing off π¦β¨π
π¦ where this page comes from
- arch rolling: lire 2.1.1-8 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms