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

📄 labels.frm

📁 Delphi Component - Chart Fx
💻 FRM
字号:
VERSION 5.00
Object = "{8996B0A4-D7BE-101B-8650-00AA003A5593}#4.0#0"; "CFX4032.OCX"
Begin VB.Form Form1 
   Caption         =   "Chart FX. Labels and Titles"
   ClientHeight    =   4605
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8760
   LinkTopic       =   "Form1"
   ScaleHeight     =   4605
   ScaleWidth      =   8760
   StartUpPosition =   3  'Windows Default
   Begin VB.CheckBox Check2 
      Caption         =   "Customize Point Labels"
      Height          =   495
      Left            =   7200
      TabIndex        =   6
      Top             =   2640
      Width           =   1215
   End
   Begin VB.CheckBox Check1 
      Caption         =   "Customize Y Axis Labels"
      Height          =   495
      Left            =   7200
      TabIndex        =   5
      Top             =   2040
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Y Axis Labels"
      Height          =   375
      Left            =   7200
      TabIndex        =   4
      Top             =   600
      Width           =   1455
   End
   Begin ChartfxLibCtl.ChartFX ChartFX1 
      Height          =   4575
      Left            =   0
      TabIndex        =   3
      Top             =   0
      Width           =   7095
      _cx             =   1710371043
      _cy             =   1710366598
      _Version        =   262144
      TypeMask        =   109576204
      View3DDepth     =   40
      MarkerShape     =   0
      BorderColor     =   1
      RGB2DBk         =   -2147483633
      nColors         =   2
      nPts            =   10
      NumPoint        =   10
      BorderS         =   0
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Titles"
      Height          =   375
      Left            =   7200
      TabIndex        =   2
      Top             =   1560
      Width           =   1455
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Point Labels"
      Height          =   375
      Left            =   7200
      TabIndex        =   1
      Top             =   1080
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "X Axis Labels"
      Height          =   375
      Left            =   7200
      TabIndex        =   0
      Top             =   120
      Width           =   1455
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub ChartFX1_GetAxisLabel(ByVal nAxis As Integer, nRes As Integer)
    If (Check1.Value) Then
        ChartFX1.HText = "Custom " + ChartFX1.HText
        nRes = 1
    End If
End Sub

Private Sub ChartFX1_GetPointLabel(ByVal nSerie As Integer, ByVal nPoint As Long, nRes As Integer)
    If (Check2.Value) Then
        ChartFX1.HText = "#" & ChartFX1.HText & "#"
        nRes = 1
    End If
End Sub

Private Sub Check1_Click()
    ' Custom Y-Axis labels. Make room
    If Check1 Then
        ChartFX1.LeftGap = ChartFX1.LeftGap + 40
    Else
        ChartFX1.LeftGap = ChartFX1.LeftGap - 40
    End If
End Sub

Private Sub Check2_Click()
    ChartFX1.PointLabels = True
    ChartFX1.Refresh
End Sub

Private Sub Command1_Click()
    
    Dim i As Integer
    
    'assign each label
    For i = 0 To 9
        ChartFX1.Legend(i) = DateAdd("d", i, Date)
    Next i
        
    ' X Axis format
    With ChartFX1.Axis(AXIS_X)
        'set the text color of the x and y axis labels
        .TextColor = RGB(255, 255, 255)
        'set the font properties for the x axis labels
        With .Font
            .Bold = False
            .Italic = True
            .Size = 10
            .Name = "Times New Roman"
        End With
        'set the style in which the labels should display
        .Style = (.Style Or AS_2LEVELS Or AS_CENTERED) And Not AS_LONGTICK
    End With
End Sub

Private Sub Command2_Click()
    Dim i As Integer
    
    'the interval between 2 consecutive tickmarks is equal to 10
    ChartFX1.Axis(AXIS_Y).LabelValue = 10
    
    'assign each label
    For i = 0 To 9
        ChartFX1.Axis(AXIS_Y).Label(i) = "Label " & Str(i)
    Next i
    
    With ChartFX1.Axis(AXIS_Y)
        'set the text color of the y axis labels
        .TextColor = RGB(255, 255, 255)
        'set the font properties for the y axis labels
        With .Font
            .Bold = False
            .Italic = True
            .Size = 10
            .Name = "Times New Roman"
        End With
    End With
        
End Sub

Private Sub Command3_Click()
    'show the point labels for all series
    ChartFX1.PointLabels = True
           
    'set the font properties for the point labels
    With ChartFX1.PointLabelsFont
        .Name = "Courier New"
        .Size = 8
    End With
        
    'set the text color for the point labels
    ChartFX1.RGBFont(CHART_VALUESFT) = RGB(0, 0, 0)
    
    'set the angle of the point labels
    
    ChartFX1.Series(0).PointLabelAngle = -45
    ChartFX1.Series(1).PointLabelAngle = 45
    
    'set the point labels to be aligned to the left of the marker
    ChartFX1.Series(0).PointLabelAlign = LA_RIGHT Or LA_TOP
    
    'set the point labels to be aligned to the right of the marker
    ChartFX1.Series(1).PointLabelAlign = LA_LEFT Or LA_BASELINE
End Sub

Private Sub Command4_Click()
    ' Y Axis title
    With ChartFX1.Axis(AXIS_Y)
        .Title = "Y Axis Title"
        .TitleColor = RGB(255, 255, 255)
        .TitleFont.Italic = True
        .TitleFont.Bold = True
        .TitleFont.Name = "Arial"
        .TitleFont.Size = 12
    End With
    
    ' X Axis title
    With ChartFX1.Axis(AXIS_X)
        .Title = "X Axis Title"
        .TitleColor = RGB(255, 255, 255)
        .TitleFont.Italic = True
        .TitleFont.Bold = True
        .TitleFont.Name = "Arial"
        .TitleFont.Size = 12
    End With
    
    ' Top title
    ChartFX1.Title(CHART_TOPTIT) = "Labels and Titles"
    ChartFX1.Fonts(CHART_TOPTIT) = CF_BOLD Or CF_ITALIC Or 16
    ChartFX1.RGBFont(CHART_TOPTIT) = RGB(255, 255, 255)
End Sub

Private Sub Form_Load()
    Dim i As Integer
    
    ' Initializa data
    ChartFX1.OpenDataEx COD_VALUES, 2, 10
    For i = 0 To 9
        ChartFX1.ValueEx(0, i) = 10 + Rnd * 40
        ChartFX1.ValueEx(1, i) = 60 + Rnd * 30
    Next i
    ChartFX1.CloseData COD_VALUES
    
    ' Enable Y-Axis notification events for advanced customization
    ChartFX1.Axis(AXIS_Y).Style = ChartFX1.Axis(AXIS_Y).Style Or AS_NOTIFY
End Sub

⌨️ 快捷键说明

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