Sign in to follow this  
swapprose

Need to get control of the chart to change chart size dynamically in the code behind file

Recommended Posts

Hi

I followed the creating first chart in this fusioncharts.Iam using visual studio 2008 and c#.net.

dynamically i am loading xml from database in the code behind file.

and using the below html code from the sample.

<body bgcolor="#ffffff">

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="900" height="300" id="Column3D" >

 <param name="movie" value="../FusionCharts/Column3D.swf" />

 <param name="FlashVars" value="&dataURL=Data.xml&chartWidth=900&chartHeight=300">

 <param name="quality" value="high" />

 <embed src="../FusionCharts/Column3D.swf" flashVars="&dataURL=Data.xml&chartWidth=900&chartHeight=300" quality="high" width="900" height="300" name="Column3D" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

</object>

My xml file data is very huge and need to change the chart width. so whatever keeping the size is not sufficient due to this huge data.

I want to get the control of the chart and able to change the width of the chart dynamically in the codebhind file.

but Iam not getting the control of the chart to change the width. I want to do this in code behind file.

How to achieve this.

and one more also:

I am getting label as fusion charts :infosoft global solution by default. I want to remove this default label. Iam not able to remove this. Iam using free version.

 

Please help me.

Thanks.

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi,

Welcome to FusionCharts forum. :)

I want to get the control of the chart and able to change the width of the chart dynamically in the codebhind file.

In this case you need to re-render the chart, everytime you change the width of the chart.

Iam not able to remove this.

In this case you need to use the Licensed version of FusionCharts where you can remove the water-mark.

Please refer to the link below for the detailed information on our Licensing policies :-

Ref.- http://www.fusioncharts.com/LicenseTable.asp

Hope this helps. :)

Edited by Guest

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi,

Please try to re-rendering the chart with the same code that you are using to render the chart for the first time just by changing the width of the chart.

Hope this helps. :)

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi,

Could you please specify the issue a bit elaborately?

Awaiting your reply.

Share this post


Link to post
Share on other sites

Hi,

Iam dynamically creating xml file when clicks on asp button.

Depends on the xml data I need to change the width of the chart dynamically.

So what I did was : (ignore dynamic xml for timebeing here)

<%

@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm6.aspx.cs" Inherits="WindFramework.WebForm6" %>

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

html xmlns="http://www.w3.org/1999/xhtml" >

<

head runat="server">

<title>FusionCharts & JavaScript - Basic Example</title>

<script language="Javascript" src="../FusionCharts/FusionCharts.js" type="text/javascript"></script>

<script language="JavaScript" type="text/javascript">

function fncheck(obj) {

alert(obj+

"1");

var chart1 = new FusionCharts("../FusionCharts/Column3D.swf", "chart1Id", "700", "900", "0", "1");

chart1.setDataXML(

"<chart><set label='A' value='10' /><set label='B' value='11' /></chart>");

chart1.render(

"chart1div");

 

}

</script>

</

head>

<

body>

<form id="form1" runat="server">

<asp:Button ID="btnss" Text="sss" runat="server" Width="30px"

onclick="btnss_Click"/>

<div id="chart1div">

FusionCharts

</div>

<script language="JavaScript" type="text/javascript">

var chart1 = new FusionCharts("../FusionCharts/Column3D.swf", "chart1Id", "400", "300", "0", "1");

chart1.setDataXML(

"<chart><set label='A' value='10' /><set label='B' value='11' /></chart>");

chart1.render(

"chart1div");

</script>

</form>

</

body>

</

html>

 

in cs file:

protected void btnss_Click(object sender, EventArgs e)

{

btnss.Attributes.Add(

"onclick", "javascript:fncheck('err');");

}

When clicked on aspx button Iam able to see the vertical scrollbar in between and chart width is again going to actual width i.e initial width here it is 400,300.

Iam not able to get the chart width and height 700,900 from the fncheck function.

Here it is executing that function also, able to see alert msg. 

If Iam using html button Iam not having any issues, everything is working fine with this html button.

According to my requirement I need to use server side button instead of html button due to dynamic creation of xml file.

How to achieve this?

Thanks.

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