Question

I am trying to display and update HLINEAR GAUGE fusionGadget pointer value. When I am dragging the pointer , the function FC_ChartUpdated is not being called. I have tried using RealtimeUpdateComplete eventListener too. But it displays error 'Object does not support property / method 'setAttribute''..Can you please tell me the reason?

We have to call that JS function or It will be called automatically when Gauge is updated?

Here is my code,

<html>
<head>
        <title>FusionGadgets</title>
        <script language="JavaScript" src="FusionCharts.js"></script>      
</head>
<body bgcolor="#ffffff">
   <div id="chartdiv" align="center">FusionGadgets</div>

   <script type="text/javascript">
        var myChart = new FusionCharts("HLinearGauge.swf", "myChartId", "450", "120", "0", "0");
        myChart.setDataURL("Data.xml");
        myChart.render("chartdiv");
   </script> 

</body>
<script>

FusionCharts("myChartId").addEventListener("RealtimeUpdateComplete" , myChartListener);
function myChartListener(){
 alert('Hi.');
}

  function FC_Rendered(DOMId)
        {  //alert(Math.round(pointerValue));    
         //Check if DOMId is that of the chart we want
                if (DOMId=="myChartId"){
                //Get reference to the chart
                var chartRef = FusionCharts(DOMId);
                //Get the current value
                var pointerValue = chartRef.getData(1); 
                //You can also use getDataForId method as commented below, to get the pointer value.
                //var pointerValue = chartRef.getDataForId("CS"); 
                //Update display
                  alert(Math.round(pointerValue));    
                             }

        }
</script>
</html>
Was it helpful?

Solution

Finally,After had been working for several hours,this issue has been resolved.These are the steps which made the issue was resolved...

1.passing registerWithJs value '1'.

var myChart1 = new FusionCharts("HLinearGauge.swf", "myChartId1", "450", "105", "0", "1"); 2.Changed Flash Player Global Security Settings.. for more info 3. Chang the FusionCharts.js file to new version.

4.After had made these changes,I encountered with new issue, chartRef.getData(1) gives javascript error (Object does not support the property/method). So then I changed the code for getting chart reference to var chartRef = getChartFromId(DOMId); from var chartRef = FusionCharts(DOMId);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top