pax_global_header00006660000000000000000000000064115064430220014507gustar00rootroot0000000000000052 comment=fefb20c9208e9f59284ec415a39a60df0e32ba79 jheatchart-0.6/000077500000000000000000000000001150644302200134715ustar00rootroot00000000000000jheatchart-0.6/LICENSE000066400000000000000000001237311150644302200145050ustar00rootroot00000000000000This file includes a copy of both: GNU GENERAL PUBLIC LICENSE GNU LESSER GENERAL PUBLIC LICENSE ---------------------------------------------------------------------- GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. 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 them 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 prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. 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. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. 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. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser 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 Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. jheatchart-0.6/README000066400000000000000000000037521150644302200143600ustar00rootroot00000000000000******************************************************************************* JHeatChart v.${version} Tom Castle: www.tc33.org ******************************************************************************* | | | JHeatChart is made available under a GPL license, for full details of the | | license see the included LICENSE text file. | | | |-----------------------------------------------------------------------------| For the latest version of JHeatChart and any tutorials and examples that exist, see the JHeatChart project pages at http://www.tc33.org. Contents of release: jheatchart-${version} | jheatchart-${version}.jar - the library. Put this anywhere on your class path. | src - directory containing all the java source. | ... | javadoc - directory containing the javadoc for this release. | ... | README - this file. | LICENSE - details of the GPL license this software is covered by. Usage: Simply put the jheatchart jar file on your class path and then you are free to create instances of HeatChart. Example code: // Create some dummy data. double[][] data = new double[][]{{3,2,3,4,5,6}, {2,3,4,5,6,7}, {3,4,5,6,7,6}, {4,5,6,7,6,5}}; // Create our heat chart using our data. HeatChart chart = new HeatChart(data); // Customise the chart. chart.setTitle("This is my chart title"); chart.setXAxisLabel("X Axis"); chart.setYAxisLabel("Y Axis"); // Output the chart to a file. chart.saveToFile(new File("my-chart.png")); jheatchart-0.6/build.xml000066400000000000000000000067061150644302200153230ustar00rootroot00000000000000 JHeatChart is a Java library for generating heat map charts. Copyright © 2009 Tom Castle. All Rights Reserved.]]> jheatchart-0.6/icon.png000066400000000000000000000056631150644302200151410ustar00rootroot00000000000000PNG  IHDR00`n pHYs   OiCCPPhotoshop ICC profilexڝSgTS=BKKoR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $pd!s#~<<+"x M0B\t8K@zB@F&S`cbP-`'{[! eDh;VEX0fK9-0IWfH  0Q){`##xFW<+*x<$9E[-qWW.(I+6aa@.y24x6_-"bbϫp@t~,/;m%h^ uf@Wp~<5j>{-]cK'Xto(hw?G%fIq^D$.Tʳ?D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9(xoʿܔĹdff-[n ڴ VE/(ۻCɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG499?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3- cHRMz%u0`:o_FIDATx10 ǙX9.gaG3db9 J:pC[}qrZ{!1s8,qeAADAhBJ OS~M! ry7df ]T2" ?$"Pss1P)Rn? Ch]WmtiqObb}ZIJ' "{DlIENDB`jheatchart-0.6/src/000077500000000000000000000000001150644302200142605ustar00rootroot00000000000000jheatchart-0.6/src/org/000077500000000000000000000000001150644302200150475ustar00rootroot00000000000000jheatchart-0.6/src/org/tc33/000077500000000000000000000000001150644302200156235ustar00rootroot00000000000000jheatchart-0.6/src/org/tc33/jheatchart/000077500000000000000000000000001150644302200177405ustar00rootroot00000000000000jheatchart-0.6/src/org/tc33/jheatchart/HeatChart.java000066400000000000000000001550311150644302200224530ustar00rootroot00000000000000/* * Copyright 2010 Tom Castle (www.tc33.org) * Licensed under GNU Lesser General Public License * * This file is part of JHeatChart - the heat maps charting api for Java. * * JHeatChart is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * JHeatChart is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with JHeatChart. If not, see . */ package org.tc33.jheatchart; import java.awt.*; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.io.*; import java.util.Iterator; import javax.imageio.*; import javax.imageio.stream.FileImageOutputStream; /** * The HeatChart class describes a chart which can display * 3-dimensions of values - x,y and z, where x and y are the usual 2-dimensional * axis and z is portrayed by colour intensity. Heat charts are sometimes known * as heat maps. * *

* Use of this chart would typically involve 3 steps: *

    *
  1. Construction of a new instance, providing the necessary z-values.
  2. *
  3. Configure the visual settings.
  4. *
  5. A call to either getChartImage() or saveToFile(String).
  6. *
* *

Instantiation

*

* Construction of a new HeatChart instance is through its one * constructor which takes a 2-dimensional array of doubles which * should contain the z-values for the chart. Consider this array to be * the grid of values which will instead be represented as colours in the chart. * *

* Setting of the x-values and y-values which are displayed along the * appropriate axis is optional, and by default will simply display the values * 0 to n-1, where n is the number of rows or columns. Otherwise, the x/y axis * values can be set with the setXValues and setYValues * methods. Both methods are overridden with two forms: * *

Object axis values

* *

* The simplist way to set the axis values is to use the methods which take an * array of Object[]. This array must have the same length as the number of * columns for setXValues and same as the number of rows for setYValues. The * string representation of the objects will then be used as the axis values. * *

Offset and Interval

* *

* This is convenient way of defining numerical values along the axis. One of * the two methods takes an interval and an offset for either the * x or y axis. These parameters supply the necessary information to describe * the values based upon the z-value indexes. The quantity of x-values and * y-values is already known from the lengths of the z-values array dimensions. * Then the offset parameters indicate what the first value will be, with the * intervals providing the increment from one column or row to the next. * *

* Consider an example: *

 * double[][] zValues = new double[][]{
 * 		{1.2, 1.3, 1.5},
 * 		{1.0, 1.1, 1.6},
 * 		{0.7, 0.9, 1.3}
 * };
 * 
 * double xOffset = 1.0;
 * double yOffset = 0.0;
 * double xInterval = 1.0;
 * double yInterval = 2.0;
 * 
 * chart.setXValues(xOffset, xInterval);
 * chart.setYValues(yOffset, yInterval);
 * 
* *

In this example, the z-values range from 0.7 to 1.6. The x-values range * from the xOffset value 1.0 to 4.0, which is calculated as the number of x-values * multiplied by the xInterval, shifted by the xOffset of 1.0. The y-values are * calculated in the same way to give a range of values from 0.0 to 6.0. * *

Configuration

*

* This step is optional. By default the heat chart will be generated without a * title or labels on the axis, and the colouring of the heat map will be in * grayscale. A large range of configuration options are available to customise * the chart. All customisations are available through simple accessor methods. * See the javadoc of each of the methods for more information. * *

Output

*

* The generated heat chart can be obtained in two forms, using the following * methods: *

    *
  • getChartImage() - The chart will be returned as a * BufferedImage object that can be used in any number of ways, * most notably it can be inserted into a Swing component, for use in a GUI * application.
  • *
  • saveToFile(File) - The chart will be saved to the file * system at the file location specified as a parameter. The image format that * the image will be saved in is derived from the extension of the file name.
  • *
* * Note: The chart image will not actually be created until * either saveToFile(File) or getChartImage() are called, and will be * regenerated on each successive call. */ public class HeatChart { /** * A basic logarithmic scale value of 0.3. */ public static final double SCALE_LOGARITHMIC = 0.3; /** * The linear scale value of 1.0. */ public static final double SCALE_LINEAR = 1.0; /** * A basic exponential scale value of 3.0. */ public static final double SCALE_EXPONENTIAL = 3; // x, y, z data values. private double[][] zValues; private Object[] xValues; private Object[] yValues; private boolean xValuesHorizontal; private boolean yValuesHorizontal; // General chart settings. private Dimension cellSize; private Dimension chartSize; private int margin; private Color backgroundColour; // Title settings. private String title; private Font titleFont; private Color titleColour; private Dimension titleSize; private int titleAscent; // Axis settings. private int axisThickness; private Color axisColour; private Font axisLabelsFont; private Color axisLabelColour; private String xAxisLabel; private String yAxisLabel; private Color axisValuesColour; private Font axisValuesFont; // The font size will be considered the maximum font size - it may be smaller if needed to fit in. private int xAxisValuesFrequency; private int yAxisValuesFrequency; private boolean showXAxisValues; private boolean showYAxisValues; // Generated axis properties. private int xAxisValuesHeight; private int xAxisValuesWidthMax; private int yAxisValuesHeight; private int yAxisValuesAscent; private int yAxisValuesWidthMax; private Dimension xAxisLabelSize; private int xAxisLabelDescent; private Dimension yAxisLabelSize; private int yAxisLabelAscent; // Heat map colour settings. private Color highValueColour; private Color lowValueColour; // How many RGB steps there are between the high and low colours. private int colourValueDistance; private double lowValue; private double highValue; // Key co-ordinate positions. private Point heatMapTL; private Point heatMapBR; private Point heatMapC; // Heat map dimensions. private Dimension heatMapSize; // Control variable for mapping z-values to colours. private double colourScale; /** * Constructs a heatmap for the given z-values against x/y-values that by * default will be the values 0 to n-1, where n is the number of columns or * rows. * * @param zValues the z-values, where each element is a row of z-values * in the resultant heat chart. */ public HeatChart(double[][] zValues) { this(zValues, min(zValues), max(zValues)); } /** * Constructs a heatmap for the given z-values against x/y-values that by * default will be the values 0 to n-1, where n is the number of columns or * rows. * * @param zValues the z-values, where each element is a row of z-values * in the resultant heat chart. * @param low the minimum possible value, which may or may not appear in the * z-values. * @param high the maximum possible value, which may or may not appear in * the z-values. */ public HeatChart(double[][] zValues, double low, double high) { this.zValues = zValues; this.lowValue = low; this.highValue = high; // Default x/y-value settings. setXValues(0, 1); setYValues(0, 1); // Default chart settings. this.cellSize = new Dimension(20, 20); this.margin = 20; this.backgroundColour = Color.WHITE; // Default title settings. this.title = null; this.titleFont = new Font("Sans-Serif", Font.BOLD, 16); this.titleColour = Color.BLACK; // Default axis settings. this.xAxisLabel = null; this.yAxisLabel = null; this.axisThickness = 2; this.axisColour = Color.BLACK; this.axisLabelsFont = new Font("Sans-Serif", Font.PLAIN, 12); this.axisLabelColour = Color.BLACK; this.axisValuesColour = Color.BLACK; this.axisValuesFont = new Font("Sans-Serif", Font.PLAIN, 10); this.xAxisValuesFrequency = 1; this.xAxisValuesHeight = 0; this.xValuesHorizontal = false; this.showXAxisValues = true; this.showYAxisValues = true; this.yAxisValuesFrequency = 1; this.yAxisValuesHeight = 0; this.yValuesHorizontal = true; // Default heatmap settings. this.highValueColour = Color.BLACK; this.lowValueColour = Color.WHITE; this.colourScale = SCALE_LINEAR; updateColourDistance(); } /** * Returns the low value. This is the value at which the low value colour * will be applied. * * @return the low value. */ public double getLowValue() { return lowValue; } /** * Returns the high value. This is the value at which the high value colour * will be applied. * * @return the high value. */ public double getHighValue() { return highValue; } /** * Returns the 2-dimensional array of z-values currently in use. Each * element is a double array which represents one row of the heat map, or * all the z-values for one y-value. * * @return an array of the z-values in current use, that is, those values * which will define the colour of each cell in the resultant heat map. */ public double[][] getZValues() { return zValues; } /** * Replaces the z-values array. See the * {@link #setZValues(double[][], double, double)} method for an example of * z-values. The smallest and largest values in the array are used as the * minimum and maximum values respectively. * @param zValues the array to replace the current array with. The number * of elements in each inner array must be identical. */ public void setZValues(double[][] zValues) { setZValues(zValues, min(zValues), max(zValues)); } /** * Replaces the z-values array. The number of elements should match the * number of y-values, with each element containing a double array with * an equal number of elements that matches the number of x-values. Use this * method where the minimum and maximum values possible are not contained * within the dataset. * *

Example

* *
	 * new double[][]{
	 *   {1.0,1.2,1.4},
	 *   {1.2,1.3,1.5},
	 *   {0.9,1.3,1.2},
	 *   {0.8,1.6,1.1}
	 * };
	 * 
* * The above zValues array is equivalent to: * * * * * * * * * * * * * * * * * * * * * * * * * * * *
y
1.01.21.4
1.21.31.5
0.91.31.2
0.81.61.1
x
* * @param zValues the array to replace the current array with. The number * of elements in each inner array must be identical. * @param low the minimum possible value, which may or may not appear in the * z-values. * @param high the maximum possible value, which may or may not appear in * the z-values. */ public void setZValues(double[][] zValues, double low, double high) { this.zValues = zValues; this.lowValue = low; this.highValue = high; } /** * Sets the x-values which are plotted along the x-axis. The x-values are * calculated based upon the indexes of the z-values array: * *
	 * x-value = x-offset + (column-index * x-interval)
	 * 
* *

The x-interval defines the gap between each x-value and the x-offset * is applied to each value to offset them all from zero. * *

Alternatively the x-values can be set more directly with the * setXValues(Object[]) method. * * @param xOffset an offset value to be applied to the index of each z-value * element. * @param xInterval an interval that will separate each x-value item. */ public void setXValues(double xOffset, double xInterval) { // Update the x-values according to the offset and interval. xValues = new Object[zValues[0].length]; for (int i=0; i

	 * y-value = y-offset + (column-index * y-interval)
	 * 
* *

The y-interval defines the gap between each y-value and the y-offset * is applied to each value to offset them all from zero. * *

Alternatively the y-values can be set more directly with the * setYValues(Object[]) method. * * @param yOffset an offset value to be applied to the index of each z-value * element. * @param yInterval an interval that will separate each y-value item. */ public void setYValues(double yOffset, double yInterval) { // Update the y-values according to the offset and interval. yValues = new Object[zValues.length]; for (int i=0; isetXValues(Object[]) or that was generated from the offset * and interval that were given to setXValues(double, double), * in which case the object type of each element will be Double. * * @return an array of the values that are to be displayed along the x-axis. */ public Object[] getXValues() { return xValues; } /** * Returns the y-values which are currently set to display along the y-axis. * The array that is returned is either that which was explicitly set with * setYValues(Object[]) or that was generated from the offset * and interval that were given to setYValues(double, double), * in which case the object type of each element will be Double. * * @return an array of the values that are to be displayed along the y-axis. */ public Object[] getYValues() { return yValues; } /** * Sets whether the text of the values along the x-axis should be drawn * horizontally left-to-right, or vertically top-to-bottom. * * @param xValuesHorizontal true if x-values should be drawn horizontally, * false if they should be drawn vertically. */ public void setXValuesHorizontal(boolean xValuesHorizontal) { this.xValuesHorizontal = xValuesHorizontal; } /** * Returns whether the text of the values along the x-axis are to be drawn * horizontally left-to-right, or vertically top-to-bottom. * * @return true if the x-values will be drawn horizontally, false if they * will be drawn vertically. */ public boolean isXValuesHorizontal() { return xValuesHorizontal; } /** * Sets whether the text of the values along the y-axis should be drawn * horizontally left-to-right, or vertically top-to-bottom. * * @param yValuesHorizontal true if y-values should be drawn horizontally, * false if they should be drawn vertically. */ public void setYValuesHorizontal(boolean yValuesHorizontal) { this.yValuesHorizontal = yValuesHorizontal; } /** * Returns whether the text of the values along the y-axis are to be drawn * horizontally left-to-right, or vertically top-to-bottom. * * @return true if the y-values will be drawn horizontally, false if they * will be drawn vertically. */ public boolean isYValuesHorizontal() { return yValuesHorizontal; } /** * Sets the width of each individual cell that constitutes a value in x,y,z * data space. By setting the cell width, any previously set chart width * will be overwritten with a value calculated based upon this value and the * number of cells in there are along the x-axis. * * @param cellWidth the new width to use for each individual data cell. * @deprecated As of release 0.6, replaced by {@link #setCellSize(Dimension)} */ @Deprecated public void setCellWidth(int cellWidth) { setCellSize(new Dimension(cellWidth, cellSize.height)); } /** * Returns the width of each individual data cell that constitutes a value * in the x,y,z space. * * @return the width of each cell. * @deprecated As of release 0.6, replaced by {@link #getCellSize} */ @Deprecated public int getCellWidth() { return cellSize.width; } /** * Sets the height of each individual cell that constitutes a value in x,y,z * data space. By setting the cell height, any previously set chart height * will be overwritten with a value calculated based upon this value and the * number of cells in there are along the y-axis. * * @param cellHeight the new height to use for each individual data cell. * @deprecated As of release 0.6, replaced by {@link #setCellSize(Dimension)} */ @Deprecated public void setCellHeight(int cellHeight) { setCellSize(new Dimension(cellSize.width, cellHeight)); } /** * Returns the height of each individual data cell that constitutes a value * in the x,y,z space. * * @return the height of each cell. * @deprecated As of release 0.6, replaced by {@link #getCellSize()} */ @Deprecated public int getCellHeight() { return cellSize.height; } /** * Sets the size of each individual cell that constitutes a value in x,y,z * data space. By setting the cell size, any previously set chart size will * be overwritten with a value calculated based upon this value and the * number of cells along each axis. * * @param cellSize the new size to use for each individual data cell. * @since 0.6 */ public void setCellSize(Dimension cellSize) { this.cellSize = cellSize; } /** * Returns the size of each individual data cell that constitutes a value in * the x,y,z space. * * @return the size of each individual data cell. * @since 0.6 */ public Dimension getCellSize() { return cellSize; } /** * Returns the width of the chart in pixels as calculated according to the * cell dimensions, chart margin and other size settings. * * @return the width in pixels of the chart image to be generated. * @deprecated As of release 0.6, replaced by {@link #getChartSize()} */ @Deprecated public int getChartWidth() { return chartSize.width; } /** * Returns the height of the chart in pixels as calculated according to the * cell dimensions, chart margin and other size settings. * * @return the height in pixels of the chart image to be generated. * @deprecated As of release 0.6, replaced by {@link #getChartSize()} */ @Deprecated public int getChartHeight() { return chartSize.height; } /** * Returns the size of the chart in pixels as calculated according to the * cell dimensions, chart margin and other size settings. * * @return the size in pixels of the chart image to be generated. * @since 0.6 */ public Dimension getChartSize() { return chartSize; } /** * Returns the String that will be used as the title of any successive * calls to generate a chart. * * @return the title of the chart. */ public String getTitle() { return title; } /** * Sets the String that will be used as the title of any successive * calls to generate a chart. The title will be displayed centralised * horizontally at the top of any generated charts. * *

* If the title is set to null then no title will be displayed. * *

* Defaults to null. * * @param title the chart title to set. */ public void setTitle(String title) { this.title = title; } /** * Returns the String that will be displayed as a description of the * x-axis in any generated charts. * * @return the display label describing the x-axis. */ public String getXAxisLabel() { return xAxisLabel; } /** * Sets the String that will be displayed as a description of the * x-axis in any generated charts. The label will be displayed * horizontally central of the x-axis bar. * *

* If the xAxisLabel is set to null then no label will be * displayed. * *

* Defaults to null. * * @param xAxisLabel the label to be displayed describing the x-axis. */ public void setXAxisLabel(String xAxisLabel) { this.xAxisLabel = xAxisLabel; } /** * Returns the String that will be displayed as a description of the * y-axis in any generated charts. * * @return the display label describing the y-axis. */ public String getYAxisLabel() { return yAxisLabel; } /** * Sets the String that will be displayed as a description of the * y-axis in any generated charts. The label will be displayed * horizontally central of the y-axis bar. * *

* If the yAxisLabel is set to null then no label will be * displayed. * *

* Defaults to null. * * @param yAxisLabel the label to be displayed describing the y-axis. */ public void setYAxisLabel(String yAxisLabel) { this.yAxisLabel = yAxisLabel; } /** * Returns the width of the margin in pixels to be left as empty space * around the heat map element. * * @return the size of the margin to be left blank around the edge of the * chart. */ public int getChartMargin() { return margin; } /** * Sets the width of the margin in pixels to be left as empty space around * the heat map element. If a title is set then half the margin will be * directly above the title and half directly below it. Where axis labels * are set then the axis labels may sit partially in the margin. * *

* Defaults to 20 pixels. * * @param margin the new margin to be left as blank space around the heat * map. */ public void setChartMargin(int margin) { this.margin = margin; } /** * Returns an object that represents the colour to be used as the * background for the whole chart. * * @return the colour to be used to fill the chart background. */ public Color getBackgroundColour() { return backgroundColour; } /** * Sets the colour to be used on the background of the chart. A transparent * background can be set by setting a background colour with an alpha value. * The transparency will only be effective when the image is saved as a png * or gif. * *

* Defaults to Color.WHITE. * * @param backgroundColour the new colour to be set as the background fill. */ public void setBackgroundColour(Color backgroundColour) { if (backgroundColour == null) { backgroundColour = Color.WHITE; } this.backgroundColour = backgroundColour; } /** * Returns the Font that describes the visual style of the * title. * * @return the Font that will be used to render the title. */ public Font getTitleFont() { return titleFont; } /** * Sets a new Font to be used in rendering the chart's title * String. * *

* Defaults to Sans-Serif, BOLD, 16 pixels. * * @param titleFont the Font that should be used when rendering the chart * title. */ public void setTitleFont(Font titleFont) { this.titleFont = titleFont; } /** * Returns the Color that represents the colour the title text * should be painted in. * * @return the currently set colour to be used in painting the chart title. */ public Color getTitleColour() { return titleColour; } /** * Sets the Color that describes the colour to be used for the * chart title String. * *

* Defaults to Color.BLACK. * * @param titleColour the colour to paint the chart's title String. */ public void setTitleColour(Color titleColour) { this.titleColour = titleColour; } /** * Returns the width of the axis bars in pixels. Both axis bars have the * same thickness. * * @return the thickness of the axis bars in pixels. */ public int getAxisThickness() { return axisThickness; } /** * Sets the width of the axis bars in pixels. Both axis bars use the same * thickness. * *

* Defaults to 2 pixels. * * @param axisThickness the thickness to use for the axis bars in any newly * generated charts. */ public void setAxisThickness(int axisThickness) { this.axisThickness = axisThickness; } /** * Returns the colour that is set to be used for the axis bars. Both axis * bars use the same colour. * * @return the colour in use for the axis bars. */ public Color getAxisColour() { return axisColour; } /** * Sets the colour to be used on the axis bars. Both axis bars use the same * colour. * *

* Defaults to Color.BLACK. * * @param axisColour the colour to be set for use on the axis bars. */ public void setAxisColour(Color axisColour) { this.axisColour = axisColour; } /** * Returns the font that describes the visual style of the labels of the * axis. Both axis' labels use the same font. * * @return the font used to define the visual style of the axis labels. */ public Font getAxisLabelsFont() { return axisLabelsFont; } /** * Sets the font that describes the visual style of the axis labels. Both * axis' labels use the same font. * *

* Defaults to Sans-Serif, PLAIN, 12 pixels. * * @param axisLabelsFont the font to be used to define the visual style of * the axis labels. */ public void setAxisLabelsFont(Font axisLabelsFont) { this.axisLabelsFont = axisLabelsFont; } /** * Returns the current colour of the axis labels. Both labels use the same * colour. * * @return the colour of the axis label text. */ public Color getAxisLabelColour() { return axisLabelColour; } /** * Sets the colour of the text displayed as axis labels. Both labels use * the same colour. * *

* Defaults to Color.BLACK. * * @param axisLabelColour the colour to use for the axis label text. */ public void setAxisLabelColour(Color axisLabelColour) { this.axisLabelColour = axisLabelColour; } /** * Returns the font which describes the visual style of the axis values. * The axis values are those values displayed alongside the axis bars at * regular intervals. Both axis use the same font. * * @return the font in use for the axis values. */ public Font getAxisValuesFont() { return axisValuesFont; } /** * Sets the font which describes the visual style of the axis values. The * axis values are those values displayed alongside the axis bars at * regular intervals. Both axis use the same font. * *

* Defaults to Sans-Serif, PLAIN, 10 pixels. * * @param axisValuesFont the font that should be used for the axis values. */ public void setAxisValuesFont(Font axisValuesFont) { this.axisValuesFont = axisValuesFont; } /** * Returns the colour of the axis values as they will be painted along the * axis bars. Both axis use the same colour. * * @return the colour of the values displayed along the axis bars. */ public Color getAxisValuesColour() { return axisValuesColour; } /** * Sets the colour to be used for the axis values as they will be painted * along the axis bars. Both axis use the same colour. * *

* Defaults to Color.BLACK. * * @param axisValuesColour the new colour to be used for the axis bar values. */ public void setAxisValuesColour(Color axisValuesColour) { this.axisValuesColour = axisValuesColour; } /** * Returns the frequency of the values displayed along the x-axis. The * frequency is how many columns in the x-dimension have their value * displayed. A frequency of 2 would mean every other column has a value * shown and a frequency of 3 would mean every third column would be given a * value. * * @return the frequency of the values displayed against columns. */ public int getXAxisValuesFrequency() { return xAxisValuesFrequency; } /** * Sets the frequency of the values displayed along the x-axis. The * frequency is how many columns in the x-dimension have their value * displayed. A frequency of 2 would mean every other column has a value and * a frequency of 3 would mean every third column would be given a value. * *

* Defaults to 1. Every column is given a value. * * @param axisValuesFrequency the frequency of the values displayed against * columns, where 1 is every column and 2 is every other column. */ public void setXAxisValuesFrequency(int axisValuesFrequency) { this.xAxisValuesFrequency = axisValuesFrequency; } /** * Returns the frequency of the values displayed along the y-axis. The * frequency is how many rows in the y-dimension have their value displayed. * A frequency of 2 would mean every other row has a value and a frequency * of 3 would mean every third row would be given a value. * * @return the frequency of the values displayed against rows. */ public int getYAxisValuesFrequency() { return yAxisValuesFrequency; } /** * Sets the frequency of the values displayed along the y-axis. The * frequency is how many rows in the y-dimension have their value displayed. * A frequency of 2 would mean every other row has a value and a frequency * of 3 would mean every third row would be given a value. * *

* Defaults to 1. Every row is given a value. * * @param axisValuesFrequency the frequency of the values displayed against * rows, where 1 is every row and 2 is every other row. */ public void setYAxisValuesFrequency(int axisValuesFrequency) { yAxisValuesFrequency = axisValuesFrequency; } /** * Returns whether axis values are to be shown at all for the x-axis. * *

* If axis values are not shown then more space is allocated to the heat * map. * * @return true if the x-axis values will be displayed, false otherwise. */ public boolean isShowXAxisValues() { //TODO Could get rid of these flags and use a frequency of -1 to signal no values. return showXAxisValues; } /** * Sets whether axis values are to be shown at all for the x-axis. * *

* If axis values are not shown then more space is allocated to the heat * map. * *

* Defaults to true. * * @param showXAxisValues true if x-axis values should be displayed, false * if they should be hidden. */ public void setShowXAxisValues(boolean showXAxisValues) { this.showXAxisValues = showXAxisValues; } /** * Returns whether axis values are to be shown at all for the y-axis. * *

* If axis values are not shown then more space is allocated to the heat * map. * * @return true if the y-axis values will be displayed, false otherwise. */ public boolean isShowYAxisValues() { return showYAxisValues; } /** * Sets whether axis values are to be shown at all for the y-axis. * *

* If axis values are not shown then more space is allocated to the heat * map. * *

* Defaults to true. * * @param showYAxisValues true if y-axis values should be displayed, false * if they should be hidden. */ public void setShowYAxisValues(boolean showYAxisValues) { this.showYAxisValues = showYAxisValues; } /** * Returns the colour that is currently to be displayed for the heat map * cells with the highest z-value in the dataset. * *

* The full colour range will go through each RGB step between the high * value colour and the low value colour. * * @return the colour in use for cells of the highest z-value. */ public Color getHighValueColour() { return highValueColour; } /** * Sets the colour to be used to fill cells of the heat map with the * highest z-values in the dataset. * *

* The full colour range will go through each RGB step between the high * value colour and the low value colour. * *

* Defaults to Color.BLACK. * * @param highValueColour the colour to use for cells of the highest * z-value. */ public void setHighValueColour(Color highValueColour) { this.highValueColour = highValueColour; updateColourDistance(); } /** * Returns the colour that is currently to be displayed for the heat map * cells with the lowest z-value in the dataset. * *

* The full colour range will go through each RGB step between the high * value colour and the low value colour. * * @return the colour in use for cells of the lowest z-value. */ public Color getLowValueColour() { return lowValueColour; } /** * Sets the colour to be used to fill cells of the heat map with the * lowest z-values in the dataset. * *

* The full colour range will go through each RGB step between the high * value colour and the low value colour. * *

* Defaults to Color.WHITE. * * @param lowValueColour the colour to use for cells of the lowest * z-value. */ public void setLowValueColour(Color lowValueColour) { this.lowValueColour = lowValueColour; updateColourDistance(); } /** * Returns the scale that is currently in use to map z-value to colour. A * value of 1.0 will give a linear scale, which will * spread the distribution of colours evenly amoungst the full range of * represented z-values. A value of greater than 1.0 will give an * exponential scale that will produce greater emphasis * for the separation between higher values and a value between 0.0 and 1.0 * will provide a logarithmic scale, with greater * separation of low values. * * @return the scale factor that is being used to map from z-value to colour. */ public double getColourScale() { return colourScale; } /** * Sets the scale that is currently in use to map z-value to colour. A * value of 1.0 will give a linear scale, which will * spread the distribution of colours evenly amoungst the full range of * represented z-values. A value of greater than 1.0 will give an * exponential scale that will produce greater emphasis * for the separation between higher values and a value between 0.0 and 1.0 * will provide a logarithmic scale, with greater * separation of low values. Values of 0.0 or less are illegal. * *

* Defaults to a linear scale value of 1.0. * * @param colourScale the scale that should be used to map from z-value to * colour. */ public void setColourScale(double colourScale) { this.colourScale = colourScale; } /* * Calculate and update the field for the distance between the low colour * and high colour. The distance is the number of steps between one colour * and the other using an RGB coding with 0-255 values for each of red, * green and blue. So the maximum colour distance is 255 + 255 + 255. */ private void updateColourDistance() { int r1 = lowValueColour.getRed(); int g1 = lowValueColour.getGreen(); int b1 = lowValueColour.getBlue(); int r2 = highValueColour.getRed(); int g2 = highValueColour.getGreen(); int b2 = highValueColour.getBlue(); colourValueDistance = Math.abs(r1 - r2); colourValueDistance += Math.abs(g1 - g2); colourValueDistance += Math.abs(b1 - b2); } /** * Generates a new chart Image based upon the currently held * settings and then attempts to save that image to disk, to the location * provided as a File parameter. The image type of the saved file will * equal the extension of the filename provided, so it is essential that a * suitable extension be included on the file name. * *

* All supported ImageIO file types are supported, including * PNG, JPG and GIF. * *

* No chart will be generated until this or the related * getChartImage() method are called. All successive calls * will result in the generation of a new chart image, no caching is used. * * @param outputFile the file location that the generated image file should * be written to. The File must have a suitable filename, with an extension * of a valid image format (as supported by ImageIO). * @throws IOException if the output file's filename has no extension or * if there the file is unable to written to. Reasons for this include a * non-existant file location (check with the File exists() method on the * parent directory), or the permissions of the write location may be * incorrect. */ public void saveToFile(File outputFile) throws IOException { String filename = outputFile.getName(); int extPoint = filename.lastIndexOf('.'); if (extPoint < 0) { throw new IOException("Illegal filename, no extension used."); } // Determine the extension of the filename. String ext = filename.substring(extPoint + 1); // Handle jpg without transparency. if (ext.toLowerCase().equals("jpg") || ext.toLowerCase().equals("jpeg")) { BufferedImage chart = (BufferedImage) getChartImage(false); // Save our graphic. saveGraphicJpeg(chart, outputFile, 1.0f); } else { BufferedImage chart = (BufferedImage) getChartImage(true); ImageIO.write(chart, ext, outputFile); } } private void saveGraphicJpeg(BufferedImage chart, File outputFile, float quality) throws IOException { // Setup correct compression for jpeg. Iterator iter = ImageIO.getImageWritersByFormatName("jpeg"); ImageWriter writer = (ImageWriter) iter.next(); ImageWriteParam iwp = writer.getDefaultWriteParam(); iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); iwp.setCompressionQuality(quality); // Output the image. FileImageOutputStream output = new FileImageOutputStream(outputFile); writer.setOutput(output); IIOImage image = new IIOImage(chart, null, null); writer.write(null, image, iwp); writer.dispose(); } /** * Generates and returns a new chart Image configured * according to this object's currently held settings. The given parameter * determines whether transparency should be enabled for the generated * image. * *

* No chart will be generated until this or the related * saveToFile(File) method are called. All successive calls * will result in the generation of a new chart image, no caching is used. * * @param alpha whether to enable transparency. * @return A newly generated chart Image. The returned image * is a BufferedImage. */ public Image getChartImage(boolean alpha) { // Calculate all unknown dimensions. measureComponents(); updateCoordinates(); // Determine image type based upon whether require alpha or not. // Using BufferedImage.TYPE_INT_ARGB seems to break on jpg. int imageType = (alpha ? BufferedImage.TYPE_4BYTE_ABGR : BufferedImage.TYPE_3BYTE_BGR); // Create our chart image which we will eventually draw everything on. BufferedImage chartImage = new BufferedImage(chartSize.width, chartSize.height, imageType); Graphics2D chartGraphics = chartImage.createGraphics(); // Use anti-aliasing where ever possible. chartGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Set the background. chartGraphics.setColor(backgroundColour); chartGraphics.fillRect(0, 0, chartSize.width, chartSize.height); // Draw the title. drawTitle(chartGraphics); // Draw the heatmap image. drawHeatMap(chartGraphics, zValues); // Draw the axis labels. drawXLabel(chartGraphics); drawYLabel(chartGraphics); // Draw the axis bars. drawAxisBars(chartGraphics); // Draw axis values. drawXValues(chartGraphics); drawYValues(chartGraphics); return chartImage; } /** * Generates and returns a new chart Image configured * according to this object's currently held settings. By default the image * is generated with no transparency. * *

* No chart will be generated until this or the related * saveToFile(File) method are called. All successive calls * will result in the generation of a new chart image, no caching is used. * * @return A newly generated chart Image. The returned image * is a BufferedImage. */ public Image getChartImage() { return getChartImage(false); } /* * Calculates all unknown component dimensions. */ private void measureComponents() { //TODO This would be a good place to check that all settings have sensible values or throw illegal state exception. //TODO Put this somewhere so it only gets created once. BufferedImage chartImage = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); Graphics2D tempGraphics = chartImage.createGraphics(); // Calculate title dimensions. if (title != null) { tempGraphics.setFont(titleFont); FontMetrics metrics = tempGraphics.getFontMetrics(); titleSize = new Dimension(metrics.stringWidth(title), metrics.getHeight()); titleAscent = metrics.getAscent(); } else { titleSize = new Dimension(0, 0); } // Calculate x-axis label dimensions. if (xAxisLabel != null) { tempGraphics.setFont(axisLabelsFont); FontMetrics metrics = tempGraphics.getFontMetrics(); xAxisLabelSize = new Dimension(metrics.stringWidth(xAxisLabel), metrics.getHeight()); xAxisLabelDescent = metrics.getDescent(); } else { xAxisLabelSize = new Dimension(0, 0); } // Calculate y-axis label dimensions. if (yAxisLabel != null) { tempGraphics.setFont(axisLabelsFont); FontMetrics metrics = tempGraphics.getFontMetrics(); yAxisLabelSize = new Dimension(metrics.stringWidth(yAxisLabel), metrics.getHeight()); yAxisLabelAscent = metrics.getAscent(); } else { yAxisLabelSize = new Dimension(0, 0); } // Calculate x-axis value dimensions. if (showXAxisValues) { tempGraphics.setFont(axisValuesFont); FontMetrics metrics = tempGraphics.getFontMetrics(); xAxisValuesHeight = metrics.getHeight(); xAxisValuesWidthMax = 0; for (Object o: xValues) { int w = metrics.stringWidth(o.toString()); if (w > xAxisValuesWidthMax) { xAxisValuesWidthMax = w; } } } else { xAxisValuesHeight = 0; } // Calculate y-axis value dimensions. if (showYAxisValues) { tempGraphics.setFont(axisValuesFont); FontMetrics metrics = tempGraphics.getFontMetrics(); yAxisValuesHeight = metrics.getHeight(); yAxisValuesAscent = metrics.getAscent(); yAxisValuesWidthMax = 0; for (Object o: yValues) { int w = metrics.stringWidth(o.toString()); if (w > yAxisValuesWidthMax) { yAxisValuesWidthMax = w; } } } else { yAxisValuesHeight = 0; } // Calculate heatmap dimensions. int heatMapWidth = (zValues[0].length * cellSize.width); int heatMapHeight = (zValues.length * cellSize.height); heatMapSize = new Dimension(heatMapWidth, heatMapHeight); int yValuesHorizontalSize = 0; if (yValuesHorizontal) { yValuesHorizontalSize = yAxisValuesWidthMax; } else { yValuesHorizontalSize = yAxisValuesHeight; } int xValuesVerticalSize = 0; if (xValuesHorizontal) { xValuesVerticalSize = xAxisValuesHeight; } else { xValuesVerticalSize = xAxisValuesWidthMax; } // Calculate chart dimensions. int chartWidth = heatMapWidth + (2 * margin) + yAxisLabelSize.height + yValuesHorizontalSize + axisThickness; int chartHeight = heatMapHeight + (2 * margin) + xAxisLabelSize.height + xValuesVerticalSize + titleSize.height + axisThickness; chartSize = new Dimension(chartWidth, chartHeight); } /* * Calculates the co-ordinates of some key positions. */ private void updateCoordinates() { // Top-left of heat map. int x = margin + axisThickness + yAxisLabelSize.height; x += (yValuesHorizontal ? yAxisValuesWidthMax : yAxisValuesHeight); int y = titleSize.height + margin; heatMapTL = new Point(x, y); // Top-right of heat map. x = heatMapTL.x + heatMapSize.width; y = heatMapTL.y + heatMapSize.height; heatMapBR = new Point(x, y); // Centre of heat map. x = heatMapTL.x + (heatMapSize.width / 2); y = heatMapTL.y + (heatMapSize.height / 2); heatMapC = new Point(x, y); } /* * Draws the title String on the chart if title is not null. */ private void drawTitle(Graphics2D chartGraphics) { if (title != null) { // Strings are drawn from the baseline position of the leftmost char. int yTitle = (margin/2) + titleAscent; int xTitle = (chartSize.width/2) - (titleSize.width/2); chartGraphics.setFont(titleFont); chartGraphics.setColor(titleColour); chartGraphics.drawString(title, xTitle, yTitle); } } /* * Creates the actual heatmap element as an image, that can then be drawn * onto a chart. */ private void drawHeatMap(Graphics2D chartGraphics, double[][] data) { // Calculate the available size for the heatmap. int noYCells = data.length; int noXCells = data[0].length; //double dataMin = min(data); //double dataMax = max(data); BufferedImage heatMapImage = new BufferedImage(heatMapSize.width, heatMapSize.height, BufferedImage.TYPE_INT_ARGB); Graphics2D heatMapGraphics = heatMapImage.createGraphics(); for (int x=0; x 0) { chartGraphics.setColor(axisColour); // Draw x-axis. int x = heatMapTL.x - axisThickness; int y = heatMapBR.y; int width = heatMapSize.width + axisThickness; int height = axisThickness; chartGraphics.fillRect(x, y, width, height); // Draw y-axis. x = heatMapTL.x - axisThickness; y = heatMapTL.y; width = axisThickness; height = heatMapSize.height; chartGraphics.fillRect(x, y, width, height); } } /* * Draws the x-values onto the x-axis if showXAxisValues is set to true. */ private void drawXValues(Graphics2D chartGraphics) { if (!showXAxisValues) { return; } chartGraphics.setColor(axisValuesColour); for (int i=0; i= Math.abs(gDistance)) && (Math.abs(rDistance) >= Math.abs(bDistance))) { // Red must be the largest. r = changeColourValue(r, rDistance); } else if (Math.abs(gDistance) >= Math.abs(bDistance)) { // Green must be the largest. g = changeColourValue(g, gDistance); } else { // Blue must be the largest. b = changeColourValue(b, bDistance); } } return new Color(r, g, b); } /* * Returns how many colour shifts are required from the lowValueColour to * get to the correct colour position. The result will be different * depending on the colour scale used: LINEAR, LOGARITHMIC, EXPONENTIAL. */ private int getColourPosition(double percentPosition) { return (int) Math.round(colourValueDistance * Math.pow(percentPosition, colourScale)); } private int changeColourValue(int colourValue, int colourDistance) { if (colourDistance < 0) { return colourValue+1; } else if (colourDistance > 0) { return colourValue-1; } else { // This shouldn't actually happen here. return colourValue; } } /** * Finds and returns the maximum value in a 2-dimensional array of doubles. * * @return the largest value in the array. */ public static double max(double[][] values) { double max = 0; for (int i=0; i max) ? values[i][j] : max; } } return max; } /** * Finds and returns the minimum value in a 2-dimensional array of doubles. * * @return the smallest value in the array. */ public static double min(double[][] values) { double min = Double.MAX_VALUE; for (int i=0; i