2011-02-09 63 views
0

我試圖使用ArrayList生成使用fusionfree 圖形但是我不能得到它的工作,它不斷出現在數組列表融合自由圖表和ArrayList

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) 

回答

1

在這裏同樣項目,你一遍又一遍地將相同的價值觀:

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 

您要添加的Label1從該Text特性(不是當前行的label1)和10區和INT1 RESP。

另外,是row上面的循環上面聲​​明的地方?我剛剛注意到你的循環變量是rows,但你試圖從rowlabel1。你能否澄清這種差異?

+0

我得到它的工作我通過,而不是在GridView更有意義的數據表決定環路 – MyHeadHurts 2011-02-09 21:13:53