Codebase list libchart-perl / bb314cc
New upstream version 2.403.7 gregor herrmann 1 year, 8 months ago
34 changed file(s) with 274 addition(s) and 240 deletion(s). Raw diff Collapse all Expand all
0 2.403.6 2022-08-21 lichtkind
1 -------
2 * = POD rewrite release
3 * ! gap in HTML tag in POD prevented lanfing page illustrations
4 * ? final touche on new POD documentation
5
6 2.403.5 2022-08-18 lichtkind
0 2.403.7 2022-07-29 lichtkind
1 -------
2 * = POD rewrite release
3 * ? move landing page examples in own category, independent from test script runs
4 * ? reduce references to gone modules in Chart.pm POD
5 * ? clearify some bits in POD
6 * ? several final touches on types manual page and example images
7 * ! fix sub title in manual demo of pie chart
8 * ! bad dates, typos in Changes
9
10 2.403.6 2022-07-21 lichtkind
11 -------
12 * = POD rewrite release
13 * ! gap in HTML tag in POD prevented landing page demo images
14 * ? final touches on new POD documentation
15
16 2.403.5 2022-07-18 lichtkind
717 -------
818 * = POD rewrite release
919 * ? completed workflow page in manual
1020 * ? completed methods page in manual
1121
12 2.403.4 2022-08-17 lichtkind
22 2.403.4 2022-07-17 lichtkind
1323 -------
1424 * = POD rewrite release
1525 * ? completed types page in manual
1626 * ! fixed some image sizes
1727 * ! fixed dist.ini so old stuff from git don't spill into release
1828
19 2.403.3 2022-08-16 lichtkind
29 2.403.3 2022-07-16 lichtkind
2030 -------
2131 * = POD rewrite release
2232 * + addded images to landing page
2535 * ? some small addons for properties page
2636 * ! fixed overlong tick label due rounding error near zero
2737
28 2.403.2 2022-08-13 lichtkind
38 2.403.2 2022-07-13 lichtkind
2939 -------
3040 * = POD rewrite release
3141 * ? completed properties page in manual
3242 * ? started types page in manual with first test example
3343 * ! linkfixes on landing POD of Chart.pm
34 * ! linkfixes on Color::Constants.pm POD
35
36 2.403.1 2022-08-12 lichtkind
44 * ! linkfixes on Color::Constant.pm POD
45
46 2.403.1 2022-07-12 lichtkind
3747 -------
3848 * = POD rewrite release
3949 * ? completed most of properties
40 * ? all names listed in Color::Constants.POD
41
42 2.403.0 2022-08-07 lichtkind
50 * ? all names listed in Color::Constant.pm POD
51
52 2.403.0 2022-07-07 lichtkind
4353 -------
4454 * = test release to check metacpan POD parser
4555 * + added Chart::Manual + property sub page
4656 * - drop PDF and HTML documentation
4757 * - drop dependency on module: POSIX
4858
49 2.402.3 2022-07-18 lichtkind
59 2.402.3 2022-06-18 lichtkind
5060 -------
5161 * + string method to Color objects
5262 * ? fixed #18891 : document that y_ticks1, y_ticks2 is composite only
2020 lib/Chart/Constants.pm
2121 lib/Chart/Direction.pm
2222 lib/Chart/ErrorBars.pm
23 lib/Chart/Font.pm
2423 lib/Chart/HorizontalBars.pm
2524 lib/Chart/Lines.pm
2625 lib/Chart/LinesPoints.pm
3433 lib/Chart/Pie.pm
3534 lib/Chart/Points.pm
3635 lib/Chart/Property.pm
36 lib/Chart/Property/DataType/Font.pm
3737 lib/Chart/Split.pm
3838 lib/Chart/StackedBars.pm
3939 t/001_color_value.t
5353 "provides" : {
5454 "Chart" : {
5555 "file" : "lib/Chart.pm",
56 "version" : "v2.403.6"
56 "version" : "v2.403.7"
5757 },
5858 "Chart::Bars" : {
5959 "file" : "lib/Chart/Bars.pm",
60 "version" : "v2.403.6"
60 "version" : "v2.403.7"
6161 },
6262 "Chart::Color" : {
6363 "file" : "lib/Chart/Color.pm",
64 "version" : "v2.403.6"
64 "version" : "v2.403.7"
6565 },
6666 "Chart::Composite" : {
6767 "file" : "lib/Chart/Composite.pm",
68 "version" : "v2.403.6"
68 "version" : "v2.403.7"
6969 },
7070 "Chart::Direction" : {
7171 "file" : "lib/Chart/Direction.pm",
72 "version" : "v2.403.6"
72 "version" : "v2.403.7"
7373 },
7474 "Chart::ErrorBars" : {
7575 "file" : "lib/Chart/ErrorBars.pm",
76 "version" : "v2.403.6"
77 },
78 "Chart::Font" : {
79 "file" : "lib/Chart/Font.pm",
80 "version" : "v2.403.6"
76 "version" : "v2.403.7"
8177 },
8278 "Chart::HorizontalBars" : {
8379 "file" : "lib/Chart/HorizontalBars.pm",
84 "version" : "v2.403.6"
80 "version" : "v2.403.7"
8581 },
8682 "Chart::Lines" : {
8783 "file" : "lib/Chart/Lines.pm",
88 "version" : "v2.403.6"
84 "version" : "v2.403.7"
8985 },
9086 "Chart::LinesPoints" : {
9187 "file" : "lib/Chart/LinesPoints.pm",
92 "version" : "v2.403.6"
88 "version" : "v2.403.7"
9389 },
9490 "Chart::Mountain" : {
9591 "file" : "lib/Chart/Mountain.pm",
96 "version" : "v2.403.6"
92 "version" : "v2.403.7"
9793 },
9894 "Chart::Pareto" : {
9995 "file" : "lib/Chart/Pareto.pm",
100 "version" : "v2.403.6"
96 "version" : "v2.403.7"
10197 },
10298 "Chart::Pie" : {
10399 "file" : "lib/Chart/Pie.pm",
104 "version" : "v2.403.6"
100 "version" : "v2.403.7"
105101 },
106102 "Chart::Points" : {
107103 "file" : "lib/Chart/Points.pm",
108 "version" : "v2.403.6"
104 "version" : "v2.403.7"
109105 },
110106 "Chart::Property" : {
111107 "file" : "lib/Chart/Property.pm",
112 "version" : "v2.403.6"
108 "version" : "v2.403.7"
109 },
110 "Chart::Property::DataType::Font" : {
111 "file" : "lib/Chart/Property/DataType/Font.pm",
112 "version" : "v2.403.7"
113113 },
114114 "Chart::Split" : {
115115 "file" : "lib/Chart/Split.pm",
116 "version" : "v2.403.6"
116 "version" : "v2.403.7"
117117 },
118118 "Chart::StackedBars" : {
119119 "file" : "lib/Chart/StackedBars.pm",
120 "version" : "v2.403.6"
120 "version" : "v2.403.7"
121121 }
122122 },
123123 "release_status" : "stable",
128128 "web" : "https://github.com/lichtkind/Chart"
129129 }
130130 },
131 "version" : "v2.403.6",
131 "version" : "v2.403.7",
132132 "x_generated_by_perl" : "v5.30.0",
133133 "x_maintainers" : [
134134 "Herbert Breunung <lichtkind@cpan.org>"
2727 provides:
2828 Chart:
2929 file: lib/Chart.pm
30 version: v2.403.6
30 version: v2.403.7
3131 Chart::Bars:
3232 file: lib/Chart/Bars.pm
33 version: v2.403.6
33 version: v2.403.7
3434 Chart::Color:
3535 file: lib/Chart/Color.pm
36 version: v2.403.6
36 version: v2.403.7
3737 Chart::Composite:
3838 file: lib/Chart/Composite.pm
39 version: v2.403.6
39 version: v2.403.7
4040 Chart::Direction:
4141 file: lib/Chart/Direction.pm
42 version: v2.403.6
42 version: v2.403.7
4343 Chart::ErrorBars:
4444 file: lib/Chart/ErrorBars.pm
45 version: v2.403.6
46 Chart::Font:
47 file: lib/Chart/Font.pm
48 version: v2.403.6
45 version: v2.403.7
4946 Chart::HorizontalBars:
5047 file: lib/Chart/HorizontalBars.pm
51 version: v2.403.6
48 version: v2.403.7
5249 Chart::Lines:
5350 file: lib/Chart/Lines.pm
54 version: v2.403.6
51 version: v2.403.7
5552 Chart::LinesPoints:
5653 file: lib/Chart/LinesPoints.pm
57 version: v2.403.6
54 version: v2.403.7
5855 Chart::Mountain:
5956 file: lib/Chart/Mountain.pm
60 version: v2.403.6
57 version: v2.403.7
6158 Chart::Pareto:
6259 file: lib/Chart/Pareto.pm
63 version: v2.403.6
60 version: v2.403.7
6461 Chart::Pie:
6562 file: lib/Chart/Pie.pm
66 version: v2.403.6
63 version: v2.403.7
6764 Chart::Points:
6865 file: lib/Chart/Points.pm
69 version: v2.403.6
66 version: v2.403.7
7067 Chart::Property:
7168 file: lib/Chart/Property.pm
72 version: v2.403.6
69 version: v2.403.7
70 Chart::Property::DataType::Font:
71 file: lib/Chart/Property/DataType/Font.pm
72 version: v2.403.7
7373 Chart::Split:
7474 file: lib/Chart/Split.pm
75 version: v2.403.6
75 version: v2.403.7
7676 Chart::StackedBars:
7777 file: lib/Chart/StackedBars.pm
78 version: v2.403.6
78 version: v2.403.7
7979 requires:
8080 Carp: '1.35'
8181 GD: '2'
8282 perl: v5.12.0
8383 resources:
8484 repository: git://github.com/lichtkind/Chart.git
85 version: v2.403.6
85 version: v2.403.7
8686 x_generated_by_perl: v5.30.0
8787 x_maintainers:
8888 - 'Herbert Breunung <lichtkind@cpan.org>'
2424 "Test::More" => "1.3",
2525 "Test::Warn" => "0.30"
2626 },
27 "VERSION" => "v2.403.6",
27 "VERSION" => "v2.403.7",
2828 "test" => {
2929 "TESTS" => "t/*.t"
3030 }
3535 $imagemap_ref = $obj->imagemap_dump ();
3636
3737 DESCRIPTION
38 Chart help you to create PNG and JPG images with visualizations of
38 Chart helps you to create PNG and JPG images with visualizations of
3939 numeric data. This page gives you a summary how to use it. For a more
4040 thorough documentation and lots of example code please visit the
4141 Chart::Manual.
5050
5151 use Chart::Lines;
5252
53 would invoke the lines module. Alternatively write to load all chart
54 types at ones with
53 would invoke the lines module. Alternatively load all chart types at
54 ones and write:
5555
5656 use Chart;
5757
118118 src=image.pl<gt> HTML tag). The @data array should be set up the
119119 same way as for the normal png method.
120120
121 Graph.pm-style API
121 column based API
122122 You might ask, "But what if I just want to add a few points to the
123123 graph, and then display it, without all those references to
124124 references?". Well, friend, the solution is simple. Borrowing the add_pt
00 ROADMAP:
11 -------
22
3 3.0 rewrite comlete
3 3.0 rewrite complete
44 ...
55
66 2.406 rewrite axis, tiks, label, box rendering
99
1010 we are here <-------------------------------------------------
1111
12 2.403 dropped old pdf and html and added new POD documentation with embedded HML img
12 2.403 replaced old pdf and html with new POD documentation with embedded HML img
1313 2.402 new, powerful color management: HSL, hex_RGB, hash_RGB, Pantone colors
1414 2.401 reformat distribution to be based on Dist::Zilla, solve CPAN issues
1515
44
55 package Chart::Bars;
66 our @ISA = qw(Chart::Base);
7 our $VERSION = 'v2.403.6';
7 our $VERSION = 'v2.403.7';
88
99 use Chart::Base;
1010 use GD;
44 use v5.12;
55
66 package Chart::Base;
7 our $VERSION = 'v2.403.6';
7 our $VERSION = 'v2.403.7';
88
99 use FileHandle;
1010 use Carp;
1111 use GD;
1212 use GD::Image;
1313 use Chart::Color;
14 #use Chart::Font;
14 #use Property::DataType::Font;
1515
1616 #>>>>>>>>>>>>>>>>>>>>>>>>>>#
1717 # public methods #
33 use v5.12;
44
55 package Chart::BrushStyles;
6 our $VERSION = 'v2.403.6';
6 our $VERSION = 'v2.403.7';
77
88 use Carp;
99 use GD;
22 # named colors from X11, HTML (SVG) standard and Pantone report
33
44 package Chart::Color::Constant;
5 our $VERSION = 'v2.403.6';
5 our $VERSION = 'v2.403.7';
66 use Carp;
77 use Chart::Color::Value;
88
22 # check, convert and measure color values
33
44 package Chart::Color::Value;
5 our $VERSION = 'v2.403.6';
5 our $VERSION = 'v2.403.7';
66 use Carp;
77
88 sub check_rgb { # carp returns 1
44 use v5.12;
55
66 package Chart::Color;
7 our $VERSION = 'v2.403.6';
7 our $VERSION = 'v2.403.7';
88
99 use Carp;
1010 use Chart::Color::Constant;
346346 Name of the color in the X11 or HTML (SVG) standard or the Pantone report.
347347 The name will be found and filled in, even when the object is created
348348 with RGB or HSL values. If the color is not found in any of the mentioned
349 standards, it returns an empty string.
349 standards, it returns an empty string. All names are at: L<Chart::Color::Constant/NAMES>
350350
351351 =head2 string
352352
33
44 package Chart::Composite;
55 our @ISA = qw(Chart::Base);
6 our $VERSION = 'v2.403.6';
6 our $VERSION = 'v2.403.7';
77
88 use Chart::Base;
99 use GD;
33 use v5.12;
44
55 package Chart::Constants;
6 our $VERSION = 'v2.403.6';
6 our $VERSION = 'v2.403.7';
77
88 use constant PI => 4 * atan2( 1, 1 );
99
44
55 package Chart::Direction;
66 our @ISA = qw(Chart::Base);
7 our $VERSION = 'v2.403.6';
7 our $VERSION = 'v2.403.7';
88
99 use Chart::Base;
1010 use GD;
55
66 package Chart::ErrorBars;
77 our @ISA = qw(Chart::Base);
8 our $VERSION = 'v2.403.6';
8 our $VERSION = 'v2.403.7';
99
1010 use Chart::Base;
1111 use GD;
+0
-90
lib/Chart/Font.pm less more
0
1 #
2
3 use v5.12;
4
5 package Chart::Font;
6 our $VERSION = 'v2.403.6';
7
8 use Carp;
9
10 ## constructor #########################################################
11
12 sub new {
13 my $pkg = shift;
14 my $def = shift;
15 return unless ref $def eq 'HASH';
16 bless {};
17 }
18
19 ## getter ##############################################################
20
21 sub name {
22
23 }
24
25 sub bold {
26
27 }
28
29 sub size {
30
31 }
32
33 sub unicode {
34 }
35
36 sub truetype {
37
38 }
39
40
41 1;
42
43 __END__
44
45 =pod
46
47 =head1 NAME
48
49 Chart::Font - read only single font holding objects
50
51 =head1 SYNOPSIS
52
53 my $red = Chart::Color->new('red');
54 say $red->add('blue')->name; # magenta, mixed in RGB space
55 Chart::Color->new( 0, 0, 255)->hsl # 240, 100, 50 = blue
56 $blue->blend_with({H=> 0, S=> 0, L=> 80}, 0.1);# mix blue with a little grey
57 $red->gradient( '#0000FF', 10); # 10 colors from red to blue
58 $red->complementary( 3 ); # get fitting red green and blue
59
60 =head1 DESCRIPTION
61
62
63
64 =head1 COPYRIGHT & LICENSE
65
66 Copyright 2022 Herbert Breunung.
67
68 This program is free software; you can redistribute it and/or modify it
69 under same terms as Perl itself.
70
71 =head1 AUTHOR
72
73 Herbert Breunung, <lichtkind@cpan.org>
74
75 =cut
76
77
78 __END__
79 $im->string( GD::Font->Tiny , 20, 20, 'Tiny', 2);
80 $im->string( GD::Font->Small , 20, 50, 'Small', 1);
81 $im->string( GD::Font->MediumBold , 20, 80, 'MediumBold', 2);
82 $im->string( GD::Font->Large , 20, 110, 'Large', 1);
83 $im->string( GD::Font->Giant , 20, 140, 'Giant', 2);
84
85 gdTinyFont
86 gdSmallFont
87 gdMediumBoldFont
88 gdLargeFont
89 gdGiantFont
22
33 package Chart::HorizontalBars;
44 our @ISA = qw(Chart::Base);
5 our $VERSION = 'v2.403.6';
5 our $VERSION = 'v2.403.7';
66
77 use Chart::Base;
88 use GD;
44
55 package Chart::Lines;
66 our @ISA = qw(Chart::Base);
7 our $VERSION = 'v2.403.6';
7 our $VERSION = 'v2.403.7';
88
99 use Chart::Base;
1010 use GD;
77
88 package Chart::LinesPoints;
99 our @ISA = qw(Chart::Base);
10 our $VERSION = 'v2.403.6';
10 our $VERSION = 'v2.403.7';
1111
1212 use Chart::Base;
1313 use GD;
1111 $chart_object->set( %properties);
1212 $chart_object->set( key => 'value', ... );
1313
14 This page documents all viable keys and values for this method.
14 This page documents all viable keys and values for this calls.
15
1516 The first section lists the most common data types and their acceptable
1617 values.
1718
18 Please note that every chart L<type|Chart::Manual::Types> reacts only to
19 a distinct property subset. The L<section section|/"BY CHART TYPE">
19 Please note that all chart L<type|Chart::Manual::Types> reacts only to
20 a distinct subset of properties. The L<section section|/"BY CHART TYPE">
2021 therefore groups all properties by chart type or set of types, where they
2122 have an effect. The descriptions in this section are shortened to achive
2223 a tabular overview.
2425 A fuller description of each property provides the
2526 L<third section|/ALPHABETICALLY>, where they are alpabetically sorted.
2627
28 The general layout of a chart image:
29
30 =for HTML <p>
31 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/manual/layout.png" alt="layout">
32 </p>
2733
2834 =head1 DATA TYPES
2935
7379
7480 =head2 integer
7581
76 Whole numbers (without decimals) to set position, size and alike
82 Whole numbers (without decimals) to set position, size and alike.
7783
7884 =head2 positive integer
7985
459465
460466 Lets Chart know you're going to ask for information about the placement
461467 of the data for use in creating an image map from the png. This information
462 can be retrieved using the imagemap_dump() method. NB. that the
463 imagemap_dump() method cannot be called until after the Chart has been
464 generated (ie. using the png() or cgi_png() methods).
468 can be retrieved using the L<imagemap_dump()|Chart::Manual::Methods/imagemap_dump>
469 method. NB. that the imagemap_dump() method cannot be called until after
470 the Chart has been L<generated|"/Chart::Manual::Workflows/create image">.
465471
466472 =head2 include_zero
467473
2020 which are width and height of the later generated image.
2121
2222
23 =head1 Bars
23 =head2 Bars
2424
2525 =for HTML <p>
2626 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/manual/bars.png" alt="dual bar chart" width="500" height="300">
6969 $g->png("bars.png");
7070
7171
72 =head1 Composite
72 =head2 Composite
7373
7474 =for HTML <p>
7575 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/manual/composite.png" alt="composite chart">
112112 $g->png("composite.png");
113113
114114
115 =head1 Direction
115 =head2 Direction
116116
117117 =for HTML <p>
118118 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/manual/direction.png" alt="polar chart">
175175 $g->png("direction.png");
176176
177177
178 =head1 ErrorBars
178 =head2 ErrorBars
179179
180180 =for HTML <p>
181181 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/manual/error.png" alt="error bar chart">
222222 $g->png("error.png");
223223
224224
225 =head1 HorizontalBars
225 =head2 HorizontalBars
226226
227227 =for HTML <p>
228228 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/manual/hbars.png" alt="horizontal bar chart">
232232 Same rules apply as in L</Bars>, except due negative values in our data sets
233233 here L<min_val|Chart::Manual::Properties/min_val> doesn't have to be set to zero.
234234 And instead of L<y_grid_lines|Chart::Manual::Properties/y_grid_lines>
235 we activate and color L<x_grid_lines|Chart::Manual::Properties/x_grid_lines>
236
235 we activate and color L<x_grid_lines|Chart::Manual::Properties/x_grid_lines>.
236 Deactivating the grey background of the plot just adds a little friendliness.
237237
238238 use Chart::HorizontalBars;
239239
255255 y_label => 'gray40',
256256 title => 'gray20',
257257 }
258 grey_background => 'false',
258259 );
259260 $g->png("hbars.png");
260261
296297 $g->png("lines.png");
297298
298299
299 =head1 LinesPoints
300 =head2 LinesPoints
300301
301302 =for HTML <p>
302303 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/manual/linespoints.png" alt="xy chart with connected points">
313314 and L<y_label|Chart::Manual::Properties/y_label> and set L<xy_plot|Chart::Manual::Properties/xy_plot>
314315 off, which is not really needed, since it is on C<'false'> per default.
315316 This allows you to give the x-axis none numerical, custom tick labels,
316 which are by accident the numbers 1 .. 18, as the first data row shows.
317 which are by accident the numbers 1 .. 17, as the first data row shows.
317318 The purpose of this maneuver is to not have zero as the first column label.
318319
319320 Because the origin of coordinate system is usually in the left lower
332333
333334 my $g = Chart::LinesPoints->new( 600, 300 );
334335 $g->set(
335 'title' => 'Soccer Season 2002',
336 'legend_labels' => ['NY Soccer Club', 'Denver Tigers',
337 'Houston Spacecats', 'Washington Presidents'],
338 'y_label' => 'position in the table',
339 'x_label' => 'day of play',
340 'grid_lines' => 'true',
341 'f_y_tick' => sub { - $_[0] },
342 # 'xy_plot' => 'false',
343 'integer_ticks_only' => 'true',
336 title => 'Soccer Season 2002',
337 legend_labels => ['NY Soccer Club', 'Denver Tigers',
338 'Houston Spacecats', 'Washington Presidents'],
339 y_label => 'position in the table',
340 x_label => 'day of play',
341 grid_lines => 'true',
342 f_y_tick => sub { - $_[0] },
343 # xy_plot => 'true',
344 integer_ticks_only => 'true',
345 colors => {
346 grid_lines => 'gray70',
347 },
344348 );
345349 $g->png("linespoints.png", [
346350 [qw(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17)],
351355 ]);
352356
353357
354 =head1 Mountain
358 =head2 Mountain
355359
356360 =for HTML <p>
357361 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/manual/mountain.png" alt="mountain chart">
401405 $g->png( 'mountain.png', \@data );
402406
403407
404 =head1 Pareto
408 =head2 Pareto
405409
406410 =for HTML <p>
407411 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/manual/pareto.png" alt="pareto chart">
412416 only one), while the line represent the accumulation (sum of all values
413417 from the start on the left up to this value). For a better orientation
414418 the absolute values should be sorted. In case your data set is not already,
415 change the property <sort|Chart::Manual::Properties/sort> to C<'true'>.
419 change the property L<sort|Chart::Manual::Properties/sort> to C<'true'>.
416420 (Note that the days of the week are not in chronological order,
417421 but in the order of decreasing sale amounts.) The first given data set
418422 is like in most cases the domain (x-axis labels). So the color of the first
419423 data set containing numbers has the color of
420424 L<dataset0|Chart::Manual::Properties/colors-datasetx> and the accumulation
421425 gets the color of dataset1 (which are per default also red and green,
422 but in reverse order).
426 but in reverse order). We choose a Pantone Report designer red, which
427 sticks out but is not too shrill.
423428
424429 For better optics we set L<spaced_bars|Chart::Manual::Properties/spaced_bars>
425430 off, so that the bars touch each other and give a nice counterweight to
449454 colors => {
450455 title => 'darkblue',
451456 dataset0 => 'green',
452 dataset1 => 'red',
453 x_label => 'red',
457 dataset1 => 'aurorared',
458 x_label => 'aurorared',
454459 y_grid_lines => 'white',
455460 },
456461 );
457462 $g->png("pareto.png");
458463
459464
460 =head1 Pie
465 =head2 Pie
461466
462467 =for HTML <p>
463468 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/manual/pie.png" alt="pie chart">
465470
466471 The class Chart::Pie creates a pie or ring chart. The first added data
467472 set must contain the labels and the second set the values. Our example
468 displays a ring chart with a thickness of 35% (of the radius).
469 If the L<ring|Chart::Manual::Properties/ring> property is omitted,
470 the chart falls back to regular pie. Every ring slice is labeled with the
471 stated label, plus the percentage of its value, as defined with the property
473 displays a ring chart with a thickness of 35% (of the radius). If the
474 L<ring|Chart::Manual::Properties/ring> property is omitted, the chart form
475 falls back to regular pie. Every ring slice is labeled with the stated label,
476 plus the percentage of its value, as defined with the property
472477 L<label_values|Chart::Manual::Properties/label_values>. Connecting lines
473478 between label and slice are drawn because L<legend_lines|Chart::Manual::Properties/legend_lines>
474479 is set to C<'true'>. The actual legend is placed on the bottom, in order
479484 correlated with a color, here every slice has to have its own color.
480485 Thats why the first data point has the color of L<dataset0|Chart::Manual::Properties/colors-datasetx>
481486 the second of dataset1 and so forth. In most cases the default colors
482 are good enough unless you have special meanings in mind. Please also
487 are good enough, unless you have special meanings in mind. Please also
483488 note the multi line (row) title text.
484489
485490
495500 'legend_lines' => 'true',
496501 'ring' => 0.35,
497502 );
498
499503 $g->png("pie.png");
500504
501505
502 =head1 Points
506 =head2 Points
503507
504508 =for HTML <p>
505509 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/manual/points.png" alt="xy chart with points">
519523 decimals on the y-axis labels and keeps it clean. The method C<add_pt>
520524 appends to every data set another value, adding another column to the chart.
521525 L<png_border|Chart::Manual::Properties/png_border> does just adds frame
522 of 10 pixel width around the entire image.
526 of 10 pixel width around the entire image. They middle gray grid lines
527 are just easy for the eyes.
523528
524529 use Chart::Points;
525530
536541 precision => 0,
537542 grid_lines => 'true',
538543 png_border => 10,
544 colors => {
545 grid_lines => 'gray70',
546
547 },
539548 );
540549 $g->png("points.png");
541550
542551
543 =head1 Split
552 =head2 Split
544553
545554 =for HTML <p>
546555 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/manual/split.png" alt="multi chart">
596605 The class Chart::StackedBars is a variant of L</Bars> that stacks
597606 bars belonging to one x-value on top of each other, instead of putting
598607 them beside each other. Data sets 0..n are ordered from the bottom up.
599 They are in most cases more intuitive than L</Pie> charts.
608 They are in most cases more intuitive than L</Pie> charts, because its
609 easier to intuit linear than quadratic ratios. As in the Bars example we
610 activated horizontal grid lines, which were subtle colored. To surpress
611 decimals on the y-axis L<precision|Chart::Manual::Properties/precision> was turned down.
612 And as in most cases - the first data set is the domain, which will be
613 drawn as x-axis labels.
600614
601615 use Chart::StackedBars;
602616
609623 title => 'Stacked Bars',
610624 legend => 'left',
611625 precision => 0,
626 y_grid_lines => 'true',
612627 grey_background => 'false',
613 colors => {
614 x_grid_lines => 'gray70',
628 colors => {
629 grid_lines => 'gray80',
615630 misc => 'gray55',
616631 text => 'gray55',
617632 x_label => 'gray40',
5454 that create the final image, take as an optional, second argument data.
5555 This data may be delivered either as a reference to an array of arrays:
5656
57 my $data = [ [ 1, 4, 3 ... <data set 0> ], [ <data set 1> ], ... ];
57 my $data = [ [ 1, 4, 3 ... ], # data set 0
58 [ 5, 8, 2 ... ], # data set 1
59 ...
60 ];
5861 $graph->png( 'file.png', $data );
5962
6063 or in form of a file. Then the argument has to be a file name or a
3333
3434 The method C<set> allows to directly change particular chart properties.
3535 All of these explained in detail with their acceptable and default values
36 are sorted there by name or topic or type:
36 are sorted there by name and topic or type:
3737
3838 L<Chart::Manual::Properties>
3939
4242
4343 Much of what is documented here will be superseded by a new API provided
4444 by upcoming version 3.0. The old API will be discouraged but not deprecated,
45 except maybe the module Chart::Composite.
46
45 except maybe the module Chart::Composite and some properties.
46 The new API will aply only to objects created by Chart-E<gt>new(...);
4747
4848 =head1 COPYRIGHT & LICENSE
4949
2323
2424 package Chart::Mountain;
2525 our @ISA = qw(Chart::Base);
26 our $VERSION = 'v2.403.6';
26 our $VERSION = 'v2.403.7';
2727
2828 use Chart::Base;
2929 use GD;
11
22 package Chart::Pareto;
33 our @ISA = qw(Chart::Base);
4 our $VERSION = 'v2.403.6';
4 our $VERSION = 'v2.403.7';
55
66 use Chart::Base;
77 use GD;
44
55 package Chart::Pie;
66 our @ISA = qw(Chart::Base);
7 our $VERSION = 'v2.403.6';
7 our $VERSION = 'v2.403.7';
88
99 use Carp;
1010 use GD;
44
55 package Chart::Points;
66 our @ISA = qw(Chart::Base);
7 our $VERSION = 'v2.403.6';
7 our $VERSION = 'v2.403.7';
88
99 use Carp;
1010 use GD;
0
1 #
2
3 use v5.12;
4
5 package Chart::Property::DataType::Font;
6 our $VERSION = 'v2.403.7';
7
8 use Carp;
9
10 ## constructor #########################################################
11
12 sub new {
13 my $pkg = shift;
14 my $def = shift;
15 return unless ref $def eq 'HASH';
16 bless {};
17 }
18
19 ## getter ##############################################################
20
21 sub name {
22
23 }
24
25 sub bold {
26
27 }
28
29 sub size {
30
31 }
32
33 sub unicode {
34 }
35
36 sub truetype {
37
38 }
39
40
41 1;
42
43 __END__
44
45 =pod
46
47 =head1 NAME
48
49 Chart::Font - read only single font holding objects
50
51 =head1 SYNOPSIS
52
53 my $red = Chart::Color->new('red');
54 say $red->add('blue')->name; # magenta, mixed in RGB space
55 Chart::Color->new( 0, 0, 255)->hsl # 240, 100, 50 = blue
56 $blue->blend_with({H=> 0, S=> 0, L=> 80}, 0.1);# mix blue with a little grey
57 $red->gradient( '#0000FF', 10); # 10 colors from red to blue
58 $red->complementary( 3 ); # get fitting red green and blue
59
60 =head1 DESCRIPTION
61
62
63
64 =head1 COPYRIGHT & LICENSE
65
66 Copyright 2022 Herbert Breunung.
67
68 This program is free software; you can redistribute it and/or modify it
69 under same terms as Perl itself.
70
71 =head1 AUTHOR
72
73 Herbert Breunung, <lichtkind@cpan.org>
74
75 =cut
76
77
78 __END__
79 $im->string( GD::Font->Tiny , 20, 20, 'Tiny', 2);
80 $im->string( GD::Font->Small , 20, 50, 'Small', 1);
81 $im->string( GD::Font->MediumBold , 20, 80, 'MediumBold', 2);
82 $im->string( GD::Font->Large , 20, 110, 'Large', 1);
83 $im->string( GD::Font->Giant , 20, 140, 'Giant', 2);
84
85 gdTinyFont
86 gdSmallFont
87 gdMediumBoldFont
88 gdLargeFont
89 gdGiantFont
33 use v5.12;
44
55 package Chart::Property;
6 our $VERSION = 'v2.403.6';
6 our $VERSION = 'v2.403.7';
77
88 use Carp;
99
1717
1818 package Chart::Split;
1919 our @ISA = qw(Chart::Base);
20 our $VERSION = 'v2.403.6';
20 our $VERSION = 'v2.403.7';
2121
2222 use Chart::Base;
2323 use GD;
11
22 package Chart::StackedBars;
33 our @ISA = qw(Chart::Base);
4 our $VERSION = 'v2.403.6';
4 our $VERSION = 'v2.403.7';
55
66 use Chart::Base;
77 use GD;
00 use v5.12;
11
22 package Chart;
3 our $VERSION = 'v2.403.6';
3 our $VERSION = 'v2.403.7';
44
55 use Chart::Points;
66 use Chart::Lines;
6565
6666 =head1 DESCRIPTION
6767
68 Chart help you to create PNG and JPG images with visualizations of numeric data.
68 Chart helps you to create PNG and JPG images with visualizations of numeric data.
6969 This page gives you a summary how to use it.
7070 For a more thorough documentation and lots of example code please visit the L<Chart::Manual>.
7171
7272
7373 =for HTML <p>
74 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/manual/points.png" alt="point chart" width="300" height="225">
75 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/test/composite_f.png" alt="composite of bars and lines" width="300" height="225">
76 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/test/stackedbars.png" alt="stacked bars" width="300" height="200">
77 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/test/bars_2.png" alt="multi bar chart" width="300" height="250">
78 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/test/hbars_2.png" alt="horizontal bar chart" width="300" height="240">
79 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/test/direction_4.png" alt="polar chart" width="250" height="250">
80 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/test/pie_4.png" alt="pie chart" width="250" height="225">
81 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/test/mountain_2-1.png" alt="mountain chart" width="300" height="225">
82 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/test/split_2.png" alt="split chart" width="250" height="250">
83 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/test/error_1.png" alt="error bar chart" width="300" height="225">
74 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/landing/points.png" alt="point chart" width="300" height="225">
75 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/landing/composite.png" alt="composite of bars and lines" width="300" height="225">
76 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/landing/sbars.png" alt="stacked bars" width="300" height="200">
77 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/landing/bars.png" alt="multi bar chart" width="300" height="250">
78 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/landing/hbars.png" alt="horizontal bar chart" width="300" height="240">
79 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/landing/polar.png" alt="polar chart" width="250" height="250">
80 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/landing/ring.png" alt="pie chart" width="250" height="225">
81 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/landing/mountain.png" alt="mountain chart" width="300" height="225">
82 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/landing/split.png" alt="split chart" width="250" height="250">
83 <img src="https://raw.githubusercontent.com/lichtkind/Chart/main/dev/example/landing/error.png" alt="error bar chart" width="300" height="225">
8484 </p>
8585
8686 =head2 use-ing Chart
9696 use Chart::Lines;
9797
9898 would invoke the lines module.
99 Alternatively write to load all chart types at ones with
99 Alternatively load all chart types at ones and write:
100100
101101 use Chart;
102102
174174
175175 =back
176176
177 =head2 Graph.pm-style API
177 =head2 column based API
178178
179179 You might ask, "But what if I just want to add a few points to the graph,
180180 and then display it, without all those references to references?". Well,