Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Begin Dist::Zilla transition.

  • Loading branch information...
commit 92d2c9da75d8141b29090a81736d6efe448a7f28 1 parent 1d11257
@gphat authored
View
3  Changes
@@ -1,5 +1,8 @@
Revision history for Perl extension Chart::Clicker.
+2.70
+ - Add more examples in the Tutorial (mpeters)
+
2.69
- Add note about CentOS.
View
378 LICENSE
@@ -1,378 +0,0 @@
-
-Terms of Perl itself
-
-a) the GNU General Public License as published by the Free
- Software Foundation; either version 1, or (at your option) any
- later version, or
-b) the "Artistic License"
-
-----------------------------------------------------------------------------
-
-The General Public License (GPL)
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
-Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
-verbatim copies of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your freedom to share
-and change it. By contrast, the GNU General Public License is intended to
-guarantee your freedom to share and change free software--to make sure the
-software is free for all its users. This General Public License applies to most of
-the Free Software Foundation's software and to any other program whose
-authors commit to using it. (Some other Free Software Foundation software is
-covered by the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not price. Our
-General Public Licenses are designed to make sure that you have the freedom
-to distribute copies of free software (and charge for this service if you wish), that
-you receive source code or can get it if you want it, that you can change the
-software or use pieces of it in new free programs; and that you know you can do
-these things.
-
-To protect your rights, we need to make restrictions that forbid anyone to deny
-you these rights or to ask you to surrender the rights. These restrictions
-translate to certain responsibilities for you if you distribute copies of the
-software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether gratis or for a
-fee, you must give the recipients all the rights that you have. You must make
-sure that they, too, receive or can get the source code. And you must show
-them these terms so they know their rights.
-
-We protect your rights with two steps: (1) copyright the software, and (2) offer
-you this license which gives you legal permission to copy, distribute and/or
-modify the software.
-
-Also, for each author's protection and ours, we want to make certain that
-everyone understands that there is no warranty for this free software. If the
-software is modified by someone else and passed on, we want its recipients to
-know that what they have is not the original, so that any problems introduced by
-others will not reflect on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software patents. We wish
-to avoid the danger that redistributors of a free program will individually obtain
-patent licenses, in effect making the program proprietary. To prevent this, we
-have made it clear that any patent must be licensed for everyone's free use or
-not licensed at all.
-
-The precise terms and conditions for copying, distribution and modification
-follow.
-
-GNU GENERAL PUBLIC LICENSE
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
-MODIFICATION
-
-0. This License applies to any program or other work which contains a notice
-placed by the copyright holder saying it may be distributed under the terms of
-this General Public License. The "Program", below, refers to any such program
-or work, and a "work based on the Program" means either the Program or any
-derivative work under copyright law: that is to say, a work containing the
-Program or a portion of it, either verbatim or with modifications and/or translated
-into another language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not covered by
-this License; they are outside its scope. The act of running the Program is not
-restricted, and the output from the Program is covered only if its contents
-constitute a work based on the Program (independent of having been made by
-running the Program). Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's source code as
-you receive it, in any medium, provided that you conspicuously and appropriately
-publish on each copy an appropriate copyright notice and disclaimer of warranty;
-keep intact all the notices that refer to this License and to the absence of any
-warranty; and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and you may at
-your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion of it, thus
-forming a work based on the Program, and copy and distribute such
-modifications or work under the terms of Section 1 above, provided that you also
-meet all of these conditions:
-
-a) You must cause the modified files to carry prominent notices stating that you
-changed the files and the date of any change.
-
-b) You must cause any work that you distribute or publish, that in whole or in
-part contains or is derived from the Program or any part thereof, to be licensed
-as a whole at no charge to all third parties under the terms of this License.
-
-c) If the modified program normally reads commands interactively when run, you
-must cause it, when started running for such interactive use in the most ordinary
-way, to print or display an announcement including an appropriate copyright
-notice and a notice that there is no warranty (or else, saying that you provide a
-warranty) and that users may redistribute the program under these conditions,
-and telling the user how to view a copy of this License. (Exception: if the
-Program itself is interactive but does not normally print such an announcement,
-your work based on the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If identifiable
-sections of that work are not derived from the Program, and can be reasonably
-considered independent and separate works in themselves, then this License,
-and its terms, do not apply to those sections when you distribute them as
-separate works. But when you distribute the same sections as part of a whole
-which is a work based on the Program, the distribution of the whole must be on
-the terms of this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your rights to
-work written entirely by you; rather, the intent is to exercise the right to control
-the distribution of derivative or collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program with the
-Program (or with a work based on the Program) on a volume of a storage or
-distribution medium does not bring the other work under the scope of this
-License.
-
-3. You may copy and distribute the Program (or a work based on it, under
-Section 2) in object code or executable form under the terms of Sections 1 and 2
-above provided that you also do one of the following:
-
-a) Accompany it with the complete corresponding machine-readable source
-code, which must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange; or,
-
-b) Accompany it with a written offer, valid for at least three years, to give any
-third party, for a charge no more than your cost of physically performing source
-distribution, a complete machine-readable copy of the corresponding source
-code, to be distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-c) Accompany it with the information you received as to the offer to distribute
-corresponding source code. (This alternative is allowed only for noncommercial
-distribution and only if you received the program in object code or executable
-form with such an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for making
-modifications to it. For an executable work, complete source code means all the
-source code for all modules it contains, plus any associated interface definition
-files, plus the scripts used to control compilation and installation of the
-executable. However, as a special exception, the source code distributed need
-not include anything that is normally distributed (in either source or binary form)
-with the major components (compiler, kernel, and so on) of the operating system
-on which the executable runs, unless that component itself accompanies the
-executable.
-
-If distribution of executable or object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the source
-code from the same place counts as distribution of the source code, even though
-third parties are not compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program except as
-expressly provided under this License. Any attempt otherwise to copy, modify,
-sublicense or distribute the Program is void, and will automatically terminate
-your rights under this License. However, parties who have received copies, or
-rights, from you under this License will not have their licenses terminated so long
-as such parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not signed it.
-However, nothing else grants you permission to modify or distribute the Program
-or its derivative works. These actions are prohibited by law if you do not accept
-this License. Therefore, by modifying or distributing the Program (or any work
-based on the Program), you indicate your acceptance of this License to do so,
-and all its terms and conditions for copying, distributing or modifying the
-Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the Program),
-the recipient automatically receives a license from the original licensor to copy,
-distribute or modify the Program subject to these terms and conditions. You
-may not impose any further restrictions on the recipients' exercise of the rights
-granted herein. You are not responsible for enforcing compliance by third parties
-to this License.
-
-7. If, as a consequence of a court judgment or allegation of patent infringement
-or for any other reason (not limited to patent issues), conditions are imposed on
-you (whether by court order, agreement or otherwise) that contradict the
-conditions of this License, they do not excuse you from the conditions of this
-License. If you cannot distribute so as to satisfy simultaneously your obligations
-under this License and any other pertinent obligations, then as a consequence
-you may not distribute the Program at all. For example, if a patent license would
-not permit royalty-free redistribution of the Program by all those who receive
-copies directly or indirectly through you, then the only way you could satisfy
-both it and this License would be to refrain entirely from distribution of the
-Program.
-
-If any portion of this section is held invalid or unenforceable under any particular
-circumstance, the balance of the section is intended to apply and the section as
-a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents or other
-property right claims or to contest validity of any such claims; this section has
-the sole purpose of protecting the integrity of the free software distribution
-system, which is implemented by public license practices. Many people have
-made generous contributions to the wide range of software distributed through
-that system in reliance on consistent application of that system; it is up to the
-author/donor to decide if he or she is willing to distribute software through any
-other system and a licensee cannot impose that choice.
-
-This section is intended to make thoroughly clear what is believed to be a
-consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in certain countries
-either by patents or by copyrighted interfaces, the original copyright holder who
-places the Program under this License may add an explicit geographical
-distribution limitation excluding those countries, so that distribution is permitted
-only in or among countries not thus excluded. In such case, this License
-incorporates the limitation as if written in the body of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions of the
-General Public License from time to time. Such new versions will be similar in
-spirit to the present version, but may differ in detail to address new problems or
-concerns.
-
-Each version is given a distinguishing version number. If the Program specifies a
-version number of this License which applies to it and "any later version", you
-have the option of following the terms and conditions either of that version or of
-any later version published by the Free Software Foundation. If the Program does
-not specify a version number of this License, you may choose any version ever
-published by the Free Software Foundation.
-
-10. If you wish to incorporate parts of the Program into other free programs
-whose distribution conditions are different, write to the author to ask for
-permission. For software which is copyrighted by the Free Software Foundation,
-write to the Free Software Foundation; we sometimes make exceptions for this.
-Our decision will be guided by the two goals of preserving the free status of all
-derivatives of our free software and of promoting the sharing and reuse of
-software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS
-NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
-COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
-"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
-IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
-ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
-YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
-CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
-TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY
-WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS
-PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
-ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
-(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
-OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS
-BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-
-----------------------------------------------------------------------------
-
-The Artistic License
-
-Preamble
-
-The intent of this document is to state the conditions under which a Package
-may be copied, such that the Copyright Holder maintains some semblance of
-artistic control over the development of the package, while giving the users of the
-package the right to use and distribute the Package in a more-or-less customary
-fashion, plus the right to make reasonable modifications.
-
-Definitions:
-
-- "Package" refers to the collection of files distributed by the Copyright
- Holder, and derivatives of that collection of files created through textual
- modification.
-- "Standard Version" refers to such a Package if it has not been modified,
- or has been modified in accordance with the wishes of the Copyright
- Holder.
-- "Copyright Holder" is whoever is named in the copyright or copyrights for
- the package.
-- "You" is you, if you're thinking about copying or distributing this Package.
-- "Reasonable copying fee" is whatever you can justify on the basis of
- media cost, duplication charges, time of people involved, and so on. (You
- will not be required to justify it to the Copyright Holder, but only to the
- computing community at large as a market that must bear the fee.)
-- "Freely Available" means that no fee is charged for the item itself, though
- there may be fees involved in handling the item. It also means that
- recipients of the item may redistribute it under the same conditions they
- received it.
-
-1. You may make and give away verbatim copies of the source form of the
-Standard Version of this Package without restriction, provided that you duplicate
-all of the original copyright notices and associated disclaimers.
-
-2. You may apply bug fixes, portability fixes and other modifications derived from
-the Public Domain or from the Copyright Holder. A Package modified in such a
-way shall still be considered the Standard Version.
-
-3. You may otherwise modify your copy of this Package in any way, provided
-that you insert a prominent notice in each changed file stating how and when
-you changed that file, and provided that you do at least ONE of the following:
-
- a) place your modifications in the Public Domain or otherwise
- make them Freely Available, such as by posting said modifications
- to Usenet or an equivalent medium, or placing the modifications on
- a major archive site such as ftp.uu.net, or by allowing the
- Copyright Holder to include your modifications in the Standard
- Version of the Package.
-
- b) use the modified Package only within your corporation or
- organization.
-
- c) rename any non-standard executables so the names do not
- conflict with standard executables, which must also be provided,
- and provide a separate manual page for each non-standard
- executable that clearly documents how it differs from the Standard
- Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-4. You may distribute the programs of this Package in object code or executable
-form, provided that you do at least ONE of the following:
-
- a) distribute a Standard Version of the executables and library
- files, together with instructions (in the manual page or equivalent)
- on where to get the Standard Version.
-
- b) accompany the distribution with the machine-readable source of
- the Package with your modifications.
-
- c) accompany any non-standard executables with their
- corresponding Standard Version executables, giving the
- non-standard executables non-standard names, and clearly
- documenting the differences in manual pages (or equivalent),
- together with instructions on where to get the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-5. You may charge a reasonable copying fee for any distribution of this Package.
-You may charge any fee you choose for support of this Package. You may not
-charge a fee for this Package itself. However, you may distribute this Package in
-aggregate with other (possibly commercial) programs as part of a larger
-(possibly commercial) software distribution provided that you do not advertise
-this Package as a product of your own.
-
-6. The scripts and library files supplied as input to or produced as output from
-the programs of this Package do not automatically fall under the copyright of this
-Package, but belong to whomever generated them, and may be sold
-commercially, and may be aggregated with this Package.
-
-7. C or perl subroutines supplied by you and linked into this Package shall not
-be considered part of this Package.
-
-8. The name of the Copyright Holder may not be used to endorse or promote
-products derived from this software without specific prior written permission.
-
-9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The End
-
-
View
106 MANIFEST
@@ -1,106 +0,0 @@
-Changes
-example/area.pl
-example/bar.pl
-example/bubble.pl
-example/candlestick.pl
-example/date-axis.pl
-example/heatmap.pl
-example/line-and-shape.pl
-example/line.pl
-example/multiple-axes.pl
-example/multiple-renderers.pl
-example/overaxis-bar.pl
-example/pie.pl
-example/point.pl
-example/share-axes.pl
-example/simple.pl
-example/skip_range.pl
-example/sparkline.pl
-example/stackedarea.pl
-example/stackedbar.pl
-example/tabularlegend.pl
-example/tufte-whitegrid.pl
-example/very-simple.pl
-inc/Module/Install.pm
-inc/Module/Install/Base.pm
-inc/Module/Install/Can.pm
-inc/Module/Install/Fetch.pm
-inc/Module/Install/Makefile.pm
-inc/Module/Install/Metadata.pm
-inc/Module/Install/Win32.pm
-inc/Module/Install/WriteAll.pm
-lib/Chart/Clicker.pm
-lib/Chart/Clicker/Axis.pm
-lib/Chart/Clicker/Axis/DateTime.pm
-lib/Chart/Clicker/Component.pm
-lib/Chart/Clicker/Container.pm
-lib/Chart/Clicker/Context.pm
-lib/Chart/Clicker/Data/DataSet.pm
-lib/Chart/Clicker/Data/Marker.pm
-lib/Chart/Clicker/Data/Range.pm
-lib/Chart/Clicker/Data/Series.pm
-lib/Chart/Clicker/Data/Series/HighLow.pm
-lib/Chart/Clicker/Data/Series/Size.pm
-lib/Chart/Clicker/Decoration.pm
-lib/Chart/Clicker/Decoration/Glass.pm
-lib/Chart/Clicker/Decoration/Grid.pm
-lib/Chart/Clicker/Decoration/Legend.pm
-lib/Chart/Clicker/Decoration/Legend/Tabular.pm
-lib/Chart/Clicker/Decoration/MarkerOverlay.pm
-lib/Chart/Clicker/Decoration/OverAxis.pm
-lib/Chart/Clicker/Decoration/Plot.pm
-lib/Chart/Clicker/Drawing/ColorAllocator.pm
-lib/Chart/Clicker/Positioned.pm
-lib/Chart/Clicker/Renderer.pm
-lib/Chart/Clicker/Renderer/Area.pm
-lib/Chart/Clicker/Renderer/Bar.pm
-lib/Chart/Clicker/Renderer/Bubble.pm
-lib/Chart/Clicker/Renderer/CandleStick.pm
-lib/Chart/Clicker/Renderer/HeatMap.pm
-lib/Chart/Clicker/Renderer/Line.pm
-lib/Chart/Clicker/Renderer/Pie.pm
-lib/Chart/Clicker/Renderer/Point.pm
-lib/Chart/Clicker/Renderer/PolarArea.pm
-lib/Chart/Clicker/Renderer/StackedArea.pm
-lib/Chart/Clicker/Renderer/StackedBar.pm
-lib/Chart/Clicker/Tutorial.pod
-LICENSE
-Makefile.PL
-MANIFEST This list of files
-META.yml
-README
-t/00-basic.t
-t/00-drawing-colorallocator.t
-t/01-data-dataset.t
-t/01-data-marker.t
-t/01-data-range.t
-t/03-axis-datetime.t
-t/03-axis.t
-t/03-renderer-base.t
-t/04-renderer-area.t
-t/04-renderer-bar.t
-t/04-renderer-bubble.t
-t/04-renderer-candlestick.t
-t/04-renderer-line.t
-t/04-renderer-pie.t
-t/04-renderer-point.t
-t/05-decoration-color_allocator.t
-t/05-decoration-glass.t
-t/05-decoration-grid.t
-t/05-decoration-legend.t
-t/05-decoration-markeroverlay.t
-t/05-decoration-plot.t
-t/05-decoration.t
-t/06-data-marker.t
-t/10-context.t
-t/75-example.t
-t/76-simple-ctx.t
-t/77-same-axes-ctx.t
-t/78-invisible.t
-t/79-datetime.t
-t/99-add-data.t
-t/series/highlow.t
-t/series/series.t
-t/series/size.t
-t/xt/pod-coverage.t
-t/xt/pod.t
View
48 MANIFEST.SKIP
@@ -1,48 +0,0 @@
-# Avoid version control files.
-\bRCS\b
-\bCVS\b
-,v$
-\B\.svn\b
-
-# Avoid Makemaker generated and utility files.
-\bMakefile$
-\bblib
-\bMakeMaker-\d
-\bpm_to_blib$
-\bblibdirs$
-^MANIFEST\.SKIP$
-
-# for developers only :)
-^TODO$
-^VERSIONING\.SKETCH$
-
-# Avoid Module::Build generated and utility files.
-\bBuild$
-\b_build
-
-# Avoid temp and backup files.
-~$
-\.tmp$
-\.old$
-\.bak$
-\..*?\.sw[po]$
-\#$
-\b\.#
-
-# avoid OS X finder files
-\.DS_Store$
-
-# Don't ship the test db
-^t/var
-
-# Don't ship the last dist we built :)
-\.tar\.gz$
-
-# Skip maint stuff
-^maint/
-
-# Avoid copies to .orig
-\.orig$
-
-# Dont use Module::Build anymore
-^Build.PL$
View
27 Makefile.PL
@@ -1,27 +0,0 @@
-use inc::Module::Install 0.75;
-
-name 'Chart-Clicker';
-all_from 'lib/Chart/Clicker.pm';
-
-test_requires 'Test::Exception';
-
-requires 'Color::Scheme' => '1.02';
-requires 'Moose' => '0.76';
-requires 'DateTime' => '0.47';
-requires 'DateTime::Set' => '0.27';
-requires 'IO::File';
-requires 'Math::Complex' => '1.56';
-requires 'Scalar::Util' => '1.19';
-requires 'List::Util' => '0';
-requires 'Geometry::Primitive' => '0.22';
-requires 'Graphics::Color' => '0.27';
-requires 'Graphics::Primitive' => '0.49';
-requires 'Graphics::Primitive::Driver::Cairo' => '0.42';
-requires 'Layout::Manager' => '0.31';
-requires 'Math::Gradient' => '0.04';
-
-recommends 'Statistics::Basic' => 0;
-
-repository 'http://github.com/gphat/chart-clicker';
-
-WriteAll;
View
295 README
@@ -1,295 +0,0 @@
-NAME
- Chart::Clicker - Powerful, extensible charting.
-
-SYNOPSIS
- use Chart::Clicker;
-
- my $cc = Chart::Clicker->new;
-
- my @values = (42, 25, 86, 23, 2, 19, 103, 12, 54, 9);
- $cc->add_data('Sales', \@values);
-
- # alternately, you can add data one bit at a time...
- foreach my $v (@values) {
- $cc->add_data('Sales', $v);
- }
-
- # Or, if you want to specify the keys you can use a hashref
- my $data = { 12 => 123, 13 => 341, 14 => 1241 };
- $cc->add_data('Sales', $data);
-
- $cc->write_output('foo.png');
-
-DESCRIPTION
- Chart::Clicker aims to be a powerful, extensible charting package that
- creates really pretty output. Charts can be saved in png, svg, pdf and
- postscript format.
-
- Clicker leverages the power of Graphics::Primitive to create snazzy
- graphics without being tied to specific backend. You may want to begin
- with Chart::Clicker::Tutorial.
-
- For code examples see the examples repository on GitHub:
- <http://github.com/gphat/chart-clicker-examples/>
-
-FEATURES
- Renderers
- Clicker supports the following renderers:
-
- Line
- StackedLine
- Bar
- StackedBar
- Area
- StackedArea
- Bubble
- CandleStick
- Point
- Pie
- PolarArea
-
-ADDING DATA
- The synopsis shows the simple way to add data.
-
- my @values = (42, 25, 86, 23, 2, 19, 103, 12, 54, 9);
- foreach my $v (@values) {
- $cc->add_data('Sales', $v);
- }
-
- This is a convenience method provided to make simple cases much simpler.
- Adding multiple Series to a chart is as easy as changing the name
- argument of "add_data". Each unique first argument will result in a
- separate series. See the docs for "add_data" to learn more.
-
- If you'd like to use the more advanced features of Clicker you'll need
- to shake off this simple method and build Series & DataSets explicitly.
-
- use Chart::Clicker::Data::Series;
- use Chart::Clicker::Data::DataSet;
-
- ...
-
- my $series = Chart::Clicker::Data::Series->new(
- keys => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
- values => [ 42, 25, 86, 23, 2, 19, 103, 12, 54, 9 ],
- );
-
- my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series ]);
-
- $cc->add_to_datasets($ds);
-
- This used to be the only way to add data, but repeated requests to make
- the common case easier resulted in the inclusion of "add_data".
-
-COOKBOOK
- Check the cookbook at <http://www.onemogin.com/clicker/cookbook>
-
-CONTEXTS
- The normal use case for a chart is a couple of datasets on the same
- axes. Sometimes you want to chart one or more datasets on different
- axes. A common need for this is when you are comparing two datasets of
- vastly different scale such as the number of employees in an office
- (1-10) to monthly revenues (10s of thousands). On a normal chart the
- number of employees would show up as a flat line at the bottom of the
- chart.
-
- To correct this, Clicker has contexts. A context is a pair of axes, a
- renderer and a name. The name is the 'key' by which you will refer to
- the context.
-
- my $context = Chart::Clicker::Context->new( name => 'sales' );
- $clicker->add_to_contexts($context);
-
- $dataset->context('sales');
-
- $clicker->add_to_datasets($dataset);
-
- New contexts provide a fresh domain and range axis and default to a Line
- renderer.
-
- Caveat: Clicker expects that the default context (identified by the
- string "default") will always be present. It is from this context that
- some of Clicker's internals draw their values. You should use the
- default context unless you need more than one, in which case you should
- use "default" as the base context.
-
-FORMATS & OUTPUT
- Clicker supports PNG, SVG, PDF and PostScript output. To change your
- output type, specificy it when you create your Clicker object:
-
- my $cc = Chart::Clicker->new(format => 'pdf', ...);
- # ...
- $cc->write_output('chart.pdf');
-
- If you are looking to get a scalar of the output for use with HTTP or
- similar things, you can use:
-
- # ... make your chart
- $cc->draw;
- my $image_data = $cc->data;
-
- If you happen to be using Catalyst then take a look at
- Catalyst::View::Graphics::Primitive.
-
-ATTRIBUTES
- contexts
- Set/Get the contexts for this chart.
-
- datasets
- Get/Set the datasets for this chart.
-
- format
- Get the format for this Chart. Required in the constructor. Must be on
- of Png, Pdf, Ps or Svg.
-
- legend
- Set/Get the legend that will be used with this chart.
-
- legend_position
- The position the legend will be added. Should be one of north, south,
- east, west or center as required by Layout::Manager::Compass.
-
- grid_over
- Flag controlling if the grid is rendered over the data. Defaults to 0.
- You probably want to set the grid's background color to an alpha of 0 if
- you enable this flag.
-
- title
- Set/Get the title component for this chart. This is a
- Graphics::Primitive::TextBox, not a string. To set the title of a chart
- you should access the TextBox's "text" method.
-
- $cc->title->text('A Title!');
- $cc->title->font->size(20);
- # etc, etc
-
- If the title has text then it is added to the chart in the position
- specified by "title_position".
-
- You should consult the documentation for Graphics::Primitive::TextBox
- for things like padding and text rotation. If you are adding it to the
- top and want some padding between it and the plot, you can:
-
- $cc->title->padding->bottom(5);
-
- title_position
- The position the title will be added. Should be one of north, south,
- east, west or center as required by Layout::Manager::Compass.
-
- Note that if no angle is set for the title then it will be changed to
- -1.5707 if the title position is east or west.
-
-METHODS
- new
- Creates a new Chart::Clicker object. If no format, width and height are
- specified then defaults of Png, 500 and 300 are chosen, respectively.
-
- add_data ($name, $data)
- Convenience method for adding data to the chart. Can be called one of
- three ways.
-
- scalar
- Passing a name and a scalar will "add" the scalar data to that
- series' data.
-
- $cc->add_data('Sales', 1234);
- $cc->add_data('Sales', 1235);
-
- This will result in a Series names 'Sales' with two values.
-
- arrayref
- Passing a name and an arrayref works much the same as the scalar
- method discussed above, but appends the supplied arrayref to the
- existing one. It may be mixed with the scalar method.
-
- $cc->add_data('Sales', \@some_sales);
- $cc->add_data('Sales', \@some_more_sales);
- # This works still!
- $cc->add_data('Sales', 1234);
-
- hashref
- This allows you to pass both keys and add in all at once, but it's
- an all-or-nothing thing. Subsequent calls with the same name will
- overwrite previous calls.
-
- $cc->add_data('Sales', { 2009 => 1234, 2010 => 1235 });
- # Overwrites last call!
- $cc->add_data('Sales', { 2011 => 1234, 2012 => 1235 });
-
- add_to_contexts
- Add the specified context to the chart.
-
- add_to_datasets
- Add the specified dataset (or arrayref of datasets) to the chart.
-
- add_to_markers
- Add the specified marker to the chart.
-
- color_allocator
- Set/Get the color_allocator for this chart.
-
- data
- Returns the data for this chart as a scalar. Suitable for 'streaming' to
- a client.
-
- draw
- Draw this chart.
-
- get_datasets_for_context
- Returns an arrayref containing all datasets for the given context. Used
- by renderers to get a list of datasets to chart.
-
- inside_width
- Get the width available in this container after taking away space for
- insets and borders.
-
- inside_height
- Get the height available in this container after taking away space for
- insets and borders.
-
- marker_overlay
- Set/Get the marker overlay object that will be used if this chart has
- markers. This is lazily constructed to save time.
-
- set_renderer ($renderer_object, [ $context ]);
- Sets the renderer on the specified context. If no context is provided
- then 'default' is assumed.
-
- write
- This method is passed through to the underlying driver. It is only
- necessary that you call this if you manually called "draw" beforehand.
- You likely want to use "write_output".
-
- write_output ($path)
- Write the chart output to the specified location. Output is written in
- the format provided to the constructor (which defaults to Png).
- Internally calls "draw" for you. If you use this method, do not call
- "draw" first!
-
- $c->write_output('/path/to/the.png');
-
-AUTHOR
- Cory G Watson <gphat@cpan.org>
-
-CONTRIBUTORS
- Many thanks to the individuals who have contributed various bits:
-
- Ash Berlin
-
- Brian Cassidy
-
- Guillermo Roditi
-
- Torsten Schoenfeld
-
- Yuval Kogman
-
-SOURCE
- Chart::Clicker is on github:
-
- http://github.com/gphat/chart-clicker/tree/master
-
-LICENSE
- You can redistribute and/or modify this code under the same terms as
- Perl itself.
-
View
6 dist.ini
@@ -0,0 +1,6 @@
+name = Chart-Clicker
+author = Cory G Watson <gphat@cpan.org>
+license = Perl_5
+copyright_holder= Cold Hard Code, LLC
+
+[@GPHAT]
View
1,320 lib/Chart/Clicker.pm
@@ -3,470 +3,28 @@ use Moose;
extends 'Chart::Clicker::Container';
-use Layout::Manager::Compass;
-
-use Graphics::Color::RGB;
-
-use Graphics::Primitive::Insets;
-use Graphics::Primitive::Border;
-
-use Graphics::Primitive::Driver::Cairo;
-
-use Chart::Clicker::Context;
-
-use Chart::Clicker::Data::DataSet;
-use Chart::Clicker::Data::Series;
-use Chart::Clicker::Decoration::Legend;
-use Chart::Clicker::Decoration::MarkerOverlay;
-use Chart::Clicker::Decoration::Plot;
-use Chart::Clicker::Drawing::ColorAllocator;
-
-use Carp qw(croak);
-use Scalar::Util qw(refaddr);
-
-our $VERSION = '2.69';
-
-has '+background_color' => (
- default => sub {
- Graphics::Color::RGB->new({ red => 1, green => 1, blue => 1, alpha => 1 })
- }
-);
-has '+border' => (
- default => sub {
- my $b = Graphics::Primitive::Border->new;
- $b->color(Graphics::Color::RGB->new(red => 0, green => 0, blue => 0));
- $b->width(1);
- return $b;
- }
-);
-has 'color_allocator' => (
- is => 'rw',
- isa => 'Chart::Clicker::Drawing::ColorAllocator',
- default => sub { Chart::Clicker::Drawing::ColorAllocator->new }
-);
-has 'contexts' => (
- traits => [ 'Hash' ],
- is => 'rw',
- isa => 'HashRef[Chart::Clicker::Context]',
- default => sub { { default => Chart::Clicker::Context->new(name => 'default') } },
- handles => {
- 'set_context' => 'set',
- 'get_context' => 'get',
- 'context_names' => 'keys',
- 'context_count' => 'count',
- 'delete_context' => 'delete'
- }
-);
-has '_data' => (
- traits => [ 'Hash' ],
- is => 'rw',
- isa => 'HashRef[Str]',
- default => sub { {} }
-);
-has 'datasets' => (
- traits => [ 'Array' ],
- is => 'rw',
- isa => 'ArrayRef',
- default => sub { [] },
- handles => {
- 'dataset_count' => 'count',
- 'add_to_datasets' => 'push',
- 'get_dataset' => 'get'
- }
-);
-has 'driver' => (
- is => 'rw',
- does => 'Graphics::Primitive::Driver',
- default => sub {
- my ($self) = @_;
- Graphics::Primitive::Driver::Cairo->new(
- format => $self->format,
- )
- },
- handles => {
- 'rendered_data' => 'data',
- write => 'write'
- },
- lazy => 1
-);
-has 'format' => (
- is => 'rw',
- isa => 'Str',
- default => sub { 'PNG' }
-);
-has 'grid_over' => (
- is => 'rw',
- isa => 'Bool',
- default => sub { 0 }
-);
-has '+height' => (
- default => 300
-);
-has '+layout_manager' => (
- default => sub { Layout::Manager::Compass->new }
-);
-has 'legend' => (
- is => 'rw',
- isa => 'Chart::Clicker::Decoration::Legend',
- default => sub {
- Chart::Clicker::Decoration::Legend->new(
- name => 'legend',
- );
- }
-);
-has 'legend_position' => (
- is => 'rw',
- isa => 'Str',
- default => sub { 's' }
-);
-has 'marker_overlay' => (
- is => 'rw',
- isa => 'Chart::Clicker::Decoration::MarkerOverlay',
- lazy => 1,
- default => sub {
- Chart::Clicker::Decoration::MarkerOverlay->new
- }
-);
-has 'over_decorations' => (
- traits => [ 'Array' ],
- is => 'rw',
- isa => 'ArrayRef',
- default => sub { [] },
- handles => {
- 'over_decoration_count' => 'count',
- 'add_to_over_decorations' => 'push',
- 'get_over_decoration' => 'get'
- }
-);
-has '+padding' => (
- default => sub {
- Graphics::Primitive::Insets->new(
- top => 3, bottom => 3, right => 3, left => 3
- )
- }
-);
-has 'plot' => (
- is => 'rw',
- isa => 'Chart::Clicker::Decoration::Plot',
- default => sub {
- Chart::Clicker::Decoration::Plot->new
- }
-);
-has 'subgraphs' => (
- is => 'rw',
- isa => 'ArrayRef',
- default => sub { [] },
- predicate => 'has_subgraphs'
-);
-has 'title' => (
- is => 'rw',
- isa => 'Graphics::Primitive::TextBox',
- default => sub {
- Graphics::Primitive::TextBox->new(
- color => Graphics::Color::RGB->new( red => 0, green => 0, blue => 0),
- horizontal_alignment => 'center'
- )
- }
-);
-has 'title_position' => (
- is => 'rw',
- isa => 'Str',
- default => sub { 'n' }
-);
-has '+width' => (
- default => 500
-);
-
-sub add_to_contexts {
- my ($self, $ctx) = @_;
-
- if(defined($self->get_context($ctx->name))) {
- croak("Context named '".$ctx->name."' already exists.");
- }
- $self->set_context($ctx->name, $ctx);
-}
-
-sub add_subgraph {
- my ($self, $graph) = @_;
-
- if (not ref $graph or not $graph->isa('Chart::Clicker')) {
- die('Sub-Graphs must be Chart::Clicker objects');
- }
- push(@{$self->subgraphs}, $graph);
-}
-
-sub data {
- my ($self) = @_;
- print STDERR "WARNING: Calling 'data' to get image data is deprecated, please use rendered_data\n";
- $self->rendered_data;
-}
-
-sub draw {
- my ($self) = @_;
- my $driver = $self->driver;
- $driver->prepare($self);
-
- $self->layout_manager->do_layout($self);
- $driver->finalize($self);
- $driver->draw($self);
-}
-
-sub get_datasets_for_context {
- my ($self, $name) = @_;
-
- my @dses;
- foreach my $ds (@{ $self->datasets }) {
- if($ds->context eq $name) {
- push(@dses, $ds);
- }
- }
-
- return \@dses;
-}
-
-sub add_data {
- my ($self, $name, $data) = @_;
-
- if(ref($data) eq 'ARRAY') {
- $self->_data->{$name} = [] unless defined($self->_data->{$name});
- push(@{ $self->_data->{$name}}, @{ $data });
- } elsif(ref($data) eq 'HASH') {
- $self->_data->{$name} = $data;
- } else {
- $self->_data->{$name} = [] unless defined($self->_data->{$name});
- push(@{ $self->_data->{$name}}, $data);
- }
-}
-
-override('prepare', sub {
- my ($self, $driver) = @_;
-
- return if $self->prepared;
-
- if(scalar(keys(%{ $self->_data }))) {
-
- my $ds = Chart::Clicker::Data::DataSet->new;
- foreach my $name (keys(%{ $self->_data })) {
-
- my $vals = $self->_data->{$name};
-
- if(ref($vals) eq 'ARRAY') {
- # This allows the user to add data as an array
-
- $ds->add_to_series(
- Chart::Clicker::Data::Series->new(
- name => $name,
- keys => [ 0..scalar(@{ $vals }) - 1 ],
- values => $vals
- )
- );
- } elsif(ref($vals) eq 'HASH') {
- # This allows the user to add data as a hashref
- my @keys = sort { $a <=> $b } keys %{ $vals };
-
- my @values = ();
- foreach my $k (@keys) {
- push(@values, $vals->{$k})
- }
-
- $ds->add_to_series(
- Chart::Clicker::Data::Series->new(
- name => $name,
- keys => \@keys,
- values => \@values
- )
- );
- }
- }
- $self->add_to_datasets($ds);
- }
-
- unless(scalar(@{ $self->components })) {
- $self->add_component($self->plot, 'c');
-
- my $lp = lc($self->legend_position);
- if($self->legend->visible) {
- if(($lp =~ /^e/) || ($lp =~ /^w/)) {
- $self->legend->orientation('vertical');
- }
- $self->add_component($self->legend, $self->legend_position);
- }
-
- # Add subgraphs
- if($self->has_subgraphs) {
- for my $subgraph (@{$self->subgraphs}) {
- $subgraph->border->width(0);
- $subgraph->padding(0);
-
- $self->add_component($subgraph, 'south');
- }
- }
-
- if(defined($self->title->text)) {
- my $tp = $self->title_position;
- if(($tp =~ /^e/) || ($tp =~ /^w/)) {
- unless(defined($self->title->angle)) {
- $self->title->angle(-1.5707);
- }
- }
- $self->add_component($self->title, $tp);
- }
- }
-
- my $plot = $self->plot;
-
- $plot->clear_components;
- $plot->render_area->clear_components;
-
- # These two adds are here because the plot is too dependant on changes
- # in the axes and such to trust it across multiple prepares. Putting all
- # of this here made it easier to digest, although this has some codestink
- # to it...
- if($plot->grid->visible && !$self->grid_over) {
- $plot->render_area->add_component($plot->grid, 'c');
- }
-
- $plot->render_area->add_component(
- $self->marker_overlay
- );
-
- # Sentinels to control the side that the axes will be drawn on.
- my $dcount = 0;
- my $rcount = 0;
- # Hashes of axes & renderers we've already seen, as we don't want to add
- # them again...
- my %xaxes;
- my %yaxes;
-
- # A "seen" hash to prevent us from adding multiple renderers for the same
- # context.
- my %rends;
-
- my $dflt_ctx = $self->get_context('default');
- die('Clicker must have a default context') unless defined($dflt_ctx);
-
- # Prepare the datasets and establish ranges for the axes.
- my $count = 0;
- foreach my $ds (@{ $self->datasets }) {
- unless($ds->count > 0) {
- die("Dataset $count is empty.");
- }
-
- $ds->prepare;
-
- my $ctx = $self->get_context($ds->context);
-
- unless(defined($ctx)) {
- $ctx = $dflt_ctx;
- }
-
- # Find our x axis and add it.
- my $xaxis = $ctx->domain_axis;
- unless(exists($xaxes{refaddr($xaxis)})) {
- $xaxis->range->combine($ds->domain);
-
- $xaxis->orientation('horizontal');
-
- if($dcount % 2) {
- $xaxis->position('top');
- $xaxis->border->bottom->width($xaxis->brush->width);
- } else {
- $xaxis->position('bottom');
- $xaxis->border->top->width($xaxis->brush->width);
- }
- $xaxis->border->color($xaxis->color);
-
- $plot->add_component($xaxis, $xaxis->is_top ? 'n' : 's');
- $xaxes{refaddr($xaxis)} = 1;
- $dcount++;
- }
-
- # Find our y axis and add it.
- my $yaxis = $ctx->range_axis;
- unless(exists($yaxes{refaddr($yaxis)})) {
- $yaxis->range->combine($ds->range);
-
- $yaxis->orientation('vertical');
-
- if($rcount % 2) {
- $yaxis->position('right');
- $yaxis->border->left->width($yaxis->brush->width);
- } else {
- $yaxis->position('left');
- $yaxis->border->right->width($yaxis->brush->width);
- }
- $yaxis->border->color($yaxis->color);
-
- $plot->add_component($yaxis, $yaxis->is_left ? 'w' : 'e');
- $rcount++;
- $yaxes{refaddr($yaxis)} = 1;
- }
-
- my $rend = $ctx->renderer;
- if($rend->additive) {
- $yaxis->range->upper($ds->largest_value_slice);
- } else {
- $yaxis->range->combine($ds->range);
- }
-
- # Only add this renderer to the chart if we haven't seen it already.
- unless(exists($rends{$ctx->name})) {
- $rend->context($ctx->name);
- $rend->clicker($self);
- $plot->render_area->add_component($rend, 'c');
- $rends{$ctx->name} = $rend;
- }
-
- $count++;
- }
-
- if($plot->grid->visible && $self->grid_over) {
- $plot->grid->background_color->alpha(0);
- $plot->render_area->add_component($plot->grid, 'c');
- }
-
- foreach my $c (@{ $self->components }) {
- $c->clicker($self) if $c->can('clicker');
- }
-
- $plot->add_component($plot->render_area, 'c');
-
- foreach my $oc (@{ $self->over_decorations }) {
- $plot->render_area->add_component($oc, 'c');
- }
-
- super;
-});
-
-sub set_renderer {
- my ($self, $renderer, $context) = @_;
-
- $context = 'default' unless defined($context);
-
- my $ctx = $self->get_context($context);
- die("Unknown context: '$context'") unless defined($ctx);
-
- $ctx->renderer($renderer);
-}
+# ABSTRACT: Powerful, extensible charting.
-sub write_output {
- my $self = shift;
-
- $self->draw;
- $self->write(@_);
-}
+use Layout::Manager::Compass;
-__PACKAGE__->meta->make_immutable;
+use Graphics::Color::RGB;
-no Moose;
+use Graphics::Primitive::Insets;
+use Graphics::Primitive::Border;
-1;
+use Graphics::Primitive::Driver::Cairo;
-__END__
+use Chart::Clicker::Context;
-=head1 NAME
+use Chart::Clicker::Data::DataSet;
+use Chart::Clicker::Data::Series;
+use Chart::Clicker::Decoration::Legend;
+use Chart::Clicker::Decoration::MarkerOverlay;
+use Chart::Clicker::Decoration::Plot;
+use Chart::Clicker::Drawing::ColorAllocator;
-Chart::Clicker - Powerful, extensible charting.
+use Carp qw(croak);
+use Scalar::Util qw(refaddr);
=head1 SYNOPSIS
@@ -498,6 +56,8 @@ Clicker leverages the power of Graphics::Primitive to create snazzy graphics
without being tied to specific backend. You may want to begin with
L<Chart::Clicker::Tutorial>.
+=begin :prelude
+
=head1 EXAMPLES
For code examples see the examples repository on GitHub:
@@ -581,146 +141,417 @@ Clicker supports the following renderers:
<p><img src="http://www.onemogin.com/clicker/chart-clicker-examples/point/point.png" width="500" height="250" alt="Point Chart" /></p>
-=end HTML
+=end HTML
+
+=item B<Pie>
+
+=begin HTML
+
+<p><img src="http://www.onemogin.com/clicker/chart-clicker-examples/pie/pie.png" width="300" height="250" alt="Pie Chart" /></p>
+
+=end HTML
+
+=item B<PolarArea>
+
+=begin HTML
+
+<p><img src="http://www.onemogin.com/clicker/chart-clicker-examples/polararea/polararea.png" width="300" height="250" alt="Polar Area Chart" /></p>
+
+=end HTML
+
+
+=back
+
+=head1 ADDING DATA
+
+The synopsis shows the simple way to add data.
+
+ my @values = (42, 25, 86, 23, 2, 19, 103, 12, 54, 9);
+ foreach my $v (@values) {
+ $cc->add_data('Sales', $v);
+ }
+
+This is a convenience method provided to make simple cases much simpler. Adding
+multiple Series to a chart is as easy as changing the name argument of
+C<add_data>. Each unique first argument will result in a separate series. See
+the docs for C<add_data> to learn more.
+
+If you'd like to use the more advanced features of Clicker you'll need to
+shake off this simple method and build Series & DataSets explicitly.
+
+ use Chart::Clicker::Data::Series;
+ use Chart::Clicker::Data::DataSet;
+
+ ...
+
+ my $series = Chart::Clicker::Data::Series->new(
+ keys => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
+ values => [ 42, 25, 86, 23, 2, 19, 103, 12, 54, 9 ],
+ );
+
+ my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series ]);
+
+ $cc->add_to_datasets($ds);
+
+This used to be the only way to add data, but repeated requests to make the
+common case easier resulted in the inclusion of C<add_data>.
+
+=head1 CONTEXTS
+
+The normal use case for a chart is a couple of datasets on the same axes.
+Sometimes you want to chart one or more datasets on different axes. A common
+need for this is when you are comparing two datasets of vastly different scale
+such as the number of employees in an office (1-10) to monthly revenues (10s
+of thousands). On a normal chart the number of employees would show up as a
+flat line at the bottom of the chart.
+
+To correct this, Clicker has contexts. A context is a pair of axes, a
+renderer and a name. The name is the 'key' by which you will refer to the
+context.
+
+ my $context = Chart::Clicker::Context->new( name => 'sales' );
+ $clicker->add_to_contexts($context);
+
+ $dataset->context('sales');
+
+ $clicker->add_to_datasets($dataset);
+
+New contexts provide a fresh domain and range axis and default to a Line
+renderer.
+
+B<Caveat>: Clicker expects that the default context (identified by the string
+"default") will always be present. It is from this context that some of
+Clicker's internals draw their values. You should use the default context
+unless you need more than one, in which case you should use "default" as the
+base context.
+
+=head1 FORMATS & OUTPUT
+
+Clicker supports PNG, SVG, PDF and PostScript output. To change your output
+type, specificy it when you create your Clicker object:
+
+ my $cc = Chart::Clicker->new(format => 'pdf', ...);
+ # ...
+ $cc->write_output('chart.pdf');
+
+If you are looking to get a scalar of the output for use with HTTP or
+similar things, you can use:
+
+ # ... make your chart
+ $cc->draw;
+ my $image_data = $cc->data;
+
+If you happen to be using Catalyst then take a look at
+L<Catalyst::View::Graphics::Primitive>.
+
+=end :prelude
+
+=attr background_color
+
+Set/Get the background color. Expects a L<Graphics::Color> object. Defaults
+to white.
+
+=cut
+
+has '+background_color' => (
+ default => sub {
+ Graphics::Color::RGB->new({ red => 1, green => 1, blue => 1, alpha => 1 })
+ }
+);
+
+=attr border
+
+Set/Get the border. Expects a L<Graphics::Primitive::Border>.
+
+=cut
+
+has '+border' => (
+ default => sub {
+ my $b = Graphics::Primitive::Border->new;
+ $b->color(Graphics::Color::RGB->new(red => 0, green => 0, blue => 0));
+ $b->width(1);
+ return $b;
+ }
+);
+
+=attr color_allocator
+
+Set/Get the color_allocator for this chart.
+
+=cut
+
+has 'color_allocator' => (
+ is => 'rw',
+ isa => 'Chart::Clicker::Drawing::ColorAllocator',
+ default => sub { Chart::Clicker::Drawing::ColorAllocator->new }
+);
+
+=attr contexts
+
+Set/Get the contexts for this chart.
+
+=method context_count
+
+Get a count of contexts.
+
+=method context_names
+
+Get a list of context names.
+
+=method delete_context ($name)
+
+Remove the context with the specified name.
+
+=method get_context ($name)
+
+Get the context with the specified name
+
+=method set_context ($name, $context)
+
+Set a context of the specified name.
+
+=cut
+
+has 'contexts' => (
+ traits => [ 'Hash' ],
+ is => 'rw',
+ isa => 'HashRef[Chart::Clicker::Context]',
+ default => sub { { default => Chart::Clicker::Context->new(name => 'default') } },
+ handles => {
+ 'set_context' => 'set',
+ 'get_context' => 'get',
+ 'context_names' => 'keys',
+ 'context_count' => 'count',
+ 'delete_context' => 'delete'
+ }
+);
+
+has '_data' => (
+ traits => [ 'Hash' ],
+ is => 'rw',
+ isa => 'HashRef[Str]',
+ default => sub { {} }
+);
+
+=attr datasets
+
+Get/Set the datasets for this chart.
+
+=method add_to_datasets
+
+Add the specified dataset (or arrayref of datasets) to the chart.
+
+=method dataset_count
+
+Get a count of datasets.
+
+=method get_dataset ($index)
+
+Get the dataset at the specified index.
+
+=cut
+
+has 'datasets' => (
+ traits => [ 'Array' ],
+ is => 'rw',
+ isa => 'ArrayRef',
+ default => sub { [] },
+ handles => {
+ 'dataset_count' => 'count',
+ 'add_to_datasets' => 'push',
+ 'get_dataset' => 'get'
+ }
+);
+
+=attr driver
+
+Set/Get the driver used to render this Chart. Defautls to
+L<Graphics::Primitive::Driver::Cairo>.
+
+=cut
+
+has 'driver' => (
+ is => 'rw',
+ does => 'Graphics::Primitive::Driver',
+ default => sub {
+ my ($self) = @_;
+ Graphics::Primitive::Driver::Cairo->new(
+ format => $self->format,
+ )
+ },
+ handles => {
+ 'rendered_data' => 'data',
+ write => 'write'
+ },
+ lazy => 1
+);
+
+=attr format
-=item B<Pie>
+Get the format for this Chart. Required in the constructor. Must be on of
+Png, Pdf, Ps or Svg.
-=begin HTML
+=cut
-<p><img src="http://www.onemogin.com/clicker/chart-clicker-examples/pie/pie.png" width="300" height="250" alt="Pie Chart" /></p>
+has 'format' => (
+ is => 'rw',
+ isa => 'Str',
+ default => sub { 'PNG' }
+);
-=end HTML
+=attr grid_over
-=item B<PolarArea>
+Flag controlling if the grid is rendered B<over> the data. Defaults to 0.
+You probably want to set the grid's background color to an alpha of 0 if you
+enable this flag.
-=begin HTML
+=cut
-<p><img src="http://www.onemogin.com/clicker/chart-clicker-examples/polararea/polararea.png" width="300" height="250" alt="Polar Area Chart" /></p>
+has 'grid_over' => (
+ is => 'rw',
+ isa => 'Bool',
+ default => sub { 0 }
+);
-=end HTML
+=attr height
+Set/Get the height. Defaults to 300.
-=back
+=cut
-=head1 ADDING DATA
+has '+height' => (
+ default => 300
+);
-The synopsis shows the simple way to add data.
+=attr layout_manager
- my @values = (42, 25, 86, 23, 2, 19, 103, 12, 54, 9);
- foreach my $v (@values) {
- $cc->add_data('Sales', $v);
- }
+Set/Get the layout manager. Defaults to L<Layout::Manager::Compass>.
-This is a convenience method provided to make simple cases much simpler. Adding
-multiple Series to a chart is as easy as changing the name argument of
-C<add_data>. Each unique first argument will result in a separate series. See
-the docs for C<add_data> to learn more.
+=cut
-If you'd like to use the more advanced features of Clicker you'll need to
-shake off this simple method and build Series & DataSets explicitly.
+has '+layout_manager' => (
+ default => sub { Layout::Manager::Compass->new }
+);
- use Chart::Clicker::Data::Series;
- use Chart::Clicker::Data::DataSet;
+=attr legend
- ...
+Set/Get the legend that will be used with this chart.
- my $series = Chart::Clicker::Data::Series->new(
- keys => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
- values => [ 42, 25, 86, 23, 2, 19, 103, 12, 54, 9 ],
- );
+=cut
- my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series ]);
-
- $cc->add_to_datasets($ds);
+has 'legend' => (
+ is => 'rw',
+ isa => 'Chart::Clicker::Decoration::Legend',
+ default => sub {
+ Chart::Clicker::Decoration::Legend->new(
+ name => 'legend',
+ );
+ }
+);
-This used to be the only way to add data, but repeated requests to make the
-common case easier resulted in the inclusion of C<add_data>.
+=attr legend_position
-=head1 CONTEXTS
+The position the legend will be added. Should be one of north, south, east,
+west or center as required by L<Layout::Manager::Compass>.
-The normal use case for a chart is a couple of datasets on the same axes.
-Sometimes you want to chart one or more datasets on different axes. A common
-need for this is when you are comparing two datasets of vastly different scale
-such as the number of employees in an office (1-10) to monthly revenues (10s
-of thousands). On a normal chart the number of employees would show up as a
-flat line at the bottom of the chart.
+=cut
-To correct this, Clicker has contexts. A context is a pair of axes, a
-renderer and a name. The name is the 'key' by which you will refer to the
-context.
+has 'legend_position' => (
+ is => 'rw',
+ isa => 'Str',
+ default => sub { 's' }
+);
- my $context = Chart::Clicker::Context->new( name => 'sales' );
- $clicker->add_to_contexts($context);
-
- $dataset->context('sales');
-
- $clicker->add_to_datasets($dataset);
-
-New contexts provide a fresh domain and range axis and default to a Line
-renderer.
+=attr marker_overlay
-B<Caveat>: Clicker expects that the default context (identified by the string
-"default") will always be present. It is from this context that some of
-Clicker's internals draw their values. You should use the default context
-unless you need more than one, in which case you should use "default" as the
-base context.
+Set/Get the marker overlay object that will be used if this chart
+has markers. This is lazily constructed to save time.
-=head1 FORMATS & OUTPUT
+=cut
-Clicker supports PNG, SVG, PDF and PostScript output. To change your output
-type, specificy it when you create your Clicker object:
+has 'marker_overlay' => (
+ is => 'rw',
+ isa => 'Chart::Clicker::Decoration::MarkerOverlay',
+ lazy => 1,
+ default => sub {
+ Chart::Clicker::Decoration::MarkerOverlay->new
+ }
+);
- my $cc = Chart::Clicker->new(format => 'pdf', ...);
- # ...
- $cc->write_output('chart.pdf');
+=attr over_decorations
-If you are looking to get a scalar of the output for use with HTTP or
-similar things, you can use:
+Set/Get an arrayref of "over decorations", or things that are drawn OVER the
+chart. This is an advanced feature. See C<overaxis-bar.pl> in the examples.
- # ... make your chart
- $cc->draw;
- my $image_data = $cc->data;
+=method add_to_over_decorations
-If you happen to be using Catalyst then take a look at
-L<Catalyst::View::Graphics::Primitive>.
+Add an over decoration to the list.
-=head1 ATTRIBUTES
+=method get_over_decoration ($index)
-=head2 contexts
+Get the over decoration at the specified index.
-Set/Get the contexts for this chart.
+=method over_decoration_count
-=head2 datasets
+Get a count of over decorations.
-Get/Set the datasets for this chart.
+=cut
-=head2 format
+has 'over_decorations' => (
+ traits => [ 'Array' ],
+ is => 'rw',
+ isa => 'ArrayRef',
+ default => sub { [] },
+ handles => {
+ 'over_decoration_count' => 'count',
+ 'add_to_over_decorations' => 'push',
+ 'get_over_decoration' => 'get'
+ }
+);
-Get the format for this Chart. Required in the constructor. Must be on of
-Png, Pdf, Ps or Svg.
+=attr padding
-=head2 legend
+Set/Get the padding. Expects a L<Graphics::Primitive::Insets> object. Defaults
+to 3px on all sides.
-Set/Get the legend that will be used with this chart.
+has '+padding' => (
+ default => sub {
+ Graphics::Primitive::Insets->new(
+ top => 3, bottom => 3, right => 3, left => 3
+ )
+ }
+);
-=head2 legend_position
+=attr plot
-The position the legend will be added. Should be one of north, south, east,
-west or center as required by L<Layout::Manager::Compass>.
+Set/Get the Plot on which things are drawn.
-=head2 grid_over
+=cut
-Flag controlling if the grid is rendered B<over> the data. Defaults to 0.
-You probably want to set the grid's background color to an alpha of 0 if you
-enable this flag.
+has 'plot' => (
+ is => 'rw',
+ isa => 'Chart::Clicker::Decoration::Plot',
+ default => sub {
+ Chart::Clicker::Decoration::Plot->new
+ }
+);
-=head2 subgraphs
+=attr subgraphs
You can add "child" graphs to this one via C<add_subgraph>. These must be
Chart::Clicker objects and they will be added to the bottom of the existing
chart. This is a rather esoteric feature.
-=head2 title
+=cut
+
+has 'subgraphs' => (
+ is => 'rw',
+ isa => 'ArrayRef',
+ default => sub { [] },
+ predicate => 'has_subgraphs'
+);
+
+=attr title
Set/Get the title component for this chart. This is a
L<Graphics::Primitive::TextBox>, not a string. To set the title of a chart
@@ -738,8 +569,21 @@ things like padding and text rotation. If you are adding it to the top and
want some padding between it and the plot, you can:
$cc->title->padding->bottom(5);
+
+=cut
+
+has 'title' => (
+ is => 'rw',
+ isa => 'Graphics::Primitive::TextBox',
+ default => sub {
+ Graphics::Primitive::TextBox->new(
+ color => Graphics::Color::RGB->new( red => 0, green => 0, blue => 0),
+ horizontal_alignment => 'center'
+ )
+ }
+);
-=head2 title_position
+=attr title_position
The position the title will be added. Should be one of north, south, east,
west or center as required by L<Layout::Manager::Compass>.
@@ -747,14 +591,104 @@ west or center as required by L<Layout::Manager::Compass>.
Note that if no angle is set for the title then it will be changed to
-1.5707 if the title position is east or west.
-=head1 METHODS
+=cut
+
+has 'title_position' => (
+ is => 'rw',
+ isa => 'Str',
+ default => sub { 'n' }
+);
+
+=attr width
+
+Set/Get the width. Defaults to 500.
+
+=cut
+
+has '+width' => (
+ default => 500
+);
+
+=method add_to_contexts
+
+Add the specified context to the chart.
+
+=cut
+
+sub add_to_contexts {
+ my ($self, $ctx) = @_;
+
+ if(defined($self->get_context($ctx->name))) {
+ croak("Context named '".$ctx->name."' already exists.");
+ }
+ $self->set_context($ctx->name, $ctx);
+}
+
+=method add_subgraph
+
+Add a subgraph to this chart.
+
+=cut
+
+sub add_subgraph {
+ my ($self, $graph) = @_;
+
+ if (not ref $graph or not $graph->isa('Chart::Clicker')) {
+ die('Sub-Graphs must be Chart::Clicker objects');
+ }
+ push(@{$self->subgraphs}, $graph);
+}
+
+=method data
+
+Returns the data for this chart as a scalar. Suitable for 'streaming' to a
+client.
+
+=cut
+
+sub data {
+ my ($self) = @_;
+ print STDERR "WARNING: Calling 'data' to get image data is deprecated, please use rendered_data\n";
+ $self->rendered_data;
+}
+
+=method draw
+
+Draw this chart.
+
+=cut
+
+sub draw {
+ my ($self) = @_;
+ my $driver = $self->driver;
+ $driver->prepare($self);
+
+ $self->layout_manager->do_layout($self);
+ $driver->finalize($self);
+ $driver->draw($self);
+}
+
+=method get_datasets_for_context
+
+Returns an arrayref containing all datasets for the given context. Used by
+renderers to get a list of datasets to chart.
+
+=cut
+
+sub get_datasets_for_context {
+ my ($self, $name) = @_;
-=head2 new
+ my @dses;
+ foreach my $ds (@{ $self->datasets }) {
+ if($ds->context eq $name) {
+ push(@dses, $ds);
+ }
+ }
-Creates a new Chart::Clicker object. If no format, width and height are
-specified then defaults of Png, 500 and 300 are chosen, respectively.
+ return \@dses;
+}
-=head2 add_data ($name, $data)
+=method add_data ($name, $data)
Convenience method for adding data to the chart. Can be called one of three
ways.
@@ -792,63 +726,247 @@ thing. Subsequent calls with the same name will overwrite previous calls.
=back
-=head2 add_to_contexts
+=cut
-Add the specified context to the chart.
+sub add_data {
+ my ($self, $name, $data) = @_;
-=head2 add_to_datasets
+ if(ref($data) eq 'ARRAY') {
+ $self->_data->{$name} = [] unless defined($self->_data->{$name});
+ push(@{ $self->_data->{$name}}, @{ $data });
+ } elsif(ref($data) eq 'HASH') {
+ $self->_data->{$name} = $data;
+ } else {
+ $self->_data->{$name} = [] unless defined($self->_data->{$name});
+ push(@{ $self->_data->{$name}}, $data);
+ }
+}
-Add the specified dataset (or arrayref of datasets) to the chart.
+override('prepare', sub {
+ my ($self, $driver) = @_;
-=head2 add_subgraph
+ return if $self->prepared;
-Add a subgraph to this chart.
+ if(scalar(keys(%{ $self->_data }))) {
-=head2 color_allocator
+ my $ds = Chart::Clicker::Data::DataSet->new;
+ foreach my $name (keys(%{ $self->_data })) {
-Set/Get the color_allocator for this chart.
+ my $vals = $self->_data->{$name};
-=head2 data
+ if(ref($vals) eq 'ARRAY') {
+ # This allows the user to add data as an array
-Returns the data for this chart as a scalar. Suitable for 'streaming' to a
-client.
+ $ds->add_to_series(
+ Chart::Clicker::Data::Series->new(
+ name => $name,
+ keys => [ 0..scalar(@{ $vals }) - 1 ],
+ values => $vals
+ )
+ );
+ } elsif(ref($vals) eq 'HASH') {
+ # This allows the user to add data as a hashref
+ my @keys = sort { $a <=> $b } keys %{ $vals };
-=head2 draw
+ my @values = ();
+ foreach my $k (@keys) {
+ push(@values, $vals->{$k})
+ }
-Draw this chart.
+ $ds->add_to_series(
+ Chart::Clicker::Data::Series->new(
+ name => $name,
+ keys => \@keys,
+ values => \@values
+ )
+ );
+ }
+ }
+ $self->add_to_datasets($ds);
+ }
-=head2 get_datasets_for_context
+ unless(scalar(@{ $self->components })) {
+ $self->add_component($self->plot, 'c');
-Returns an arrayref containing all datasets for the given context. Used by
-renderers to get a list of datasets to chart.
+ my $lp = lc($self->legend_position);
+ if($self->legend->visible) {
+ if(($lp =~ /^e/) || ($lp =~ /^w/)) {
+ $self->legend->orientation('vertical');
+ }
+ $self->add_component($self->legend, $self->legend_position);
+ }
-=head2 inside_width
+ # Add subgraphs
+ if($self->has_subgraphs) {
+ for my $subgraph (@{$self->subgraphs}) {
+ $subgraph->border->width(0);
+ $subgraph->padding(0);
-Get the width available in this container after taking away space for
-insets and borders.
+ $self->add_component($subgraph, 'south');
+ }
+ }
-=head2 inside_height
+ if(defined($self->title->text)) {
+ my $tp = $self->title_position;
+ if(($tp =~ /^e/) || ($tp =~ /^w/)) {
+ unless(defined($self->title->angle)) {
+ $self->title->angle(-1.5707);
+ }
+ }
+ $self->add_component($self->title, $tp);
+ }
+ }
-Get the height available in this container after taking away space for
-insets and borders.
+ my $plot = $self->plot;
-=head2 marker_overlay
+ $plot->clear_components;
+ $plot->render_area->clear_components;
-Set/Get the marker overlay object that will be used if this chart
-has markers. This is lazily constructed to save time.
+ # These two adds are here because the plot is too dependant on changes
+ # in the axes and such to trust it across multiple prepares. Putting all
+ # of this here made it easier to digest, although this has some codestink
+ # to it...
+ if($plot->grid->visible && !$self->grid_over) {
+ $plot->render_area->add_component($plot->grid, 'c');
+ }
+
+ $plot->render_area->add_component(
+ $self->marker_overlay
+ );
+
+ # Sentinels to control the side that the axes will be drawn on.
+ my $dcount = 0;
+ my $rcount = 0;
+ # Hashes of axes & renderers we've already seen, as we don't want to add
+ # them again...
+ my %xaxes;
+ my %yaxes;
+
+ # A "seen" hash to prevent us from adding multiple renderers for the same
+ # context.
+ my %rends;
+
+ my $dflt_ctx = $self->get_context('default');
+ die('Clicker must have a default context') unless defined($dflt_ctx);
+
+ # Prepare the datasets and establish ranges for the axes.
+ my $count = 0;
+ foreach my $ds (@{ $self->datasets }) {
+ unless($ds->count > 0) {
+ die("Dataset $count is empty.");
+ }
+
+ $ds->prepare;
+
+ my $ctx = $self->get_context($ds->context);
+
+ unless(defined($ctx)) {
+ $ctx = $dflt_ctx;
+ }
+
+ # Find our x axis and add it.
+ my $xaxis = $ctx->domain_axis;
+ unless(exists($xaxes{refaddr($xaxis)})) {
+ $xaxis->range->combine($ds->domain);
+
+ $xaxis->orientation('horizontal');
+
+ if($dcount % 2) {
+ $xaxis->position('top');
+ $xaxis->border->bottom->width($xaxis->brush->width);
+ } else {
+ $xaxis->position('bottom');
+ $xaxis->border->top->width($xaxis->brush->width);
+ }
+ $xaxis->border->color($xaxis->color);
+
+ $plot->add_component($xaxis, $xaxis->is_top ? 'n' : 's');
+ $xaxes{refaddr($xaxis)} = 1;
+ $dcount++;
+ }
+
+ # Find our y axis and add it.
+ my $yaxis = $ctx->range_axis;
+ unless(exists($yaxes{refaddr($yaxis)})) {
+ $yaxis->range->combine($ds->range);
+
+ $yaxis->orientation('vertical');
+
+ if($rcount % 2) {
+ $yaxis->position('right');
+ $yaxis->border->left->width($yaxis->brush->width);
+ } else {
+ $yaxis->position('left');
+ $yaxis->border->right->width($yaxis->brush->width);
+ }
+ $yaxis->border->color($yaxis->color);
+
+ $plot->add_component($yaxis, $yaxis->is_left ? 'w' : 'e');
+ $rcount++;
+ $yaxes{refaddr($yaxis)} = 1;
+ }
+
+ my $rend = $ctx->renderer;
+ if($rend->additive) {
+ $yaxis->range->upper($ds->largest_value_slice);
+ } else {
+ $yaxis->range->combine($ds->range);
+ }
+
+ # Only add this renderer to the chart if we haven't seen it already.
+ unless(exists($rends{$ctx->name})) {
+ $rend->context($ctx->name);
+ $rend->clicker($self);
+ $plot->render_area->add_component($rend, 'c');
+ $rends{$ctx->name} = $rend;
+ }
+
+ $count++;
+ }
+
+ if($plot->grid->visible && $self->grid_over) {
+ $plot->grid->background_color->alpha(0);
+ $plot->render_area->add_component($plot->grid, 'c');
+ }
+
+ foreach my $c (@{ $self->components }) {
+ $c->clicker($self) if $c->can('clicker');
+ }
+
+ $plot->add_component($plot->render_area, 'c');
+
+ foreach my $oc (@{ $self->over_decorations }) {
+ $plot->render_area->add_component($oc, 'c');
+ }
+
+ super;
+});
-=head2 set_renderer ($renderer_object, [ $context ]);
+=method set_renderer ($renderer_object, [ $context ]);
Sets the renderer on the specified context. If no context is provided then
'default' is assumed.
-=head2 write
+=cut
+
+sub set_renderer {
+ my ($self, $renderer, $context) = @_;
+
+ $context = 'default' unless defined($context);
+
+ my $ctx = $self->get_context($context);
+ die("Unknown context: '$context'") unless defined($ctx);
+
+ $ctx->renderer($renderer);
+}
+
+=method write
This method is passed through to the underlying driver. It is only necessary
that you call this if you manually called C<draw> beforehand. You likely
want to use C<write_output>.
-=head2 write_output ($path)
+=method write_output ($path)
Write the chart output to the specified location. Output is written in the
format provided to the constructor (which defaults to Png). Internally
@@ -856,6 +974,33 @@ calls C<draw> for you. If you use this method, do not call C<draw> first!
$c->write_output('/path/to/the.png');
+=cut
+
+sub write_output {
+ my $self = shift;
+
+ $self->draw;
+ $self->write(@_);
+}
+
+__PACKAGE__->meta->make_immutable;
+
+no Moose;
+
+1;
+
+=method inside_width
+
+Get the width available in this container after taking away space for
+insets and borders.
+
+=method inside_height
+
+Get the height available in this container after taking away space for
+insets and borders.
+
+=begin :postlude
+
=head1 ISSUES WITH CENTOS
I've had numerous reports of problems with Chart::Clicker when using CentOS.
@@ -866,10 +1011,6 @@ I hesitate to provide any other data with this because it may get out of date
fast. If you have trouble feel free to drop me an email and I'll tell you
what I know.
-=head1 AUTHOR
-
-Cory G Watson <gphat@cpan.org>
-
=head1 CONTRIBUTORS
Many thanks to the individuals who have contributed various bits:
@@ -878,6 +1019,8 @@ Ash Berlin
Brian Cassidy
+Michael Peters
+
Guillermo Roditi
Torsten Schoenfeld
@@ -890,9 +1033,4 @@ Chart::Clicker is on github:
http://github.com/gphat/chart-clicker/tree/master
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2007-2010 by Cory G Watson
-
-You can redistribute and/or modify this code under the same terms as Perl
-itself.
+=end :postlude
View
450 lib/Chart/Clicker/Axis.pm
@@ -4,6 +4,8 @@ use Moose;
extends 'Chart::Clicker::Container';
with 'Chart::Clicker::Positioned';
+# ABSTRACT: An X or Y Axis
+
use Chart::Clicker::Data::Range;
use Graphics::Color::RGB;
@@ -14,15 +16,62 @@ use Layout::Manager::Absolute;
use Math::Trig ':pi';
+=head1 DESCRIPTION
+
+Chart::Clicker::Axis represents the plot of the chart.
+
+=head1 SYNOPSIS
+
+ use Chart::Clicker::Axis;
+ use Graphics::Primitive::Font;
+ use Graphics::Primitive::Brush;
+
+ my $axis = Chart::Clicker::Axis->new({
+ font => Graphics::Primitive::Font->new,
+ orientation => 'vertical',
+ position => 'left',
+ brush => Graphics::Primitive::Brush->new,
+ visible => 1,
+ });
+
+=attr height
+
+The height of the axis.
+
+=attr width
+
+This axis' width.
+
+=attr tick_label_angle
+
+The angle (in radians) to rotate the tick's labels.
+
+=cut
+
has 'tick_label_angle' => (
is => 'rw',
isa => 'Num'
);
+
+=attr baseline
+
+The 'baseline' value of this axis. This is used by some renderers to change
+the way a value is marked. The Bar render, for instance, considers values
+below the base to be 'negative'.
+
+=cut
+
has 'baseline' => (
is => 'rw',
isa => 'Num',
);
-# Remove for border...
+
+=attr brush
+
+The brush for this axis. Expects a L<Graphics::Primitve::Brush>.
+
+=cut
+
has 'brush' => (
is => 'rw',
isa => 'Graphics::Primitive::Brush',
@@ -35,6 +84,14 @@ has 'brush' => (
)
}
);
+
+=attr color
+
+The color of the axis' border. Expects a L<Graphics::Color::RGB> object.
+Defaults to black.
+
+=cut
+
has '+color' => (
default => sub {
Graphics::Color::RGB->new({
@@ -42,10 +99,61 @@ has '+color' => (
})
}
);
+
+=attr format
+
+The format to use for the axis values.
+
+If the format is a string then format is applied to each value 'tick' via
+sprintf. See sprintf perldoc for details! This is useful for situations
+where the values end up with repeating decimals.
+
+If the format is a coderef then that coderef will be executed and the value
+passed to it as an argument.
+
+ my $nf = Number::Format->new;
+ $default->domain_axis->format(sub { return $nf->format_number(shift); });
+
+=cut
+
has 'format' => ( is => 'rw', isa => 'Str|CodeRef' );
+
+=attr fudge_amount
+
+The amount to 'fudge' the span of this axis. You should supply a
+percentage (in decimal form) and the axis will grow at both ends by the
+supplied amount. This is useful when you want a bit of padding above and
+below the dataset.
+
+As an example, a fugdge_amount of .10 on an axis with a span of 10 to 50
+would add 5 to the top and bottom of the axis.
+
+=cut
+
has 'fudge_amount' => ( is => 'rw', isa => 'Num', default => 0 );
+
+=attr hidden