Java Script Drill Down Problem
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Java Script Drill Down Problem Expand / Collapse
Author
Message
Posted 3/3/2007 3:00:40 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 3/13/2007 3:52:14 PM
Posts: 3, Visits: 12
Hello,

I am attempting to get a handle on FusionCharts v3 using a product called Websmart accessing an AS/400 database.  I have crated a simple page using three graphs being populated by external XML calls.  All is working great and I am now trying to establish a simple drill down function.  Page is populated by a location number being passed via URL - right now I am simply attempting to change MTD graph to a different location by clicking ANY YTD graph bar.  The location change is hardcoded until I establish function  - I can then setup all necessary parameters to control graphs.  I have very little Javascript experience but have tried a number of methods that I have deciphered from blueprint - but when obvious errors removed seems to come back to - Object doesn't support this property or method.  I am just not getting it right!  Can anybody there take a look a code and point out obvious problems.  I can provide URL but would rather not publish to public.

Basic code - internal address

<html>
    <head>
   
        <script language="JavaScript" src="FusionCharts.js"></script>
 
   <Script LANGUAGE="JavaScript">
   function UpdateMTDChart(Year)
   { 
    MTDChart.setDataURL("http://192.168.0.2/scs400web/xml002.pgm?Location=27");
   }
  </Script>
  
</head>
   
<body bgcolor="#ffffff">
 
 <BR>
 
    <div id="YTDChartDiv" align="center">The chart will appear within this DIV. This text will be replaced by the chart.</div>
    <script type="text/javascript">
        var YTDChart = new FusionCharts("Column3D.swf","YTDChartId","900","300","0","0");
        YTDChart.setDataURL("http://192.168.0.2/scs400web/xml001.pgm?Location=000321");
        YTDChart.render("YTDChartDiv");
    </script>
 
 <BR>
 
    <div id="MTDChartDiv" align="center">The chart will appear within this DIV. This text will be replaced by the chart.</div>
    <script type="text/javascript">
        var MTDChart = new FusionCharts("Column3D.swf","MTDChartId","900","300","0","0");
        MTDChart.setDataURL("http://192.168.0.2/scs400web/xml002.pgm?Location=000321");
        MTDChart.render("MTDChartDiv");
    </script>
   
 <BR>
  
    <div id="DLYChartDiv" align="center">The chart will appear within this DIV. This text will be replaced by the chart.</div>
    <script type="text/javascript">
        var DLYChart = new FusionCharts("Column3D.swf","DLYChartId","900","300","0","0");
        DLYChart.setDataURL("http://192.168.0.2/scs400web/xml004.pgm?Location=000321");
        DLYChart.render("DLYChartDiv");
    </script>  
 
 <BR>
 
</body>
</html>

Thanks for your help!

Post #442
Posted 3/5/2007 1:33:47 PM
FusionCharts Team

FusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts Team

Group: Administrators
Last Login: 7/29/2008 12:15:49 PM
Posts: 2,001, Visits: 474
In your function UpdateMTDChart, you've not first referenced the chart back from its ID. You need to use the getChartFromId(DOMId) function to get a reference back to chart. Only then, you can call it's methods.

Thanks,
Pallav Nadhani
FusionCharts Team
Post #443
Posted 3/7/2007 12:30:44 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 3/13/2007 3:52:14 PM
Posts: 3, Visits: 12
I tried every method that I could decipher from blueprint!

I think you mean somthing like this!!! - Same error???

<html>

<head>
  
 <script language="JavaScript" src="FusionCharts.js"></script>
 
 <script LANGUAGE="JavaScript">    
 
 function updateMTDChart()
 {
  var strURL = "http://192.168.0.2/scs400web/xml102.pgm?Location=00002%26Year=2007%26X=112046";
  strURL = escape(strURL);
  var chartObj = getChartFromId("MTDChart");
  chartObj.setDataURL(strURL);
 }
 
 </script>
   
</head>
   
<body bgcolor="#ffffff">
 
 <BR>
 
    <div id="Div_YTDChart" align="center">The chart will appear within this DIV. This text will be replaced by the chart.</div>
    <script type="text/javascript">
        var Chart_YTDChart = new FusionCharts("Column3D.swf","YTDChart","900","300","1","0");
        Chart_YTDChart.setDataURL("http://192.168.0.2/scs400web/xml101.pgm?Location=000321%26X=112046");
        Chart_YTDChart.render("Div_YTDChart");
    </script>
 
 <BR>
 
    <div id="Div_MTDChart" align="center">The chart will appear within this DIV. This text will be replaced by the chart.</div>
    <script type="text/javascript">
        var Chart_MTDChart = new FusionCharts("Column3D.swf","MTDChart","900","300","1","0");
        Chart_MTDChart.setDataURL("http://192.168.0.2/scs400web/xml102.pgm?Location=000321%26Year=2007%26X=112046");
        Chart_MTDChart.render("Div_MTDChart");
    </script>
  
</body>

</html>


I am obiously trying to force this to work so I can get syntax right - will then pass variables!

Thanks again,

S Travis

Post #467
Posted 3/7/2007 11:46:48 PM
FusionCharts Team

FusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts Team

Group: Administrators
Last Login: 7/29/2008 12:15:49 PM
Posts: 2,001, Visits: 474
Just one more change required- you need to enable the registerWithJS flag. See bold code below:

var Chart_YTDChart = new FusionCharts("Column3D.swf","YTDChart","900","300","1","1");

Thanks,
Pallav Nadhani
FusionCharts Team

Post #470
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -7:00, Time now is 4:43pm


Execution: 0.172.