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

📄 defaultvb.aspx.vb

📁 Telerik是很大的第三方软件制造商
💻 VB
字号:
Imports Telerik.QuickStart
Imports Telerik.WebControls

Namespace Telerik.ChartExamplesVB.Functionality.PostbackEvents
    Public Class DefaultVB
        Inherits XhtmlPage

        Protected Label1 As System.Web.UI.WebControls.Label
        Protected Label2 As System.Web.UI.WebControls.Label
        Protected Label3 As System.Web.UI.WebControls.Label
        Protected txtBoxClickedSeries As System.Web.UI.WebControls.TextBox
        Protected txtBoxClickedItem As System.Web.UI.WebControls.TextBox
        Protected WithEvents RadChart1 As Telerik.WebControls.RadChart
        Protected txtBoxClickedLegendItem As System.Web.UI.WebControls.TextBox


        Private Function CreateLegendItem(ByVal name As String, ByVal mark As ChartLegendItemMark, ByVal color As Color) As ChartLegendItem
            Dim legendItem As New ChartLegendItem()

            legendItem.ItemMark = mark
            legendItem.Name = name
            legendItem.Appearance.MainColor = color
            legendItem.Appearance.FillStyle = FillStyle.Solid

            Return legendItem
        End Function 'CreateLegendItem




        Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
            If Not Page.IsPostBack Then
                Dim s As ChartSeries = RadChart1.GetChartSeries(0)
                Dim s1 As ChartSeries = RadChart1.GetChartSeries(1)

                s.SetValues(12, 50, 17, 37, 63, 19)
                s1.SetValues(25, 15, 46, 84, 14, 70)

                Dim series As ChartSeries
                For Each series In RadChart1.ChartSeriesCollection
                    Dim itemIndex As Integer = 0

                    Dim item As ChartSeriesItem
                    For Each item In series.Items
                        item.Name = "item " + itemIndex.ToString()
                        itemIndex = itemIndex + 1
                    Next item
                Next series

                RadChart1.Legend.Items.Add(CreateLegendItem("legend 1", ChartLegendItemMark.Circle, Color.Red))
                RadChart1.Legend.Items.Add(CreateLegendItem("legend 2", ChartLegendItemMark.Rectangle, Color.Blue))
                RadChart1.Legend.Items.Add(CreateLegendItem("legend 3", ChartLegendItemMark.Triangle, Color.Green))

                Dim legendItem As ChartLegendItem
                For Each legendItem In RadChart1.Legend.Items
                    legendItem.ImageMap.ToolTip = "Click here"
                Next legendItem
            End If
        End Sub 'Page_Load

#Region "Web Form Designer generated code"

        Protected Overrides Sub OnInit(ByVal e As EventArgs)
            '
            ' CODEGEN: This call is required by the ASP.NET Web Form Designer.
            '
            InitializeComponent()
            MyBase.OnInit(e)
        End Sub 'OnInit


        '/		Required method for Designer support - do not modify
        '/		the contents of this method with the code editor.
        '/ </summary>
        Private Sub InitializeComponent()

        End Sub 'InitializeComponent

#End Region


        Private Sub RadChart1_Click(ByVal sender As Object, ByVal args As Telerik.WebControls.ChartClickEventArgs) Handles RadChart1.Click
            If Not (args.Series Is Nothing) Then
                txtBoxClickedSeries.Text = args.Series.Name
            Else
                txtBoxClickedSeries.Text = "N/A"
            End If

            If Not (args.SeriesItem Is Nothing) Then
                txtBoxClickedItem.Text = args.SeriesItem.Name
            Else
                txtBoxClickedItem.Text = "N/A"
            End If
            If Not (args.LegendItem Is Nothing) Then
                txtBoxClickedLegendItem.Text = args.LegendItem.Name
            Else
                If args.IsLegendItem Then
                    txtBoxClickedLegendItem.Text = "A legend item is clicked."
                Else
                    txtBoxClickedLegendItem.Text = "N/A"
                End If
            End If
        End Sub 'RadChart1_Click

    End Class
End Namespace

⌨️ 快捷键说明

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