javascript - Generating highcharts in ajax call -


i have problem using highcharts libraries , ajax. have created various charts custom visualization tool available in jaspersoft studio, time need call webservice injects data in table , parse soap response before displaying chart. highchart code called in complete parameter of ajax. when running jasperreports report embedding js module i've got error "typeerror: renderer not function" if library not visible ajax. tried include highchart code in function , call parameter complete still same. note i've separated web service call , generation of chart , works. except necessary execute reports twice first time successully inject data displays chart empty. (script 2 bellow)

thanks in advance !

script 1:     define(['jquery','highcharts-all'], function ($) {     var url = "url";     $.ajax({         url: url,          type: "get",         success: function  (data) {                     var $xml = $( data ),                     $result = $xml.find('runjobreturn').text();                     console.log($result);                     if($result === "0") {console.log("ok")}                                          else alert("fail")         },         complete: function (instancedata) {                       var chart;                 var series0 = instancedata.series[0],                 main_data = [], // structure                  ...                             chart = new highcharts.chart({                 chart: {                 type: 'column',                 renderto: instancedata.id                    },                 credits: {  script 2:     define(['jquery','highcharts-all'], function ($) {     var url = "url";     $.ajax({         url: url,          type: "get",         success: function  (data) {             var $xml = $( data ),             $result = $xml.find('runjobreturn').text();             console.log($result);             if($result === "0") {console.log("ok")} else alert("fail")         }                });       return function (instancedata) {              var chart;         var series0 = instancedata.series[0],         main_data = [], // structure          ...          chart = new highcharts.chart({                     chart: {                         type: 'column',                         renderto: instancedata.id                        },                     credits: { 


Comments