Pramod
Pramod

Reputation: 2896

google.setOnLoadCallback(drawChart);

I have google chart on my page, but right now chart is drawn when Google Visualization library is loaded on the page load, and I have to give data dynamically through ajax, so is it possible to change the callback method, or is there any alternative?

Upvotes: 2

Views: 4561

Answers (2)

Pramod
Pramod

Reputation: 2896

I managed with it as i wanted, It can be helpful for someone, and if there is better solution for this please do suggest.

  1. I removed this setOnLoadCallback function - google.setOnLoadCallback(drawChart); This call back will call the drawChart() as soon as the visulization library is loaded, (but I didn't wanted it, i wanted to call it on button click).

  2. so I called drawChart(); function directily in the button click function code.

  3. Then I faced problem with rendering the dynamic data to the datatable, when I was putting hard coded values, the chart drawn fine, but as I put variables instead of those values, it was unable to generate chart.

  4. so i parsed the variable into integer by parseInt(doc_pre), And it worked fine.

Upvotes: 5

Mennan
Mennan

Reputation: 4497

You can check this :

Jquery Charts

Upvotes: -1

Related Questions