|
大家好!
1 10 100 1000 10000 100000 300 3000 40000 2500 3500 200000 15000 350000 23000 24000 36000 12345 23456是横坐标
4 5 6 7 8 9 8 5 7 8 10 9 5 13 14 6 9 4 7纵坐标1,位于图左边
20 6 25 40 60 30 36 45 67 56 66 56 45 66 77 55 56 57 78纵坐标2,图右边
以上为三行数据,要求两个纵坐标一个横坐标,横坐标要以10的n次幂为刻度。
即 1 10 100 1000 10000 100000 1000000 等等,我计算出来最小值是1,最大应该用1000000
问题是如何将第一行上横坐标,也就是表中的第一列中的数值嵌入这些10的n次幂中去,
使得坐标相匹配,我的代码如下,坐标刻度是有的,只是横坐标的位置不对,请问谁有什么好方法么?
Private Sub CommandButton1_Click()
Dim addr As String
Dim addr1 As String
Dim selrange1 As Range
Dim str
Dim str1 As String
Dim str2
Dim i, j, h, k As Integer
Dim selrange As Range
Dim str3
Dim stri1, stri2 As String
Dim niedrig, hoch As Integer
Dim zeichen As Integer
zeichen = 1
niedrig = 0
hoch = 1
stri2 = 1
addr = Me.RefEdit1.Value
Set selrange = Range(addr)
h = selrange.Rows.Count
ReDim str(1 To h)
ReDim str2(1 To h - 1)
str(1) = selrange.Cells(1, 1)
For i = 2 To h
str(i) = Log(selrange.Cells(i, 1)) / Log(10)
Next i
For i = 1 To h - 1
str2(i) = str(i + 1)
Next i
addr1 = Me.RefEdit2.Value
Set selrange1 = Range(addr1)
str1 = Me.ComboBox1.Value
stri1 = selrange.Cells(h, 1)
For i = 1 To Len(stri1)
stri2 = 10 * stri2
Next i
ReDim str3(1 To Len(stri1) + 2)
str3(1) = 0
str3(2) = 1
For i = 3 To Len(stri1) + 2
str3(i) = 10 ^ (i - 2)
Next i
Range(addr1).Select
Charts.Add
ActiveChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:= _
"Linien auf zwei Achsen"
ActiveChart.SetSourceData Source:=Sheets(str1).Range(addr1), PlotBy _
:=xlColumns
ActiveChart.SeriesCollection(1).XValues = str3
ActiveChart.Location Where:=xlLocationAsObject, Name:=str1
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = str(1)
.Axes(xlValue, xlPrimary).HasTitle = False
.Axes(xlCategory, xlSecondary).HasTitle = False
.Axes(xlValue, xlSecondary).HasTitle = False
End With
End Sub
Private Sub UserForm_Initialize()
Dim str
Dim j As Integer
j = Worksheets.Count
ReDim str(i To j)
For i = 1 To Worksheets.Count
str(i) = Worksheets(i).Name
Next i
For i = 1 To Worksheets.Count
Me.ComboBox1.AddItem str(i)
Next i
End Sub
[ 本帖最后由 天各一方2011 于 2011-1-22 22:34 编辑 ] |
|