Sign in to follow this  
tgupta1983

Setting up the dataSource for flash based charts

Recommended Posts

I have been trying to dynamically generate xml data source and then setting up the dataSource of my fusion chart object. I always get the "No data to display". It appears that the fusion chart object is not taking up the data source. Any help will be appreciated. 

 

Thanks!

 

<div id="PC_pnlChart">
<script type="text/javascript">
   var myChart = new FusionCharts('../Fusion-Charts/Line.swf', 'MyChartId', '100%', '500', '0', '1'); 
            myChart.dataFormat = 'xml'; 
            myChart.dataSource = "<chart caption='Harrys SuperMart' subcaption='Monthly revenue for last year' xaxisname='Month' yaxisname='Amount' numberprefix='$' palettecolors='#008ee4' bgalpha='0' borderalpha='20' canvasborderalpha='0' useplotgradientcolor='0' plotborderalpha='10' placevaluesinside='1' rotatevalues='1' valuefontcolor='#ffffff' captionpadding='20' showaxislines='1' axislinealpha='25' divlinealpha='10'><set label='Jan' value='420000' /><set label='Feb' value='810000' /><set label='Mar' value='720000' /><set label='Apr' value='550000' /><set label='May' value='910000' /><set label='Jun' value='510000' /><set label='Jul' value='680000' /><set label='Aug' value='620000' /><set label='Sep' value='610000' /><set label='Oct' value='490000' /><set label='Nov' value='900000' /><set label='Dec' value='730000' /></chart>";
   myChart.render(PC_pnlChart);
        </script>
</div>
 

Share this post


Link to post
Share on other sites

After digging up in the API references, the setXMLData has worked  for me. 

 

But the API documentation says "However, using this function to set data of a chart is not recommended. The initial data of a chart is preferred to be set in the FusionCharts constructor.

 

Could you please direct me or provide an example on how to set the data in the FusionCharts constructor itself. I could not find a FusionCharts constructor (for flash based charts) that will aslo accept the data.

 

Thanks!

Share this post


Link to post
Share on other sites

After digging up in the API references, the setXMLData has worked  for me. 

 

But the API documentation says "However, using this function to set data of a chart is not recommended. The initial data of a chart is preferred to be set in the FusionCharts constructor.

 

Could you please direct me or provide an example on how to set the data in the FusionCharts constructor itself. I could not find a FusionCharts constructor (for flash based charts) that will aslo accept the data.

 

Thanks!

Hi,

 

Please note that "setXMLData" works perfectly with the Flash based charts. This function which takes XML embedded as string from the JavaScript. We call it Data String method. You are using an older version (Flash), hence, you may refer to the previous documentation.

Ref.- http://docs.fusioncharts.com/charts/contents/?FirstChart/DataXML.html

 

The documentation you have referred to is of the latest version, i.e, FusionCharts v3.4. This is purely a JavaScript version and does not support Flash any further.

 

The constructor method is available with the latest version, i.e, FusionCharts v3.4 and can be referred to from here.

Ref.- http://docs.fusioncharts.com/tutorial-getting-started-your-first-charts-building-your-first-chart.html

 

Hope this helps. :) 

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