ChartType(3pm)

πŸ“¦ version 2.1.1, in arch rolling

πŸ’… 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, jpeg or gif. Defaults to the configuration variable lr_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 (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's Lire 2.1.1 and dated 2025-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