Continuous, Discrete, and reversible scales
Pre-releaseA significant (and API breaking) update as Scale was more aggressively used supporting a charting DSL library still in development. The continuous scales were both expanding and combined to support Linear, Log, Power, or Radial scales - and can be utilized through a type-erased AnyContinuousScale. Discrete scales that return a band or a point were also created. Tick values were revised, and the API for accessing and using the scales evolved as the use cases for what information was available at different parts of the lifecycle of a declarative syntax came into focus.
The initial scale creation is now set up such that you can create a scale, then define a "domain" upon it, or update that domain. The pieces for computing a scale value require a range to be set, and reversibility of that mapping was enabled as well in any of the APIs that accept range values. The ranges can be defined as a single value (inferring 0 for the other value), two values, or a swift range instance. All modifier methods return a copy of the scale with the relevant values updated so that the scale can be passed along and more easily used in a functional style setting.
While the structure for the continuous scales seems pretty solid at this point, the discrete scales may see quite a bit of alteration down the road. In particular, the idea of returning a Band structure as a result of a scaling operation rather than a singular value can make for awkward usage scenarios, although the structure itself is useful for bar charts. It may be better as something computer after the fact, and keep the scale (or invert) operations more consistent across the scale APIs.
Scaling that maps through the realm of dates or colors - in discrete or continuous forms - is still pending, and I expect the next revision cycle for scale will accommodate those and the implementation and usage of those scales will potentially set up further changes going forward.
My current thinking for a stable API is to get the discrete color and date/time oriented scales created, and use them in implementations to vet them, before reviewing the API as a whole and locking it down a bit more for backwards compatibility. The primary consumer of this API so far is Chart, now functional but still rapidly evolving. Some discussion of how scale is used and what's needed is included within the chart discussions.
Future updates will include at least a beta release before a 1.0.0 release which will mark backwards compatibility as standard with semantic versioning.
What's Changed
- Add CGFloat output type scale implementations by @heckj in #9
- Declarative initializer by @heckj in #10
- Creating band and point scales by @heckj in #11
- Reset continuous scales to modifier pattern by @heckj in #12
- Documentation updates by @heckj in #13
- Add type erased AnyContinuousScale by @heckj in #14
- Add radial scale with tests by @heckj in #15
- Extending Scale type to accommodate range by @heckj in #17
- Add domain modifier with 'nice' by @heckj in #18
- Add a single domain value by @heckj in #19
- Simplify Tick considerably after some usage by @heckj in #20
- Adding Ticks to AnyContinuousScale by @heckj in #21
- Ticks protocol by @heckj in #22
- Tick updates by @heckj in #23
- Fixing doc references as library has evolved by @heckj in #24
- Reversed mapping by @heckj in #26
New Contributors
Full Changelog: 0.5.0...0.6.0