FusionFerro

Passing swf file using absolute path

Recommended Posts

Hi there,

 

I am new in using Fusion Charts and havent wrote java script since long.

 

I am trying to get introduced to Fusion Charts and started with the bar example.

 

It works fine as long as I am passing the swf and js files using relative paths "..l" or ".." but what if one or both files exist in a different root path or different network location?

<html>
<head>
	<title>FusionGadgets Chart Gallery</title>
	<script language="JavaScript" src="../FusionCharts.js"></script>
</head>
<body bgcolor="#ffffff">
<table width='98%' align='center' cellpadding='2' cellspacing='0'>
  <tr>
  <td align="center">
   <div id="chartdiv" align="center">FusionGadgets</div>
   <script type="text/javascript">
	var myChart = new FusionCharts("../Charts/realtimecolumn.swf", "myChartId", "270", "270", "0", "0");
	myChart.setDataURL("mybar.xml");
	myChart.render("chartdiv");
   </script>
   </td>
   </tr>
   <tr height='10'>
   <td></td>
   </tr>
   <tr>
   
   </tr>
</table>
</body>
</html>

the above works fine but when I try to pass the swf file as full path: "E:/folder1/folder2/Charts/realtimecolumn.swf" instead it fails, same goes with the jr file when I try to pass it using full path: "d:/folder9/folder10/FusionCharts.js"

Also would like to know the case when I want to pass the file path using network location

 

Many thanks,

Share this post


Link to post
Share on other sites

Hi,

 

A chart can be rendered using absolute path instead of relative path. Proving absolute path works fine if your drive or network location has access from outside it without providing any password protection. Please find attached a sample created using absolute paths.

 

However, please note that it is preferable to use relative paths instead of absolute paths due to security reasons and domain restrictions.

 

Hope this helps.

Column 2D.zip

Share this post


Link to post
Share on other sites

Thank you for provided the attached example but unfortunately it doesnt work. Even the Demo.html file you provided doesnt show the chart.

 

I had a successful trial when I used: "File///F:/Dev/Fusion/" but it works only when I write javascript in my html file but fails from within the code (vstudio with c#).

 

kindly advice.

Share this post


Link to post
Share on other sites

Hi,

 

The sample attached above works when you allow your webpage from running Scripts and ActiveX controls. Also,please check if you have changed path of Column 2D folder to the path of your machine in the Demo.html file.

 

We suggest you to use relative paths instead of absolute paths due to various security reasons.
 
 
Hope this helps.

Share this post


Link to post
Share on other sites

Hi Haritha,

 

right you are, your example works after modifying the browser settings.

 

I think, due to my limited experience with relative path, I need your further support here.

 

from my vstudio c# applicaton I tried to learn the root application directory by:


HttpRuntime.AppDomainAppPath;

 

 

and the return value was "C:\inetpub\wwwroot\wss\VirtualDirectories\80\"

 

Also in case I should make my relative path with reference to the actual application location on my HDD:

- MyApp.sln solution file is under c:\apps\myapp\MyApp.sln

- MyApp.csproj project file is under c:\apps\myapp\myapp\MyApp.csproj

 

Given this, 1- where should I place Fusion files on my HDD (swf, jr, and xml files)

2- what should be the relative path to use in my html file?

 

Thanks,

Edited by FusionFerro

Share this post


Link to post
Share on other sites
Guest Sumedh

Hello,

 

You would need to keep all the JavaScript libraries and swf files inside your project folder.

 

And you would need to deploy your project on IIS server.

 

Also, you would need to provide relative path for the swf file.

Ref. Code:

Literal.Text = FusionCharts.RenderChart("../FusionCharts/Column3D.swf", "Data/Data.xml", "", "myFirst", "600", "300", false, true); 

 

For more information, you can refer the following links:

http://www.codeproject.com/Articles/28693/Deploying-ASP-NET-Websites-on-IIS-7-0

 

http://docs.fusioncharts.com/charts/contents/guide-for-web-developers/csnet/CS_BasicExample.html

 

Hope this helps!

Share this post


Link to post
Share on other sites

Thanks for the feedback,

 

I feel really stuck in the relative path thing! I have my chart ready and working outside the project (as html) but I am not able to show it from the code.

 

I noticed that you are asking me to deploy the solution on IIS, I am using SharePoint (so my project is a VStudio SharePoint C# project) and I don't deploy the solution manually to IIS, will I still need to place the FusionChart folder and files manually on IIS?

 

Also as per my example, I am not using Literal control (actually in the real code I am using asp:table cell to show the chart inside) will this make any difference? (here is the link to another forum post that shows my code example: http://forum.fusioncharts.com/topic/15075-displaying-fusion-chart-in-asptable-cell-using-c-net/)

 

Waiting for your response

Thanks

Share this post


Link to post
Share on other sites

Hi,

 

It seems from your code in the mentioned link that you are already using relative paths and are able to render a chart inside a div.

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