Sign in to follow this  
siwel_nerrad

Retrieve Chart Data

Recommended Posts

Hi,

I have bound a powerchart to some XML and it displays the chart fine. What I now want to do is to retrieve the current XML data back from the chart but I cannot seem to get this working. I have viewed the online demo at http://www.fusioncharts.com/Demos/ScatterReturn/Default.html and that is what I want to achieve, but when I download the source it doesn't work.

I am programming this in ASP.net 2.0 and C# using masterpages and here is my code:

 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script language="JavaScript" src="<%=Request.ApplicationPath %>/Javascript/FusionCharts.js"></script> 
<script language="JavaScript">
/**
* readXMLFromChart() method is called when the user pressed the
* button to return XML data
*/
function test()
{
//Get a reference to our chart
var ourChart = getChartFromId("SelectChart");
//Get the data from chart 
var xmlRtn = ourChart.getXMLData();
//Show it to user in alert box.
alert(xmlRtn);
}
</script>
<table width='98%' border ='0' cellspacing='0' cellpadding='3' align='center'>
<tr>
<td valign='top' class ='text' align='center'>



<div id="chartdiv" align="center"> 
FusionCharts.
</div>
<script type="text/javascript">
var chart = new FusionCharts("DragNode.swf", "SelectChart", "550", "400", "0", "1");
chart.setDataXML("<%=XmlFC %>"); 
chart.render("chartdiv");
</script>
</td>
</tr>
<tr>
<td>
<input id="Button1" type="button" value="button" onclick="test();" />


</td> 
</tr>
</table>
</asp:Content>

Any suggestions??

Share this post


Link to post
Share on other sites

Hi,

I'm having the same problem. I'm getting "object doesnot support this method" java script error when accessing getXMLData() method.

Any help?

Regards,

Anand

Share this post


Link to post
Share on other sites

Hi... first sorry by my english.. :P..  I speak spanish.. but i'll try to response this question..

this is the trick...

when you create the chart..  you set the values...

swfpath, graphname, width, heigth, DEBUG, this last one makes you can retreive the XML with getXML()..

 

var chart = new FusionCharts("swfpath", "graphname", w, h, "0", "1" );

this method don't work with all the charts..

SALUDOS!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this