「來調節車自動查找邏輯依據我放在那裏的數據(即邏輯間隔)「。
這是一個很有趣。這是一個VBA函數,可以計算滴答之間的相當時間間隔。
Public Function prettyVal(_
xMin As Double, _
xMax As Double, _
minBins As Integer) _
As Double
'' returns an aesthetic interval size to _
use for a plot axis or histogram bin. _
[email protected] 2010-09-01
Dim pretties
pretties = Array(1, 2, 5, 10)
Dim maxBin As Double ''maximum size of bin
Dim xScale As Double ''scale factor
With WorksheetFunction
maxBin = (xMax - xMin)/minBins
xScale = 10^Int(.Log10(maxBin))
prettyVal = xScale * .Lookup(maxBin/xScale, pretties)
End With
End Function
你會想在工作表中使用它。使用最小值和最大值的地板和天花板以及重要值。這使他們也很漂亮。在工作表中有這樣的東西:
minimum plot value minVal 120
maximum plot value maxVal 980
minimum num of bins minBins 10
pretty bin size binsize 50 =prettyVal(minVal,maxVal,minBins)
low axis value minEdge 100 =FLOOR(minVal,binsize)
high axis value maxEdge 1000 =CEILING(maxVal,binsize)
number of bins numBins 18 =(maxEdge-minEdge)/binsize
享受。