Browse Prior Art Database

Simple Mechanism Scales Java Charts

IP.com Disclosure Number: IPCOM000013877D
Original Publication Date: 2000-Mar-01
Included in the Prior Art Database: 2003-Jun-18
Document File: 1 page(s) / 39K

Publishing Venue

IBM

Abstract

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

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 80% of the total text.

Page 1 of 1

Simple Mechanism Scales Java Charts

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<s, clearly q < 10. The greatest common divisor (GCD) was then divided out of the ratio to yield the scaling factors.

The improvement to this algorithm is to use 12 instead of 10 t...