chart.vb

来自「This ASP.NET (VB.NET) sample demonstrate」· VB 代码 · 共 53 行

VB
53
字号
Imports System
Imports System.Drawing
Imports System.Collections

Namespace ComponenteGrafico

    '*********************************************************************
    ' http://www.asp.net 
    ' StartKIT
    ' Chart Class
    '
    ' Base class implementation for BarChart and PieChart
    '
    '*********************************************************************

    Public MustInherit Class Chart
        Private _colorLimit As Integer = 12

        Private _color As Color() = {Color.Chocolate, Color.YellowGreen, Color.Olive, Color.DarkKhaki, Color.Sienna, Color.PaleGoldenrod, Color.Peru, Color.Tan, Color.Khaki, Color.DarkGoldenrod, Color.Maroon, Color.OliveDrab}

        ' Represent collection of all data points for the chart
        Private _dataPoints As New ChartItemsCollection

        ' The implementation of this method is provided by derived classes
        Public MustOverride Function Draw() As Bitmap

        Public Property DataPoints() As ChartItemsCollection
            Get
                Return _dataPoints
            End Get
            Set(ByVal Value As ChartItemsCollection)
                _dataPoints = Value
            End Set
        End Property

        Public Sub SetColor(ByVal index As Integer, ByVal NewColor As Color)
            If index < _colorLimit Then
                _color(index) = NewColor
            Else
                Throw New Exception("Color Limit is " + _colorLimit)
            End If
        End Sub 'SetColor

        Public Function GetColor(ByVal index As Integer) As Color
            If index < _colorLimit Then
                Return _color(index)
            Else
                Throw New Exception("Color Limit is " + _colorLimit)
            End If
        End Function 'GetColor
    End Class 'Chart
End Namespace

⌨️ 快捷键说明

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