Skip to content

Commit 92c5fa9

Browse files
committed
updating doc contents
1 parent 49c6314 commit 92c5fa9

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

Sources/SwiftViz/Scale.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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_.
2224
public 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

Sources/SwiftViz/Tick.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import CoreGraphics
99
import Foundation
1010

1111
/// A Tick is a visual representation of a point along an axis.
12-
/// When created based on a range, it includes a location along a single direction
12+
///
13+
/// When created based on a range, a tick includes a location along a single direction
1314
/// and a textual representation. It is meant to be created using a Scale, with some input domain
1415
/// being mapped to visualization using the Scale's output range.
1516
public protocol Tick: Identifiable {

0 commit comments

Comments
 (0)