programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Website by URL, How to Play YouTube Videos in by using Jquery , Jquery Change div background on mouseover in , JQuery UI Datepicker (Calendar) etc.

Wednesday, November 20, 2013

How to create graph in

How to create graph in

As we know that the .net provides Graph controls for programming and data representation in graphically .today we simply learn how to use these graph controls in and how to represent data in Graph.

 we describe some steps for using Graph Controls:

Step 1: create a Table in data base

      CREATE TABLE [dbo].[emp](
      [emp_id] [int] IDENTITY(1,1) NOT NULL,
      [emp_name] [nvarchar](50) NULL,
      [salary] [int] NULL

And then fill data in to table:

Now go to .net EID for using Graph.

Step 2: get the Graph Control in to aspx page as like.

Code of aspx page :

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
    <asp:Chart ID="Chart2" runat="server" Width="375px">
                                    <asp:Title ShadowOffset="1" Name="Items" Font="Microsoft Sans Serif, 12pt"
                                        Text="Students List " />
                                    <asp:Series Name="Series1" ChartArea="ChartArea1" YValuesPerPoint="10" ChartType="Column">
                                    <asp:ChartArea Name="ChartArea1" BorderWidth="0">
                                        <Area3DStyle Enable3D="True" Rotation="15" />

Code in .aspx.cs page :

private void FillEMP()
        DataSet dsEmp = new DataSet();
        dsEmp = objComm.RunSQLQuery("select salary,emp_name as NAME from Test.dbo.emp");
        Chart6.DataSource = dsEmp;
        Chart6.ChartAreas["ChartArea1"].AxisX.Title = "NAME";
        Chart6.ChartAreas["ChartArea1"].AxisY.Title = "SALARY";
        Chart6.Series["Series1"].XValueMember = "NAME";

        Chart6.Series["Series1"].YValueMembers = "salary";
        Chart6.Series[0].ToolTip = "SALARY: #VAL";
        Chart6.Series["Series1"].LegendToolTip = "";
        Chart6.Series["Series1"].LabelToolTip = "#VAL";
        Chart6.Series["Series1"].IsValueShownAsLabel = true;

        Chart5.Series["Series1"].IsValueShownAsLabel = true;

Called this function on page load ,you call this anywhere as you like .

The result is :

Checkboxlist related post :

No comments:

Post a Comment