2

I am using Visual Studio 3.5 chart control :

<asp:Chart ID="Chart1" runat="server">
   <Series>
      <asp:Series Name="Series1" ChartArea="ChartArea1" ChartType="Bar">
      </asp:Series>
   </Series>
   <ChartAreas>
      <asp:ChartArea Name="ChartArea1">
      </asp:ChartArea>
   </ChartAreas>
</asp:Chart>

and I need to show data in this chart which I will retrieve from SQL Server here what I want to retrieve and show :

select PONumber, CompletionTimeMonths, CreatedOn 
from PurchaseOrder;

Now this is the 1ts time I am using chart control; how can I show this?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Arindam Das
  • 699
  • 4
  • 20
  • 39
  • 1
    http://archive.msdn.microsoft.com/mschart Below there is link for 3.5 examples. This is a good place to start – Quantbuff Nov 27 '12 at 13:45

1 Answers1

1

answering my own question... i did this ans i am getting a simple decent looking chart at least for the beginning :

This is the .aspx design part :

<asp:Chart ID="Chart1" runat="server" Width="920px" Height="130px" >
        <Series>
            <asp:Series Name="Series1" ChartType="Bar">
            </asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1" BackColor="Yellow">
                <AxisY Title="Duration" Interval="Auto">
                </AxisY>
                <AxisX Title="PO Number">
                </AxisX>
                <%--<Area3DStyle Enable3D="true" />--%>
            </asp:ChartArea>
        </ChartAreas>  

and this is the code part in .cs file :

 public void fill()
{
    con.Open();
    SqlCommand cmd = new SqlCommand("select PONumber,CompletionTimeDays,CreatedOn from PurchaseOrder");
    cmd.Connection = con;
    SqlDataAdapter da = new SqlDataAdapter(cmd);
    DataTable dt = new DataTable();
    da.Fill(dt);
    Chart1.DataSource = dt;
    Chart1.Series["Series1"].XValueMember = "PONumber";
    Chart1.Series["Series1"].YValueMembers = "CompletionTimeDays";
    //Chart1.Series["Series1"]["DrawingStyle"] = "Emboss";
    Chart1.DataBind();
    con.Close();
}

hope this will help who is starting doing this as me

Arindam Das
  • 699
  • 4
  • 20
  • 39