SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Charting & webform1.aspx.vb

    webform.aspx has the following code:
    Code:
    <asp:Chart ID="Chart1" BackColor="Black" runat="server">
            <Series>
                <asp:Series Name="Series1" ChartType="Line" BorderWidth="1"></asp:Series>
             </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1" Area3DStyle-Enable3D="true">
                </asp:ChartArea>
            </ChartAreas>
    </asp:Chart>
    I would like to know the mechanics of plotting this chart with data calculated from within: webform.aspx.vb. I have calculated the data.

    How do you plot the chart?

    Code:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
         'calculate data
         'plot chart
    End Sub

  2. #2
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is my 'plot chart in webform.aspx.vb the graph should be a circle.

    How do you convert Double to System.Collections.IEnumerable

    x&y are double
    DatabindXY is of IEnumerable

    Code:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim x, y
            For t = 0 To 2 * 3.1459 Step 0.1
                x = Math.Cos(t)
                y = Math.Sin(t)
                Chart1.Series("Series1").Points.DataBindXY(x,y)
                Chart1.Series("Series1").IsVisibleInLegend = true
                Chart1.Series("Series1").IsValueShownAsLabel = true;
                Chart1.Series("Series1").Color = System.Drawing.Color.Red;
            Next t
        End Sub

  3. #3
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,235
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    I think this is what you want... (pardon my typos/compile errors, I haven't done VB for a while)

    Code:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim x As List(Of Double) = new List(Of Double), y As List(Of Double) = new List(Of Double)
            For t = 0 To 2 * 3.1459 Step 0.1
                x.Add(Math.Cos(t))
                y.Add(Math.Sin(t))
            Next t
                Chart1.Series("Series1").Points.DataBindXY(x,y)
                Chart1.Series("Series1").IsVisibleInLegend = true
                Chart1.Series("Series1").IsValueShownAsLabel = true;
                Chart1.Series("Series1").Color = System.Drawing.Color.Red;
        End Sub


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •