ChartDirector for Perl requires at least Perl 5.004_02, and has been tested up to Perl 5.32 (the latest Perl release as of the date of this document).
ChartDirector for Perl does not require installation. Simply extract the ChartDirector for Perl download to a directory to use it.
ChartDirector for Perl comes with numerous sample Perl scripts under the "ChartDirector/perldemo" and "ChartDirector/perldemo_cgi" directories. The former is for standalone scripts, while the latter is for CGI scripts. They are good examples and tutorials on how to use ChartDirector.
You may run these sample scripts to verify that ChartDirector is correctly installed.
To run the standalone ChartDirector sample scripts:
- In the command line prompt, change to the "ChartDirector/perldemo" directory.
- Type "perl [script_name]". For example, the command "perl simplebar.pl" should generate a PNG chart image called "simplebar.png".
To run the ChartDirector sample CGI scripts:
- Copy both the "lib" and "perldemo_cgi" directories to your web server's CGI directory.
- Browse the sample scripts by using a browser to access the sample scripts index page "index.pl".
Note for Linux, FreeBSD, Mac OS X and Solaris: All ChartDirector sample scripts assume the Perl interpreter is at "#!/usr/bin/perl
". This is usually correct for Linux, FreeBSD, Mac OS X and Solaris 2.8 or above.
If for some reason, you cannot see the charts, please click on the "check installation" link on main index page. This will perform a diagnostic test and display any error encountered.
To use ChartDirector for Perl in your own script, you would need to include the ChartDirector for Perl module in your code like:
use lib /path/to/module/directory;
use perlchartdir;
In the above, the "/path/to/module/directory" is the directory that contains the ChartDirector for Perl module. The "use lib" statement adds this directory to the Perl module search path so that the Perl interpreter can find the ChartDirector for Perl module "perlchartdir".
In the sample code, the ChartDirector for Perl module is assumed to be located in the "../lib" directory relative to the script, so in the sample code, there are the following lines:
#Add the "../lib" directory to the Perl module search path
use File::Basename;
use lib dirname($0)."/../lib";
#Use the ChartDirector for Perl module
use perlchartdir;
As an alternative to the "use lib" statement, you can copy the ChartDirector for Perl module to a directory in the default Perl module search path. In this way, only one line is needed:
The default Perl module search path can be found by using "perl -V" and looking for the @INC variable. To copy the ChartDirector for Perl module to the directory, you should copy *everything* inside "ChartDirector/lib", including all files and the fonts subdirectory. (Note: The fonts subdirectory is only available for certain operating system editions of ChartDirector.)
If you have purchased a license to use ChartDirector, you should have a license key delivered to your via email and postal mail.
If your license key is for upgrading from a previous version of ChartDirector, you need to append the upgrade license key to the previous version license key, and use the combined license key.
There are two alternative methods to install the license key.
- Create a one-line ASCII file using Notepad or other text editor, and put the license key in that line. The whole file should contain only the license key. Name that file "chartdir.lic" and put the file in the same directory as the active "libchartdir.so" (for Linux, FreeBSD, Mac OS X and Solaris) or "chartdir.dll" (for Windows), which should be in the directory where the ChartDirector for Perl module is installed or copied to.
If the license file appears to have no effect (does not disable the yellow banner line), and you are running on a web server environment, please make sure the web server "anonymous user" has read access to the "chartdir.lic" file. You may copy the file "ChartDirector/perldemo_cgi/cdinfo.pl" to your web server and access it using a browser. It will display a diagnostic page explaining why the license cannot be loaded.
Make sure your license file is called "chartdir.lic". In particular, Notepad may automatically append ".txt" to the file name when creating a new file. So even if the file is saved as "chartdir.lic", it may end up as "chartdir.lic.txt". If this is the case, please rename the file back to "chartdir.lic".
- An alternative method is to hard code the license key into the source code by using the perlchartdir::setLicenseCode API. This method is recommended if your are redistributing ChartDirector, because your customer will then be unable to see the license key (unless your software is open source).
perlchartdir::setLicenseCode(".....your-license-key.....");
© 2017 Advanced Software Engineering Limited. All rights reserved.