开发者

fusion free charts and arraylist

i am trying to use an arraylist to build a graph using fusionfree however i cant get it to work, it keeps showing the same item from the array list

 Dim util As New Util()
    Dim region As New List(Of String)
    Dim int1 As New List(Of Integer)


    For Each rows As GridViewRow In GridView1.Rows
        ' Selects the text from the TextBox
        Dim regions As Label = CType(row.FindControl("label1"), Label)
        region.Add(Label1.Text)
        int1.Add(10)

    Next



    Dim strXML As String, i As Integer
    'Initialize <graph> element
    strXML = "<graph caption='Sales by Product' numberPrefix='$' formatNumberScale='0' decimalPrecision='0'>"

    'Convert data to XML and append
    Dim x As Int32
    x = 0
    For i = 0 To (region.Count) - 2
        x = (x + 1)
        'add values using <set name='...' value='...' color='...'/>
        strXML = strXML & "<set name='" & region.Item(x) & "' value='" & int1.Count & "' color='" & util.getFCColor() & "' />"
    Next
开发者_开发知识库    'Close <graph> element
    strXML = strXML & "</graph>"

    'Create the chart - Column 3D Chart with data contained in strXML
    Return FusionCharts.RenderChart("../FusionCharts/FCF_Column3D.swf", "", strXML, "productSales", "600", "300", False, False)


In here, you are adding the same values over and over:

For Each rows As GridViewRow In GridView1.Rows
    ' Selects the text from the TextBox
    Dim regions As Label = CType(row.FindControl("label1"), Label)
    region.Add(Label1.Text) 'This should maybe be regions? You are always using Label1
    int1.Add(10)
Next

You are adding the Text property from Label1 (not the current row's label1) and 10 to region and int1 resp.

Also, is row declared somewhere above the loop above? I just noticed that your loop variable is rows, but you are trying to pull label1 from row. Can you please clarify this discrepancy?


You could try http://liberofusioncharts.codeplex.com/. Make things simpler

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜