ChartDirector 7.0 (Python Edition)
Installation
Python Version Compatibility
ChartDirector for Python requires at least Python 1.5, and has been tested up to Python 3.9 (the latest Python release as of the date of this document).
Installing ChartDirector for Python
ChartDirector for Python does not require installation. Simply extract the ChartDirector for Python download to a directory to use it.
Running ChartDirector Sample Programs
ChartDirector for Python comes with numerous sample Python scripts under the "ChartDirector/pythondemo" directory. 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 ChartDirector sample scripts:
- In the command line prompt, change to the "ChartDirector/pythondemo" directory.
- Type "python [script_name]". For example, the command "python simplebar.py" should generate a PNG chart image called "simplebar.png".
Using ChartDirector for Python in Your Own Scripts
To use ChartDirector for Python in your own script, you would need to include the ChartDirector for Python module in your code like:
import sys
sys.path.insert(0, "/path/to/module/directory")
from pychartdir import *
In the sample code, the ChartDirector for Python 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 Python module search path
import sys, os
sys.path.insert(0, os.path.join(os.path.abspath(sys.path[0]), "..", "lib"))
#Use the ChartDirector for Python module
from pychartdir import *
As an alternative to adding to the Python search path, you can copy the ChartDirector for Python module to a directory in the default Python module search path. In this way, only one line is needed:
from pychartdir import *
The default Python module search path can be obtained by using:
python -c "import sys; print(sys.path)"
To copy the ChartDirector for Python 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.)
Installing the ChartDirector License
If you have purchased a license to use ChartDirector, you should have a license key delivered to your via email and postal mail. Please install the license key as according to the following instructions.
Even without a license key, ChartDirector will work normally, but the charts will include a yellow bar at the bottom that marks the charts as produced by the "unregistered" ChartDirector. You can freely test ChartDirector for as long as necessary.
If your license key is for upgrading from a previous version of ChartDirector, please append the upgrade license key to the previous version license key, and use the combined license key.
ChartDirector Developer License
Please follow the steps below to install the license key for the "ChartDirector Developer License":
- Create an ASCII file using Notepad or other text editor, and put the license key in it. The whole file should contain only the license key. Save the file as "chartdir.lic".
Note that some text editors, such as Notepad, may automatically append ".txt" to the filename. If file is saved as "chartdir.lic", it may end up as "chartdir.lic.txt". In this case, please rename the file back to "chartdir.lic".
- Copy the "chartdir.lic" to the windows directory (normally "c:\windows" on Windows) or the "/etc" directory (for Linux/macOS).
The above directory is a system directory and may require administrative privileges for write access. If you are copying using the command prompt, please make sure you use "Run As administrator" to start the command prompt (for Windows), or use "sudo" (for Linux/macOS).
- If you cannot copy to a system directory (eg. due to lack of administrative privilege), you can copy "chartdir.lic" to the same directory as the active "libchartdir.so" (for Linux/macOS) or "chartdir.dll" (for Windows), which should be in the directory where the ChartDirector for Python module is installed or copied to.
The license file should remove the "unregistered" message on the charts. If the license file appears to have no effect, please refer to
http://www.advsofteng.com/license_diag.html for trouble-shooting instructions.
ChartDirector Redistribute License
The "ChartDirector Redistribute License" can be installed using the same method as that of the "ChartDirector Developer License". You can also embed the license key in your code by adding a line to call
pychartdir.setLicenseCode and pass the license key as the argument.
setLicenseCode(".....your-license-key.....")
© 2021 Advanced Software Engineering Limited. All rights reserved.