From f0e6bc03441fb9927a4e730b4a8dcff3238dbef4 Mon Sep 17 00:00:00 2001 From: Reed Es Date: Fri, 19 Nov 2021 22:33:26 -0700 Subject: [PATCH] improving README --- README.md | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index efd5719..ade0ea4 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ _SwiftNiceScale_ is part of the [OpenAlloc](https://github.com/openalloc) family ## NiceScale - + ```swift let ns = NiceScale(105...543, desiredTicks: 5) @@ -49,41 +49,45 @@ The initialization values are also available as properties: Computed properties are lazy, meaning that they are only calculated when first needed. +The basic set of properties... + +- `var range: NiceScale.ValueRange` - The calculated ‘nice’ range, which should include the ‘raw’ range used to initialize this object. + - `var extent: T` - The distance between bounds of the range. -- `var hasNegativeRange: Bool` - If true, the range includes negative values. +- `var ticks: Int` - The number of ticks in the range. This may differ from the `desiredTicks` used to initialize the object. -- `var hasPositiveRange: Bool` - If true, the range includes positive values. +- `var tickInterval: T` - The distance between ticks in the range. -- `var negativeExtent: T` - If there’s a negative portion of range, the distance between its lower bound and 0. A non-negative value. +- `var tickValues: [T]` - The values for the ticks in the range. -- `var negativeExtentUnit: T?` - The negativeExtent, expressed as unit value in the range 0…1. +- `var tickFractionDigits: Int` - Number of fractional digits to show in tick label values. -- `var negativeRange: NiceScale.ValueRange` - The portion of the range that is negative. 0…0 if none. +More specialized properties dealing with positive and negative portions of scale... -- `var positiveExtent: T` - If there’s a positive portion of range, the distance between its upper bound and 0. A non-negative value. +- `var hasNegativeRange: Bool` - If true, the range includes negative values. -- `var positiveExtentUnit: T?` - The positiveExtent, expressed as unit value in the range 0…1. +- `var hasPositiveRange: Bool` - If true, the range includes positive values. -- `var positiveRange: NiceScale.ValueRange` - The portion of the range that is positive. 0…0 if none. +- `var negativeRange: NiceScale.ValueRange` - The portion of the range that is negative. `0…0` if none. -- `var range: NiceScale.ValueRange` - The calculated ‘nice’ range, which should include the ‘raw’ range used to initialize this object. +- `var positiveRange: NiceScale.ValueRange` - The portion of the range that is positive. `0…0` if none. -- `var tickFractionDigits: Int` - Number of fractional digits to show in tick label values. +- `var negativeExtent: T` - If there’s a negative portion of range, the distance between its lower bound and 0. A non-negative value. -- `var tickInterval: T` - The distance between ticks in the range. +- `var positiveExtent: T` - If there’s a positive portion of range, the distance between its upper bound and 0. A non-negative value. -- `var tickValues: [T]` - The values for the ticks in the range. +- `var negativeExtentUnit: T?` - The negativeExtent, expressed as unit value in the range `0…1`. -- `var ticks: Int` - The number of ticks in the range. This may differ from the desiredTicks used to initialize the object. +- `var positiveExtentUnit: T?` - The positiveExtent, expressed as unit value in the range `0…1`. #### Instance Methods -- `func scaleToUnit(T) -> T` - Scale value to 0…1 in the range. +- `func scaleToUnit(T) -> T` - Scale value to `0…1` in the range. -- `func scaleToUnitNegative(T) -> T` - Scale value to 0…1 in the negative portion of range, if any. +- `func scaleToUnitNegative(T) -> T` - Scale value to `0…1` in the negative portion of range, if any. -- `func scaleToUnitPositive(T) -> T` - Scale value to 0…1 in the positive portion of range, if any. +- `func scaleToUnitPositive(T) -> T` - Scale value to `0…1` in the positive portion of range, if any. ## See Also