⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gerargrafico.aspx.vb

📁 This ASP.NET (VB.NET) sample demonstrates how to create chart.
💻 VB
字号:
Imports aspnetgraficos.ComponenteGrafico
Partial Class GerarGrafico
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        '////////////////////////////////////////
        '/Recebe paramtros para gerar o Grafico /
        '////////////////////////////////////////

        Dim xValues, yValues, Tipo_Grafico_str As String
        xValues = Request.QueryString("xValues")
        yValues = Request.QueryString("yValues")
        Tipo_Grafico_str = Request.QueryString("Tipo_Grafico")


        If Not (xValues Is Nothing) And Not (yValues Is Nothing) Then
            Response.Clear()
            Response.ContentType = "image/gif"
            Dim bmp As Bitmap
            Dim memStream As New System.IO.MemoryStream

            Select Case Tipo_Grafico_str
                Case "Barra"
                    Dim bar As New BarGraph(Color.White)

                    bar.VerticalLabel = "R$"
                    bar.VerticalTickCount = 5
                    bar.ShowLegend = True
                    bar.ShowData = False
                    bar.Height = 400
                    bar.Width = 700

                    bar.CollectDataPoints(xValues.Split("|".ToCharArray()), yValues.Split("|".ToCharArray()))
                    bmp = bar.Draw()
                Case "Barra2"
                    Dim bar As New BarGraph(Color.White)
                    Dim i As Integer
                    For i = 0 To 6
                        bar.SetColor(i, Color.Sienna)
                    Next i
                    bar.VerticalTickCount = 2
                    bar.ShowLegend = False
                    bar.ShowData = True
                    bar.Height = 119
                    bar.Width = 195
                    bar.TopBuffer = 5
                    bar.BottomBuffer = 15
                    bar.FontColor = Color.Gray
                    bar.CollectDataPoints(xValues.Split("|".ToCharArray()), yValues.Split("|".ToCharArray()))
                    bmp = bar.Draw()
                Case Else
                    Dim pc As New PieChart(Color.White)
                    pc.CollectDataPoints(xValues.Split("|".ToCharArray()), yValues.Split("|".ToCharArray()))
                    bmp = pc.Draw()

            End Select

            'Retorna o grafico para o Browser
            bmp.Save(memStream, System.Drawing.Imaging.ImageFormat.Gif)
            memStream.WriteTo(Response.OutputStream)
        End If
    End Sub

End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -