@@ -19,6 +19,8 @@ import Foundation
1919
2020// D3's scale also has a .nice() function that does some pleasant rounding of the domain,
2121// extending it slightly so that it's nicer to view
22+
23+ /// A scale maps values from an input _domain_ to an output _range_.
2224public protocol Scale {
2325 associatedtype InputType : Comparable
2426 associatedtype TickType : Tick
@@ -39,19 +41,20 @@ public protocol Scale {
3941 });
4042 */
4143
42- // clamped forces constraints on both the domain and the range. Any scaled values
43- // will be constrained the output range, and any inverted values will be constrained
44- // to the input domain.
44+ /// A boolean value that indicates whether the output vales are constrained to the min and max of the output range.
45+ ///
46+ /// If `true`, values processed by the scale are constrained to the output range, and values processed backwards through the scale
47+ /// are constrained to the input domain.
4548 var isClamped : Bool { get }
4649
47- // input values
50+ /// The range of input values
4851 var domain : ClosedRange < InputType > { get }
4952 // a variant of this might want to use ClosedRange<Int> - or maybe something that isn't even a range...
5053
5154 // output values
5255 // var range: ClosedRange<Double> { get }
5356
54- /// converts a value between the input "domain" and output "range"
57+ /// Converts a value between the input _domain_ and output _range_
5558 ///
5659 /// - Parameter inputValue: a value within the bounds of the
5760 /// ClosedRange for domain
@@ -61,8 +64,9 @@ public protocol Scale {
6164 /// for range, or NaN if it maps outside the bounds
6265 func scale( _ inputValue: InputType , range: ClosedRange < CGFloat > ) -> CGFloat
6366
64- /// converts back from the output "range" to a value within
65- /// the input "domain". The inverse of scale()
67+ /// Converts back from the output _range_ to a value within the input _domain_.
68+ ///
69+ /// The inverse of ``scale(_:range:)``.
6670 ///
6771 /// - Parameter outputValue: a value within the bounds of the
6872 /// ClosedRange for range
@@ -72,8 +76,7 @@ public protocol Scale {
7276 /// for domain, or NaN if it maps outside the bounds
7377 func invert( _ outputValue: CGFloat , range: ClosedRange < CGFloat > ) -> InputType
7478
75- /// returns an array of the locations within the ClosedRange of
76- /// range to locate ticks for the scale
79+ /// Returns an array of the locations within the output range to locate ticks for the scale.
7780 ///
7881 /// - Parameter count: a number of ticks to display, defaulting to 10
7982 /// - Parameter range: a ClosedRange representing the representing
0 commit comments