-
Notifications
You must be signed in to change notification settings - Fork 0
/
adjusting_axis
93 lines (90 loc) · 2.25 KB
/
adjusting_axis
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# One graph
Sub sample01 ()
Dim xytitle As chart
Set xytitle = Worksheets("graph").ChartObjects(1).chart
With xytitle.axes(xlCategory)
.HasTitle = True
.AxisTitle.Text = "Genotype"
.AxisTitle.Font.Size = 16
.AxisTitle.Font.Bold = False
End With
With xytitle.axes(xlValue)
.HasTitle = True
.AxisTitle.Text = "Yield(kh/ha)"
.MaximumScale = 150
.MajorUnit = 30
.AxisTitle.Font.Size = 16
.AxisTitle.Font.Bold = False
End With
End Sub
## Several graphs
Sub sample01 ()
Dim xytitle As chart
Set xytitle = Worksheets("graph").ChartObjects(1).chart
With xytitle.axes(xlCategory)
.HasTitle = True
.AxisTitle.Text = "Genotype"
.AxisTitle.Font.Size = 16
.AxisTitle.Font.Bold = False
End With
With xytitle.axes(xlValue)
.HasTitle = True
.AxisTitle.Text = "Yield(kh/ha)"
.MaximumScale = 150
.MajorUnit = 30
.AxisTitle.Font.Size = 16
.AxisTitle.Font.Bold = False
End With
Set xytitle = Worksheets("graph").ChartObjects(2).chart
With xytitle.axes(xlCategory)
.HasTitle = True
.AxisTitle.Text = "Genotype"
.AxisTitle.Font.Size = 16
.AxisTitle.Font.Bold = False
End With
With xytitle.axes(xlValue)
.HasTitle = True
.AxisTitle.Text = "Yield(kh/ha)"
.MaximumScale = 150
.MajorUnit = 30
.AxisTitle.Font.Size = 16
.AxisTitle.Font.Bold = False
End With
Set xytitle = Worksheets("graph").ChartObjects(3).chart
With xytitle.axes(xlCategory)
.HasTitle = True
.AxisTitle.Text = "Genotype"
.AxisTitle.Font.Size = 16
.AxisTitle.Font.Bold = False
End With
With xytitle.axes(xlValue)
.HasTitle = True
.AxisTitle.Text = "Yield(kh/ha)"
.MaximumScale = 150
.MajorUnit = 30
.AxisTitle.Font.Size = 16
.AxisTitle.Font.Bold = False
End With
End Sub
# For Next
Sub sample02 ()
Dim xytile As Chart
Dim i As Integer
For i = 1 To 6
Set xytitle = Worksheets("graph").ChartObjects(i).Chart
With xytitle.Axes(xlCategory)
.HasTitle = True
.AxisTitle.Text = "Genoytpe"
.AxisTitle.Font.Size = 16
.AxisTitle.Font.Bold = False
End With
With xytitle.Axes(xlValue)
.HasTitle = True
.AxisTitle.Text = "Yield(kg/ha)"
.MaximumScale = 150
.MajorUnit = 30
.AxisTitle.Font.Size = 16
.AxisTitle.Font.Bold = False
End With
Next
End Sub