逐个加载图表

时间:2016-05-19 05:35:27

标签: vb.net

如何逐个加载图表。我已经制作了图表制作功能并在页面加载时调用它但我需要它们异步加载,请帮助

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete

        If Not IsPostBack Then
            ChartMaker(100288, Chart1, "Series1")
            ChartMaker(100289, Chart2, "Series2")
            ChartMaker1(100291, Chart3, "Series3")
            ChartMaker(100293, Chart4, "series4")
            ChartMaker(100295, Chart5, "Series5")
            ChartMaker(100278, Chart6, "Series6")
        End If

    End Sub

     Sub ChartMaker(Rnum As Integer, chart As System.Web.UI.DataVisualization.Charting.Chart, Series As String)
            Dim Data As String() = Functions.runAnalyticsReportSample(Rnum)
            Functions.CredHolder(Session("User"), Session("Pw"))
            Dim split As String() = {""}
            Dim table As New DataTable()
            Dim colB As DataColumn = table.Columns.Add("A", GetType(String))
            Dim colD As DataColumn = table.Columns.Add("B", GetType(String))
            For Each line In Data
                split = line.Split(","c)
                Dim row As DataRow = table.NewRow()
                row.SetField(colB, split(0))
                row.SetField(colD, split(1))
                table.Rows.Add(row)
            Next
            chart.Series(Series).XValueMember = "A"
            chart.Series(Series).YValueMembers = "B"
            chart.Series(Series).IsValueShownAsLabel = True
            chart.Series(Series).IsVisibleInLegend = False
            chart.DataSource = table
            chart.DataBind()
        End Sub

0 个答案:

没有答案