|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 2/5/2008 3:42:01 AM
Posts: 2,
Visits: 6
|
|
Hi,
I am using FusionChart Free edition to display graphs in my application and its working properly with single graph on a page. But now I want to display multiple graphs on a page. I have seen example but most of those are with Javascript. Is there any example with ASP.net with graphs rendering from code behind?
In Code Behind::
public string GenerateGraph() {
string strXML = Session["XML"].ToString();
return FusionCharts.RenderChart("FusionCharts/FCF_MSColumn3D.swf", "", strXML, "ResourceVsCO", "600", "300", false, false);
}
In Designer::
<%=GenerateGraph() %>
From,
Deepak
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 3/3/2008 11:41:23 PM
Posts: 23,
Visits: 29
|
|
| Hi, you can use multiple javascripts using the process tha I followed: 1. Use multiple <div> to draw the charts 2. Use different script names for javascript names.. Here strs denotes the type of fusion chart that I want to draw..(2Dbar,3DColumn etc..) If charttype = "timetoacknowledge" Thenstrtimetoacknowledge = "<script type='text/javascript'> var chart6 = new FusionCharts('" & strs & "', 'ChId6', '765', '400'); chart6.setDataURL('../ArrayExample/DefectXML/timetoacknowledge.xml'); chart6.render('chart1Div'); </script>"ScriptManager.RegisterStartupScript( Me, Me.GetType(), "strtimetoacknowledge", strtimetoacknowledge, False)ElseIf charttype = "resourcegrowthchart" Thenstrresourcegrowthchart = "<script type='text/javascript'> var chart1 = new FusionCharts('" & strs & "', 'ChId1', '765', '400'); chart1.setDataURL('../ArrayExample/PeoplePowerXML/resourcegrowthchart.xml'); chart1.render('chart2Div'); </script>"ScriptManager.RegisterStartupScript( Me, Me.GetType(), "strresourcegrowthchart", strresourcegrowthchart, False)ElseIf charttype = "onsiteoffshoremix" Thenstronsiteoffshoremix = "<script type='text/javascript'> var chart2 = new FusionCharts('" & strs & "', 'ChId2', '765', '400'); chart2.setDataURL('../ArrayExample/PeoplePowerXML/resourcegrowthchart.xml'); chart2.render('chart3Div'); </script>"ScriptManager.RegisterStartupScript( Me, Me.GetType(), "stronsiteoffshoremix", stronsiteoffshoremix, False)End If I hope it helps you a little bit...
Regards,Abhisek
|
|
|
|
|
Supreme Being
      
Group: Moderators
Last Login: Today @ 5:38:52 AM
Posts: 884,
Visits: 1,420
|
|
| hi, In Designer Use this : < asp:Literal ID="Literal1" runat="server"></asp:Literal><% for(int i=1;i<=5;i++){GenerateGraph(i.ToString()); } %> CodeBehind : public void GenerateGraph(string id) {string strXML = Session["XML"].ToString();Literal1.Controls.Add( new LiteralControl(FusionCharts.RenderChart("FusionCharts/FCF_MSColumn3D.swf", "", strXML, "ResourceVsCO"+id, "600", "300", false, false); ));} Make sure that you are passing different unique id to the function. each chart needs a unique id.
Regards,
Sudipto Choudhury FusionCharts Team
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 9/6/2008 12:37:15 PM
Posts: 1,
Visits: 1
|
|
Hi ,
If i use your code :
literal1.Controls.Add(new LiteralControl(FusionCharts.RenderChart("Charts/FCF_Pie3D.swf", "", strXML, "IDCharts", "600", "350", false, false)));
ASP .net give me the following error :
'System.Web.UI.WebControls.Literal' does not allow child controls.
I use Microsoft .NET Framework Version:2.0.50727.1433
When I implemented the chart directly to my aspx, it was no problem : <%= FusionCharts.RenderChart("Charts/FCF_Pie3D.swf", "", strXML, "IDCharts", "600", "350", false, false) %>
But i'm using the authentication of .net and if i want to logout I'm well a problem :
Object reference not set to an instance of an object.
Any idee ?
Thanks.
|
|
|
|
|
Supreme Being
      
Group: Moderators
Last Login: Today @ 6:58:37 AM
Posts: 632,
Visits: 1,928
|
|
hi, could you please use this way Literal1.Text = FusionCharts.RenderChart( "Charts/FCF_Pie3D.swf", "", strXML, "IDCharts", "600", "350", false, false);
Thanks,
Arindam FusionCharts Team
www.fusioncharts.com
|
|
|
|