Constructors
TickLayout
#Create a new numberline layout. Note you would almost never do this yourself, as the Create(LineF, decimal, decimal, Properties) and Create(RectangleF, decimal, decimal, Properties) methods do all the heavy lifting. You only need to populate your own numberline layout if you want non-standard things such as custom formatting or non-linear mapping.
Properties
Indexers
Methods
Create
#public static TickLayout Create(LineF axis, decimal t0, decimal t1, Properties properties, int finest, Func<int, float> tickLength, LabelOpacity labelOpacity)
Create a number line layout with an explicit finest tick class. Unlike Create(LineF, decimal, decimal, Properties) the visibility of ticks is not derived from their spacing. Every power-of-ten class is either drawn or not, and its tick length is supplied by the caller, which allows the caller to animate classes in and out over time. Labels are organised in rungs, from coarse to fine: all labels of a class, then the halfway labels between them, then all labels of the class below, and so on. A rung fits when its label pitch exceeds the widest label visible at that rung.
Parameters:
| axis (LineF) | Visible portion of the numberline. Must be strictly horizontal. |
| t0 (decimal) | Limit value along left end of axis. |
| t1 (decimal) | Limit value along right end of axis. |
| properties (Properties) | Properties. |
| finest (int) | Exponent of the finest tick class. Ticks of this class are drawn in the SHORT style, coarser ticks in the LONG style. Labels are only considered for the finest class and coarser. |
| tickLength (Func<int, float>) | Pixel length per power-of-ten class exponent. Zero or less means the class is not drawn. The class directly below the finest one is included while it still has a positive length, so it can animate away. |
| labelOpacity (TickLayout.LabelOpacity) | Opacity per label rung. Callers that do not animate can return one when the rung fits and zero otherwise. |
Create
#Create a number line layout.
Parameters:
| axis (LineF) | Visible portion of the numberline. Must be strictly horizontal. |
| t0 (decimal) | Limit value along left end of axis. |
| t1 (decimal) | Limit value along right end of axis. |
| properties (Properties) | Properties. |
Create
#Create a number line layout within a box.
Parameters:
| bounds (RectangleF) | Bounds. The number-line will either be aligned along the top, middle or bottom of the bounds depending on the tick and label style. |
| t0 (decimal) | Limit value along left end of box. |
| t1 (decimal) | Limit value along right end of box. |
| properties (Properties) | Properties. |
FormatLabel
#Format a tick label. Round values of a hundred thousand and up use an SI prefix (k, M, G, T) so that 10,000,000 reads as 10M. Tick values are small multiples of a power of ten, so the mantissa is always short.
Parameters:
| value (decimal) | Tick value. |
Returns: Label text.
SmallestTickExponent
#Compute the power-of-ten exponent of the smallest tick class that would be laid out along an axis of the given range and pixel width.