Forum Stats

  • 3,827,605 Users
  • 2,260,798 Discussions
  • 7,897,313 Comments

Discussions

How to save APEX4.2 Chart to image file automatically


Hello

I have created two flash charts ( namely "Chart1" and "Chart2") on a single APEX page (version 4.2).  Each chart needs to be saved as a separate image file ( *.PNG ) to a fixed directory  of user's PC ( e.g. P:\APEX_Charts\).

Is there a way to achieve the following

(1) The file name should be called "Chart1.png" or "Chart2.png" ( instead of the default Anychart.png)

(2) The two charts can be saved automatically using the names from (1), as soon as the user clicks on a button ( which invokes dynamic action).

How to achieve this auto-save functionality without manually right clicking on the individual chart then choosing the "Save as Image" option ?

To start with, I tried to save the Chart1 first,  I put the following code in the APEX dynamic action ( "Exceute JavaScript Code" )  asscociated to the button click.

          var chart_to_be_saved = AnyChart.getChartById($("#Chart1 object").attr("id"));

          chart_to_be_saved.setXMLFile("Chart1.xml");

          function() { saveChartAsImage(chart_to_be_saved);};

          chart_to_be_saved.write("chart_container");

But it didn't work.  I received error message : "'null' is null or not an object ..... ) .  How to fix this ?


Thanks for your advice.

Susanna

Tagged:
This discussion has been closed.