Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!ucsd!ucbvax!bloom-beacon!LARRY.MCRCIM.MCGILL.EDU!mouse From: mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) Newsgroups: comp.windows.x Subject: Re: zooming time scales Message-ID: <9005312154.AA01265@Larry.McRCIM.McGill.EDU> Date: 31 May 90 21:54:31 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 81 > [ problem: wants to choose a "nice" tick interval for a given time > interval ] It's not directly what you want, but we once designed the following code to do something similar for floating-point intervals. You may be able to abstract some ideas from it for your needs. (This is not compilable as it stands; it is intended as illustrative rather than as a plug-&-play solution.) #define NUM_DIVISIONS 10 /* we want approx. 10 ticks per axis */ double findScale(min, max) double min; double max; { double delta; double minScale; double scale; static int factor[] = { 1, 2, 5 }; int i; delta = FABS(max - min)/NUM_DIVISIONS; minScale = FABS(max - min); for (i=0; i