stranieroinpatria

Can't Use Javascript Apis

Recommended Posts

Hi all,

I had a problem to use anyone of the api's described in the documentation.The error was always ".... is not a function". I can use just setDataXML and setDataURL.

 

Then I tried to create a very simple page to understand wich is the problem:

 

Include FusionCharts.js v3 and create the function used for clear the chart...

   <head>
       <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
       <title>PulseFCTry</title>
        <script type="text/javascript" src="./custom/js/FusionCharts.js"></script>
        <script type="text/javascript">
            function clearChart(){
               chart=FusionCharts("fusionLineHOST00M");
               chart.clearChart();
           }
        </script>
   </head>

 

...after that I create the Chart and rendered it into a div (flag JS to 1)

 

<body> 
<div id="divprova"></div> 
<script type="text/javascript">

	var myChart = new FusionCharts( "./chart/RealTimeStackedArea.swf" , "fusionLineHOST00M" ,"520","200","0","1");
	myChart.setDataXML('<chart dataStreamURL="/ws/fusionLineUpd?idChart=" refreshInterval="5..........etc.......);

	myChart.render('divprova');

</script>

<input type="button" onclick="clearChart()" value="Submit">
</body>

 

The result on click is "chart.clearChart is not a function"

Why??

post-9421-087420400 1286350104_thumb.png

Share this post


Link to post
Share on other sites

Ah, I understand what you're asking now. Had to read it a few times.

 

Widgets is a whole different kettle of fish. There is a limited JavaScript API that you can read about here. The methods exposed by FusionCharts.js don't apply.

Share this post


Link to post
Share on other sites

Ah, I understand what you're asking now. Had to read it a few times.

 

Widgets is a whole different kettle of fish. There is a limited JavaScript API that you can read about here. The methods exposed by FusionCharts.js don't apply.

 

And how I can clear a chart or stop/restart the updates??

How can I use the Javascript APIs for Widget?They are explained in the documentation so I suppose there are some ways to use them..

Share this post


Link to post
Share on other sites

Are you running the code on a web server or are you trying to do it from the filesystem? Have you tried using getChartFromID and checking in Firebug to see what methods are exposed?

Edited by DannyR

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