Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Scale Methos

Status
Not open for further replies.

geoscan

Programmer
Oct 15, 2008
4
US
Hi everyone,

I am new to this forum and this is my first post to the tek-tips. I am trying to generate a scale for plotting points on a report. While searching the net I came across the following code placed in a report's OnFormat event of the Detail section.

Code:
Dim td As Double
Dim X As Single, Y As Single, K As Long, J As Double, I As Double, V As Double

td = Log(10)  '---generate/draw Logarithmic Scale
Me.Scale (-2, 0)-(4, 3) '--- determines the Log cycles
For K = -2 To 3
J = 10 ^ K
    For I = J To 10 * J Step J
      X = Log(I) / td
      If I = J Then
        Me.DrawWidth = 3
      End If
      Me.Line (X, 0)-(X, Me.ScaleHeight)
      If I = J Then
        Me.CurrentY = Me.ScaleHeight - Me.TextHeight("W")
        Me.Print I
      End If
    Next I
Next K

'-----Plot points at coordinates (V,Y)
V = 0.07
Y = 1.5
  X = Log(V) / td
  Me.ForeColor = vbRed
  Me.DrawWidth = 50
  Me.PSet (X, Y)
  Me.DrawWidth = 1
  Me.ForeColor = vbBlack


The code works fine except I am having problems figuring out how to control the location/position of the scale. Is there a way to move the upper left corner to lets say 2" from the left and 3" from the top of the page?

Also, is this an efficient way of plotting a set of x,y points (I have the equation in the form of f(x)=.....)?

Any help is greatly appreciated. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top