Re: rounding a number




"""arman писал(а):
"""
Hi,
How do you round some arbitrary number to the 10 multiplier? I need to
make a graph. The y-axis is dependent on the result of the
computation.
If the maximum value of the y-axis, say for example 278, then I want
the y-axis to have a maximum of 300, or if it 2435 then I want the
maximum of 2500. So, basically it has to convert an arbitrary number
into some integer number that can be divided by 10.

thanks in advance,
-arman-

Here is the part of my program that automatically fits axes and draws
the graph.

xdiap=fmaxx-fminx !finding steps
ydiap=fmaxy-fminy

stepx=10D0**(dnint(dlog10(xdiap)))
123 continue
if(xdiap.lt.stepx*3d0) stepx=stepx/4.d0
if(xdiap.lt.stepx*3d0) stepx=stepx/5.d0
if(xdiap.lt.stepx*3D0) then
stepx=stepx/5d0
goto 123
end if
end if

stepy=1.d1**(dnint(dlog10(ydiap)))
124 continue
if(ydiap.lt.stepy*10D0) stepy=stepy/4.d0
if(ydiap.lt.stepy*10D0) stepy=stepy/5.d0
if(ydiap.lt.stepy*10D0) then
stepy=stepy/5.d0
goto 124
end if
62 if(ydiap.gt.stepy*1.5d1) then
stepy=stepy*2.d0
goto 62
end if

129 continue

!______________________________________________________
!finding axis location (location of first grid line)

yaxisloc=stepx*dint(fminx/stepx)+2.d0*stepx
if(yaxisloc.gt.1.5d0*stepx+fminx)yaxisloc=yaxisloc-stepx
if(yaxisloc.lt.0.4d0*stepx+fminx)yaxisloc=yaxisloc+stepx


xaxisloc=stepy*dint(fminy/stepy)+2.d0*stepy
if(xaxisloc.gt.1.5d0*stepy+fminy)xaxisloc=xaxisloc-stepy
if(xaxisloc.lt.0.4d0*stepy+fminy)xaxisloc=xaxisloc+stepy

!then add stepx or stepy and draw grid lines

.



Relevant Pages

  • Re: Court authorized wiretaps in the U.S. surged last year
    ... >> Draw a graph. ... Y-axis is how much harm is done to the users of those drugs. ...
    (sci.electronics.design)
  • Re: MSGraph Bars not drawing in right proportion
    ... I had already cleared the walls and Y-axis, so there was no y-axis to click ... It IS available for sametype of graph in Excel chart options, ... not bar - Chart Type ... there is specific Scale tab available for Y-axis in Column ...
    (microsoft.public.access.reports)
  • y-axis titles get cut off
    ... When I make a graph in Excel, ... in the title for the y-axis, and depending how long it is, the last ... Does anyone know why this happens, and how to fix it? ...
    (microsoft.public.excel)
  • Re: Creating/programming an Excel dynamic graph
    ... > B I also apply conditional formatting to make the cell color change ... > create a graph with my 20 variables on the x-axis (and in general the ... variable 2 has impact 1 and has a green bar ... > height 1 on the y-axis. ...
    (microsoft.public.excel.programming)
  • Creating/programming an Excel dynamic graph
    ... also apply conditional formatting to make the cell color change ... amount of variables for a graph is variable) and has the impact values ... variable 2 has impact 1 and has a green bar with ... height 1 on the y-axis. ...
    (microsoft.public.excel.programming)