2011-02-09 53 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