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.
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