Simple Mechanism Scales Java Charts
Original Publication Date: 2000-Mar-01
Included in the Prior Art Database: 2003-Jun-18
In developing program that use charts, one of the difficulties that must be overcome is the scaling of the data to fit the chart size.
In the scaling of charts, one has two options. The first involves using floating point calculations. In this option the developer is relying on the programming language operating system to round off truncate the floating point data to integers as it is applied to the chart. In x-y charts this can yield discontinuities or 2 y values at the same x value. The second option uses integer arithmetic instead of floating point. The advantage of integer arithmetic is speed of execution and control of the truncation. This invention disclosure describes an improvement to the scaling process for integer arithmetic.
Let r be the number of data points to be charted and let s be the number of pixels that r is to be charted in. With no lose of generality, let s r. If s r (by a factor of 4 or greater) then simple integer division will yield an acceptable result. If s r are of the same magnitude, then an acceptable ratio (number of data points and pixels to be skipped) must be found.
Historically this was done by multiplying r by 10 and dividing the result by s (q= 10*r/s) and using the ratio of 10 and the result (q). Since r