Charting & webform1.aspx.vb

webform.aspx has the following 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?

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

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


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

I think this is what you want… (pardon my typos/compile errors, I haven’t done VB for a while)

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