@@ -10,7 +10,7 @@ _SwiftNiceScale_ is part of the [OpenAlloc](https://github.com/openalloc) family
10
10
11
11
## NiceScale
12
12
13
- <img src =" https://github.com/openalloc/SwiftNiceScale/blob/main/Images/naive_nice.png " width =" 1049 " height =" 319 " />
13
+ <img src =" https://github.com/openalloc/SwiftNiceScale/blob/main/Images/naive_nice.png " width =" 525 " height =" 160 " />
14
14
15
15
``` swift
16
16
let ns = NiceScale (105 ... 543 , desiredTicks : 5 )
@@ -49,41 +49,45 @@ The initialization values are also available as properties:
49
49
50
50
Computed properties are lazy, meaning that they are only calculated when first needed.
51
51
52
+ The basic set of properties...
53
+
54
+ - ` var range: NiceScale<T>.ValueRange ` - The calculated ‘nice’ range, which should include the ‘raw’ range used to initialize this object.
55
+
52
56
- ` var extent: T ` - The distance between bounds of the range.
53
57
54
- - ` var hasNegativeRange: Bool ` - If true, the range includes negative values .
58
+ - ` var ticks: Int ` - The number of ticks in the range. This may differ from the ` desiredTicks ` used to initialize the object .
55
59
56
- - ` var hasPositiveRange: Bool ` - If true, the range includes positive values .
60
+ - ` var tickInterval: T ` - The distance between ticks in the range .
57
61
58
- - ` var negativeExtent: T ` - If there’s a negative portion of range, the distance between its lower bound and 0. A non-negative value .
62
+ - ` var tickValues: [T] ` - The values for the ticks in the range .
59
63
60
- - ` var negativeExtentUnit: T? ` - The negativeExtent, expressed as unit value in the range 0…1 .
64
+ - ` var tickFractionDigits: Int ` - Number of fractional digits to show in tick label values .
61
65
62
- - ` var negativeRange: NiceScale<T>.ValueRange ` - The portion of the range that is negative. 0…0 if none .
66
+ More specialized properties dealing with positive and negative portions of scale.. .
63
67
64
- - ` var positiveExtent: T ` - If there’s a positive portion of range , the distance between its upper bound and 0. A non- negative value .
68
+ - ` var hasNegativeRange: Bool ` - If true , the range includes negative values .
65
69
66
- - ` var positiveExtentUnit: T? ` - The positiveExtent, expressed as unit value in the range 0…1 .
70
+ - ` var hasPositiveRange: Bool ` - If true, the range includes positive values .
67
71
68
- - ` var positiveRange : NiceScale<T>.ValueRange ` - The portion of the range that is positive. 0…0 if none.
72
+ - ` var negativeRange : NiceScale<T>.ValueRange ` - The portion of the range that is negative. ` 0…0 ` if none.
69
73
70
- - ` var range : NiceScale<T>.ValueRange ` - The calculated ‘nice’ range, which should include the ‘raw’ range used to initialize this object .
74
+ - ` var positiveRange : NiceScale<T>.ValueRange ` - The portion of the range that is positive. ` 0…0 ` if none .
71
75
72
- - ` var tickFractionDigits: Int ` - Number of fractional digits to show in tick label values .
76
+ - ` var negativeExtent: T ` - If there’s a negative portion of range, the distance between its lower bound and 0. A non-negative value .
73
77
74
- - ` var tickInterval : T ` - The distance between ticks in the range .
78
+ - ` var positiveExtent : T ` - If there’s a positive portion of range, the distance between its upper bound and 0. A non-negative value .
75
79
76
- - ` var tickValues: [T] ` - The values for the ticks in the range.
80
+ - ` var negativeExtentUnit: T? ` - The negativeExtent, expressed as unit value in the range ` 0…1 ` .
77
81
78
- - ` var ticks: Int ` - The number of ticks in the range. This may differ from the desiredTicks used to initialize the object .
82
+ - ` var positiveExtentUnit: T? ` - The positiveExtent, expressed as unit value in the range ` 0…1 ` .
79
83
80
84
#### Instance Methods
81
85
82
- - ` func scaleToUnit(T) -> T ` - Scale value to 0…1 in the range.
86
+ - ` func scaleToUnit(T) -> T ` - Scale value to ` 0…1 ` in the range.
83
87
84
- - ` func scaleToUnitNegative(T) -> T ` - Scale value to 0…1 in the negative portion of range, if any.
88
+ - ` func scaleToUnitNegative(T) -> T ` - Scale value to ` 0…1 ` in the negative portion of range, if any.
85
89
86
- - ` func scaleToUnitPositive(T) -> T ` - Scale value to 0…1 in the positive portion of range, if any.
90
+ - ` func scaleToUnitPositive(T) -> T ` - Scale value to ` 0…1 ` in the positive portion of range, if any.
87
91
88
92
## See Also
89
93
0 commit comments