skip to Main Content
var xyz = chart.exporting.getImage("png").then(function (imgdata) {

});

The above function xyz is a promising object how to get whether the object is full filled or not
based on the promiseStatus,refer the picture .

After full filled i want to execute the below code

   var image = imgdata.replace('data:image/png;base64,', '');


                    jQuery.ajax({

                                type: "POST",
                                contentType: "application/json; charset=utf-8",
                                url: "VATReportGeneration.aspx/SetImageInSession",
                                data: JSON.stringify({ "image": image }),
                                dataType: "json",
                                success: function (data) {

                                    if (data != '') {
                                        jQuery.ajax({
                                            type: 'POST',
                                            cache: false,
                                            url: file,
                                            success: function (data) {

                                                url = '';
                                                url = "../../ReportHandler/VATConfigurationFileHandler.aspx";
                                                file = '';
                                                file = url + "?ReportByte=1";
                                                $get("exporthandler").src = file;
                                                chart.dispose();
                                                document.getElementById('loading').style.display = "none";
                                                //document.getElementById('loading').style.display = "none";
                                            },
                                            error: function (data) {

                                                //document.getElementById('loading').style.display = "none";
                                            }
                                        });
                                    }

                                }

                    });

Console executed when the promising object is full filled. please help me. Thanks in advance.

2

Answers


  1. Chosen as BEST ANSWER

    I finally got answer from my colleague by passing a chart object to a callback function from call back function I have converted the chart to 64basestring.


  2. Write your image data imgdata handling logic code inside .then

    More here: https://www.amcharts.com/docs/v4/concepts/exporting/#Triggering_export

      chart.exporting.getImage("png").then(function (imgdata) {
         var image = imgdata.replace('data:image/png;base64,', '');
         //your ajax call and other logic here
         ......
         .......
       }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search