javascript - Reuse function to load data into Highchart -


i have highchart object , function load data:

graficapropuestas = new highcharts.chart({         chart: {             height: 300,             renderto: "graficapropuestas",             plotbackgroundcolor: null,             plotborderwidth: null,             plotshadow: false,             events: {                 load: recogerdatosinforme('propuesta', $(this))             }         }  }) 

and function load data:

function recogerdatosinforme(tipo, gr) {         $.ajax({             url: '/licencia/recogerdatosusuariossistema?tipo' + tipo,             datatype: "json",             success: function(data) {                 gr.series[0].setdata(data);             },             cache: false         });     } 

i want pass graficapropuestas object function can reuse same function load more graphs, cant work. if put in function directly graficapropuestas object on success: method work well.

any appreciated.

if have 1 instance of graficapropuestas better , more efficient use solution:

var graficapropuestas = new highcharts.chart( ...   function recogerdatosinforme(tipo) {         $.ajax({             url: '/licencia/recogerdatosusuariossistema?tipo' + tipo,             datatype: "json",             success: function(data) {                 graficapropuestas.series[0].setdata(data);             },             cache: false         });     } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -