All amCharts products have a built-in ability to export the chart as an image. The option is shown when the viewer right-clicks on the chart. The function is enabled and configured in the settings file. The "Export as an image" function takes a screenshot of your chart, and posts the image data to a file that generates the image using GD or some other library.
To enable this function, you must set the name of the file to which the image data will be posted. This is done in the settings file:
<export_as_image> <file>ampie/export.php</file>
If a file name has been set here, the "Export as image" menu will appear when a viewer right-clicks on your chart area. After the viewer selects this option, the image data will be collected and posted to the file specified.
You can trigger the "Export as image" function with JavaScript. To do that, call this function:
flashMovie.exportImage("export.php");
The file name in this function is optional, you only need to set it here if you don't set it in the data file.
Check examples/js_example.html for a better understanding how this function is used.
Please Note: This is quite a slow process, and it requires a lot of CPU resources. Also, the amount of data which is being sent to the export file is big. You should consider this if you want this function to be public. If there is a limited number of users who needs to have images of your chart, then you can use third party software, which will make this process much faster, you will also be able to export charts to vector formats. More about this can be found here: saving chart as pdf
| © Antanas Marcelionis Contact and feedback: info@amcharts.com | Subscribe to amCharts news |