Hi there, I need your help.
I need one complete tutorial for ASP.NET Graphs Page Language=“C#”.
Can you help me?
Thanks in advance.
Hi there, I need your help.
I need one complete tutorial for ASP.NET Graphs Page Language=“C#”.
Can you help me?
Thanks in advance.
Hi there, I try the Chart controls .
Now I need save and send email with attachment the chart generate with Chart controls.
This is my code, can you help me?
Thanks in advance.
using System;
using System.IO;
using System.Data;
using System.Data.Odbc;
using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
OdbcConnection myConnectionString = new OdbcConnection(ConfigurationManager.ConnectionStrings["ConnMySQL"].ConnectionString);
try
{
myConnectionString.Open();
}
finally
{
myConnectionString.Close();
myConnectionString.Dispose();
}
}
}
}
<%@ Page Title="Home page" Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Chart</title>
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Chart1.Series["Default"].ChartType = SeriesChartType.Column;
Chart1.Series["Default"]["PointWidth"] = "6.0";
Chart1.Series["Default"].IsValueShownAsLabel = true;
Chart1.Series["Default"]["BarLabelStyle"] = "Center";
Chart1.Series["Default"]["PixelPointDepth"] = "20";
Chart1.Series["Default"]["DrawingStyle"] = "Cylinder";
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Inclination = 30;
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource1" Width="600px">
<Series>
<asp:Series Name="Default" XValueMember="QUEST_TOTAL_VOTES" YValueMembers="QUEST_INACTIVE">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnMySQL %>"
ProviderName="<%$ ConnectionStrings:ConnMySQL.ProviderName %>"
SelectCommand="SELECT QUEST_TOTAL_VOTES, QUEST_INACTIVE FROM tbl_poll_questions">
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
hi dear, here is the codes for creating chart from array in asp.net c# ,…
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="home.aspx.cs" Inherits="graph.home" %>
<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Chart ID="Chart1" runat="server">
<series>
<asp:Series Name="Series1">
<points>
</points>
</asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</chartareas>
</asp:Chart>
</div>
</form>
</body>
</html>
…:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D…
C# / graph.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace graph
{
public partial class home : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int[]y = {200,50,100,80};
int[]x= {50,40,10,20};
// p.s: basically u can add as many elements as u like below .. it is getting dynamically added within the <points></points> tag automatically
Chart1.Series["Series1"].Points.AddXY(x[0], y[0]);
Chart1.Series["Series1"].Points.AddXY(x[1], y[1]);
Chart1.Series["Series1"].Points.AddXY(x[2], y[2]);
Chart1.Series["Series1"].Points.AddXY(x[3], y[3]);
}
}
}
<snip />
Please take a look at this article for help about graph in ASP.Net 4
http://weblogs.asp.net/scottgu/archive/2010/02/07/built-in-charting-controls-vs-2010-and-net-4-series.aspx
This is a dug up thread from well over a year ago, closing.