Skip to content

Commit e4d2279

Browse files
committed
Change the condition so that the selected step is greater or equal to the computed minimum distance when selecting a step size.
1 parent 147815d commit e4d2279

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

app/rtplot/src/main/java/org/csstudio/javafx/rtplot/internal/LinearTicks.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,25 +254,24 @@ public static int determinePrecision(final double number)
254254
* A computed distance of 6.1 turns into 10.0, not 5.0.
255255
* @see #selectNiceStep(double)
256256
*/
257-
final private static double[] NICE_STEPS = { 10.0, 5.0, 2.0, 1.0 },
258-
NICE_THRESHOLDS = { 6.0, 3.0, 1.2, 0.0 };
257+
final private static double[] NICE_STEPS = { 1.0, 2.0, 5.0, 10.0 };
259258

260259
/** To a human viewer, tick distances of 5.0 are easier to see
261260
* than for example 7.
262261
*
263262
* <p>This method tries to adjust a computed tick distance
264263
* to one that is hopefully 'nicer'
265264
*
266-
* @param distance Original step distance
265+
* @param min_distance Original step distance
267266
* @return
268267
*/
269-
public static double selectNiceStep(final double distance)
268+
public static double selectNiceStep(final double min_distance)
270269
{
271-
final double log = Math.log10(distance);
270+
final double log = Math.log10(min_distance);
272271
final double order_of_magnitude = Math.pow(10, Math.floor(log));
273-
final double step = distance / order_of_magnitude;
272+
final double step = min_distance / order_of_magnitude;
274273
for (int i=0; i<NICE_STEPS.length; ++i)
275-
if (step >= NICE_THRESHOLDS[i])
274+
if (NICE_STEPS[i] * order_of_magnitude >= min_distance)
276275
return NICE_STEPS[i] * order_of_magnitude;
277276
return step * order_of_magnitude;
278277
}

app/rtplot/src/main/java/org/csstudio/javafx/rtplot/internal/Ticks.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public abstract class Ticks<XTYPE>
2525
protected volatile List<MinorTick<XTYPE>> minor_ticks = Collections.emptyList();
2626

2727
/** How many percent of the available space should be used for labels? */
28-
final public static int FILL_PERCENTAGE = 60;
28+
final public static int FILL_PERCENTAGE = 70;
2929

3030
/** Used to adjust a range to a meaningful range for the chosen scale.
3131
* @param low Desired low limit of the axis range.

0 commit comments

Comments
 (0)