Sign in to follow this  
kotesh

Caling Instrumentation charts using Javascript

Recommended Posts

I am using Ganttchart in the Instrumentation suite from the enterprise version.

When I try to call the Gantt chart in the instrumentation suite using Javscript, it gives me blank screen with just the border.However, when I try using <object> tag embedding in html approach, it works fine, I use the same XML file as input.

Find below my code snippet.Please help.I put some alerts in code, infact FC_Rendered function also does not get called.

<SCRIPT LANGUAGE="Javascript" SRC="/FusionCharts/FusionCharts.js">

//You need to include the above JS file, if you intend to embed the chart using JavaScript.

</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">

function FC_Rendered(DOMId){

//This method is called whenever a FusionCharts chart is loaded.

//Check if it's the required chart using ID

alert('inside FC_Rendered');

if (DOMId=="ChId1"){

//Invoke updateChart() method to update chart with new data

updateChart();

}

}

function updateChart(){

//Get reference to chart object using Dom ID "ChId1"

var chartObj = getChartFromId("ChId1");

alert('inside update chart'+ chartObj);

//Update its XML Data URL

chartObj.setDataURL("/http://OurlocalserverURL?XML=X:/FusionCharts/data/CollabGanttChartNew.xml");

chartObj.render("chart1div");

}

</SCRIPT>

<BODY>

<div id="chart1div">

This text is replaced by the chart.

</div>

<script type="text/javascript">

var chart1 = new FusionCharts("FI2_Gantt.swf", "ChId1", "600", "300", "0", "1");

alert(chart1);

//Start Chart with empty data as we'll later update using JavaScript

chart1.setDataXML("<chart></chart>");

chart1.render("chart1div");

</script>

</BODY>

Share this post


Link to post
Share on other sites

The URL in the setDataURL , I just changed the URL for this post(also I have some typos in the URL like '/http' etc) , but trust me it fetches the XML properly.

Share this post


Link to post
Share on other sites

The Gantt chart is built on v2 platform and as such does not call FC_Rendered function or doesn't support setDataURL/setDataXML method (after rendering).

We will be coming with a v3 of the same in August.

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