Table of Contents

Method NiceStep

Namespace
DocWright.Core.Primitives
Assembly
DocWright.Core.dll

NiceStep(double)

Rounds a raw interval up to the 1/2/5 ladder: the smallest of 1, 2, 5 or 10 times a power of ten that is not smaller than it.

public static double NiceStep(double raw)

Parameters

raw double

The interval to round up. Must be finite and greater than zero.

Returns

double

The rounded interval, or 1 when raw is not a usable number.

Remarks

The comparisons are inclusive at each rung — a raw interval of exactly 2 gives 2, not 5 — which is what makes a data maximum of 12 produce a step of 2 rather than 5.