Chart::...rkflows(3)
π Chart::...rkflows(3) β NAME π
So you wanna know the different ways to create charts? Bestie, you came to the right page. This is Chart::...rkflows(3), fresh out of the User Contributed Perl Documentation collection, and it's literally all about the workflows, iykyk.
β¨ OVERVIEW β¨
Okay so picture this: making a chart image is five major steps, and four of them are locked in order, no negotiating. π«Ά
- First you
loadthe module. - Secondly you create the object.
- After that you may change some properties.
- And always, as the last step, you create the image β no matter if the output goes to
STDOUTor into a file.
The only actual flexibility? It's in how you prefer to provide the data. And here you have three options, bestie:
- Most commonly you add one data set at the time, which could also be understood as a row of the complete data table.
- Second option is to build the table column by column.
- Thirdly you can drop the complete table at once, either by reference to a data structure or a file containing the data.
Heads up though β οΈ the last option is closed if you already gave the object data. And it is not advisable to reuse a chart object for further image creation outside of modern art projects. Like, unless your vibe is gallery-core, don't. π
πΈ STEPS πΈ
Most steps are already explained elsewhere and the OVERVIEW just links there. The missing bits are laid out right here, so stay with me. π
π use Chart
As with any other Modul you have to:
use Chart::[Type];
Type is a placeholder for a name of a chart type, and the chart types are: Bars, Composite, Direction, ErrorBars, HorizontalBars, Lines, LinesPoints, Mountain, Pareto, Pie, Points, Split, StackedBars. To know more about them read Chart::Manual::Types. π
Alternatively write this to load all chart types at once:
use Chart;
Both are not importing any symbols in your namespace, but they do load Carp and GD. Slay. β¨
π¦ drop data
All the methods listed in the last section that create the final image take as an optional, second argument data. This data may be delivered either as a reference to an array of arrays:
my $data = [ [ 1, 4, 3 ... ], # data set 0
[ 5, 8, 2 ... ], # data set 1
...
];
$graph->png( 'file.png', $data );
...or in form of a file. Then the argument has to be a file name or a file handle (old school as in "FILE" or modern as in $FH). Alternatively use the method add_datafile. Main character energy, honestly. π
π data files
These are arbitrary named text files containing one or several rows of numbers, which have to be separated by spaces or tabs (\t) β mixing allowed, we're not judgy. π§
Perl style comments or empty lines will be ignored, but rows containing different amount of numbers will cause problems. Not cute, not iconic, just problems. π
π create image
Currently we support only images in the PNG and JPEG format. The methods to create them are named straight forwardly: ->png and ->jpeg. Both take the same arguments and produce image files. π¨
For shell scripting or web programming you need the image binary, which you get with: ->cgi_png or ->cgi_jpeg.
Some users might even want the GD object for further processing by your perl programm. In that case please use: ->scalar_png or ->scalar_jpeg.
After having created a chart for web purposes, you also might want to utilize imagemap_dump. Obsessed, fr fr. π₯
π COPYRIGHT & LICENSE π
Copyright 2022 Herbert Breunung.
This program is free software; you can redistribute it and/or modify it under same terms as Perl itself.
π AUTHOR π
Herbert Breunung, <lichtkind@cpan.org>
Okay that's the whole page, bestie β no cap, every last detail accounted for. π«Ά This gem ships with perl v5.42.0, dated 2022-11-29, and it is literally Chart::...rkflows(3) from the User Contributed Perl Documentation. Periodt. πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Chart 2.403.9-bp160.1.11 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms