Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
Please help me on this.. i am currently using the google chart API, all is running well
but then a specs came that the image should be captured,,on this i called the getImageURI()
function of the google chart API,, Calling this function after the chart is ready,, this came from the google : Note: You should wait for the ready event, as shown in the examples on this page, to ensure that the chart has finished rendering.

JavaScript
var my_div = document.getElementById('my_div');
    var my_chart = new google.visualization.ChartType(chart_div);
    var imgUri;
      google.visualization.events.addListener(my_chart, 'ready', function () {
      imgUri = chart.getImageURI();

      document.getElementById("<%= HiddenField1.ClientID%>").value = imgUri;
      });

    my_chart.draw(data);



My HiddenField1 will be populated after the chart is already rendered..or simply speaking when the page is already done loading. this happens when i clicked a preview button.

However my specs indicated that HiddenField1 should be populated right after the print button is clicked, means it should have a value right before it finish rendering the asp page..

Ex current scenario :

Step 1: button preview is clicked --> the hidden field is populated with png string value.
Step 2: button print is clicked --> the hidden field has value so i can print png image.

Expected scenario :
button print is clicked --> on fly right before the page finish loading or the chart is ready, hidden field should already has a value so that i can print a png image.

I hope you can input on this, i read some of the articles on setTimeOut function on javascript, but i can apply it in my code.

Thanks,!
Jayson
Posted
Updated 4-Aug-14 16:30pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900