@ac-kit/model-chart 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/CHANGELOG.md +194 -0
  2. package/README.md +106 -0
  3. package/dist/geographic/index.d.ts +2 -0
  4. package/dist/geographic/index.d.ts.map +1 -0
  5. package/dist/geographic/index.js +2 -0
  6. package/dist/geographic/index.js.map +1 -0
  7. package/dist/geographic/project-geographic-layer.d.ts +54 -0
  8. package/dist/geographic/project-geographic-layer.d.ts.map +1 -0
  9. package/dist/geographic/project-geographic-layer.js +214 -0
  10. package/dist/geographic/project-geographic-layer.js.map +1 -0
  11. package/dist/index.d.ts +9 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +9 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/layout/_fit.d.ts +12 -0
  16. package/dist/layout/_fit.d.ts.map +1 -0
  17. package/dist/layout/_fit.js +52 -0
  18. package/dist/layout/_fit.js.map +1 -0
  19. package/dist/layout/index.d.ts +4 -0
  20. package/dist/layout/index.d.ts.map +1 -0
  21. package/dist/layout/index.js +4 -0
  22. package/dist/layout/index.js.map +1 -0
  23. package/dist/layout/layout-hierarchy.d.ts +35 -0
  24. package/dist/layout/layout-hierarchy.d.ts.map +1 -0
  25. package/dist/layout/layout-hierarchy.js +98 -0
  26. package/dist/layout/layout-hierarchy.js.map +1 -0
  27. package/dist/layout/layout-network.d.ts +45 -0
  28. package/dist/layout/layout-network.d.ts.map +1 -0
  29. package/dist/layout/layout-network.js +197 -0
  30. package/dist/layout/layout-network.js.map +1 -0
  31. package/dist/layout/options.d.ts +29 -0
  32. package/dist/layout/options.d.ts.map +1 -0
  33. package/dist/layout/options.js +2 -0
  34. package/dist/layout/options.js.map +1 -0
  35. package/dist/render/_fallback-chain.d.ts +13 -0
  36. package/dist/render/_fallback-chain.d.ts.map +1 -0
  37. package/dist/render/_fallback-chain.js +41 -0
  38. package/dist/render/_fallback-chain.js.map +1 -0
  39. package/dist/render/capabilities.d.ts +13 -0
  40. package/dist/render/capabilities.d.ts.map +1 -1
  41. package/dist/render/capabilities.js +40 -10
  42. package/dist/render/capabilities.js.map +1 -1
  43. package/dist/resolve/_calendar-interval.d.ts +10 -0
  44. package/dist/resolve/_calendar-interval.d.ts.map +1 -0
  45. package/dist/resolve/_calendar-interval.js +27 -0
  46. package/dist/resolve/_calendar-interval.js.map +1 -0
  47. package/dist/resolve/_coords.d.ts +35 -0
  48. package/dist/resolve/_coords.d.ts.map +1 -0
  49. package/dist/resolve/_coords.js +354 -0
  50. package/dist/resolve/_coords.js.map +1 -0
  51. package/dist/resolve/_grid-field.d.ts +16 -0
  52. package/dist/resolve/_grid-field.d.ts.map +1 -0
  53. package/dist/resolve/_grid-field.js +23 -0
  54. package/dist/resolve/_grid-field.js.map +1 -0
  55. package/dist/resolve/_guides.d.ts +16 -0
  56. package/dist/resolve/_guides.d.ts.map +1 -0
  57. package/dist/resolve/_guides.js +66 -0
  58. package/dist/resolve/_guides.js.map +1 -0
  59. package/dist/resolve/_options.d.ts +17 -0
  60. package/dist/resolve/_options.d.ts.map +1 -0
  61. package/dist/resolve/_options.js +38 -0
  62. package/dist/resolve/_options.js.map +1 -0
  63. package/dist/resolve/errors.d.ts +63 -0
  64. package/dist/resolve/errors.d.ts.map +1 -0
  65. package/dist/resolve/errors.js +91 -0
  66. package/dist/resolve/errors.js.map +1 -0
  67. package/dist/resolve/options.d.ts +30 -0
  68. package/dist/resolve/options.d.ts.map +1 -0
  69. package/dist/resolve/options.js +2 -0
  70. package/dist/resolve/options.js.map +1 -0
  71. package/dist/resolve/scale-ticks.d.ts +91 -0
  72. package/dist/resolve/scale-ticks.d.ts.map +1 -0
  73. package/dist/resolve/scale-ticks.js +231 -0
  74. package/dist/resolve/scale-ticks.js.map +1 -0
  75. package/dist/resolve/scale-transform.d.ts +102 -0
  76. package/dist/resolve/scale-transform.d.ts.map +1 -0
  77. package/dist/resolve/scale-transform.js +466 -0
  78. package/dist/resolve/scale-transform.js.map +1 -0
  79. package/dist/resolve/scale.d.ts +139 -0
  80. package/dist/resolve/scale.d.ts.map +1 -0
  81. package/dist/resolve/scale.js +710 -0
  82. package/dist/resolve/scale.js.map +1 -0
  83. package/dist/resolve/series.d.ts +26 -0
  84. package/dist/resolve/series.d.ts.map +1 -0
  85. package/dist/resolve/series.js +105 -0
  86. package/dist/resolve/series.js.map +1 -0
  87. package/dist/resolve/view-types.d.ts +223 -0
  88. package/dist/resolve/view-types.d.ts.map +1 -0
  89. package/dist/resolve/view-types.js +2 -0
  90. package/dist/resolve/view-types.js.map +1 -0
  91. package/dist/resolve/view.d.ts +43 -0
  92. package/dist/resolve/view.d.ts.map +1 -0
  93. package/dist/resolve/view.js +621 -0
  94. package/dist/resolve/view.js.map +1 -0
  95. package/dist/spec/channel.d.ts +3 -1
  96. package/dist/spec/channel.d.ts.map +1 -1
  97. package/dist/spec/channel.js.map +1 -1
  98. package/dist/spec/coord.d.ts +17 -0
  99. package/dist/spec/coord.d.ts.map +1 -1
  100. package/dist/spec/data-sources.js.map +1 -1
  101. package/dist/spec/mark.d.ts +6 -1
  102. package/dist/spec/mark.d.ts.map +1 -1
  103. package/dist/spec/scale.d.ts +21 -2
  104. package/dist/spec/scale.d.ts.map +1 -1
  105. package/dist/spec/transform.d.ts +32 -6
  106. package/dist/spec/transform.d.ts.map +1 -1
  107. package/dist/transform/aggregate.d.ts +28 -0
  108. package/dist/transform/aggregate.d.ts.map +1 -0
  109. package/dist/transform/aggregate.js +463 -0
  110. package/dist/transform/aggregate.js.map +1 -0
  111. package/dist/transform/apply-transforms.d.ts +26 -0
  112. package/dist/transform/apply-transforms.d.ts.map +1 -0
  113. package/dist/transform/apply-transforms.js +66 -0
  114. package/dist/transform/apply-transforms.js.map +1 -0
  115. package/dist/transform/bin.d.ts +30 -0
  116. package/dist/transform/bin.d.ts.map +1 -0
  117. package/dist/transform/bin.js +169 -0
  118. package/dist/transform/bin.js.map +1 -0
  119. package/dist/transform/columns.d.ts +24 -0
  120. package/dist/transform/columns.d.ts.map +1 -0
  121. package/dist/transform/columns.js +77 -0
  122. package/dist/transform/columns.js.map +1 -0
  123. package/dist/transform/filter.d.ts +11 -0
  124. package/dist/transform/filter.d.ts.map +1 -0
  125. package/dist/transform/filter.js +64 -0
  126. package/dist/transform/filter.js.map +1 -0
  127. package/dist/transform/group-rows.d.ts +25 -0
  128. package/dist/transform/group-rows.d.ts.map +1 -0
  129. package/dist/transform/group-rows.js +52 -0
  130. package/dist/transform/group-rows.js.map +1 -0
  131. package/dist/transform/sort.d.ts +10 -0
  132. package/dist/transform/sort.d.ts.map +1 -0
  133. package/dist/transform/sort.js +63 -0
  134. package/dist/transform/sort.js.map +1 -0
  135. package/dist/transform/stack.d.ts +37 -0
  136. package/dist/transform/stack.d.ts.map +1 -0
  137. package/dist/transform/stack.js +218 -0
  138. package/dist/transform/stack.js.map +1 -0
  139. package/package.json +22 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,199 @@
1
1
  # @ac-kit/model-chart
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0b4fe43: `applyTransforms(transforms, frame, options)` runs a spec's `filter`, `sort`,
8
+ `aggregate`, `bin` and `stack` transforms in order and never mutates the frame;
9
+ untouched columns are shared and new numeric columns are `Float64Array` when
10
+ complete. `null` and `NaN` fail every `filter` comparison and come last in a
11
+ `sort`. `aggregate` outputs groups in first-appearance order (one row for an
12
+ empty `groupBy`), skips missing cells, and gives `null` for an empty group or a
13
+ `variance` of fewer than two values. `distinct` counts the non-`null` cells by
14
+ SameValueZero, as a `Set` would: `NaN` once, `0` and `-0` as one, `1n` and `1`
15
+ as two, and geometries by identity; unlike Vega, `null` is not counted.
16
+ An `aggregate` allocates its output columns and nothing per group or per row,
17
+ whatever the source column holds: a numeric field in a boxed or `Int32Array`
18
+ column is read group by group, not converted whole.
19
+ `bin` takes math-stats `histogramEdges`' nice edges: the width of its `rule`
20
+ (any `HistogramBinRule`, `"freedman-diaconis"` by default, Sturges' where the
21
+ rule finds none) rounded up to 1, 2 or 5 times a power of ten within `maxBins`,
22
+ edges on its multiples (calendar edges in `options.timeZone` for temporal
23
+ fields), the last bin closed; a temporal field's `step` may be a calendar
24
+ interval (`"month"`, `{ unit: "day", step: 7 }`), whose boundaries in the zone
25
+ are the edges. Edges that would leave the double range throw
26
+ `InvalidTransformError`, math-stats' `RangeError` as its `cause`
27
+ (`InvalidTransformError` takes `ErrorOptions`).
28
+ A `null` or `NaN` value adds nothing to its stack and gets `null` edges, so no
29
+ segment is drawn for it (Vega-Lite's default `invalid: "filter"`).
30
+ `stack` offsets are `zero`, `normalize`, `center` (every stack centred on the
31
+ tallest one's middle, as Vega's `center`), `silhouette` (each stack centred on
32
+ 0, as d3's) and `wiggle` (the streamgraph baseline that minimises the layers'
33
+ weighted wiggle, Byron and Wattenberg 2008, as d3's). `stack`'s `series`
34
+ fields name each row's layer: every offset then matches layers by key, stacks
35
+ them bottom up in the order their keys first appear and counts a layer missing
36
+ from a stack as zero; `wiggle` requires it.
37
+ Other kinds throw `InvalidTransformError`; `RESOLVABLE_TRANSFORMS` lists the
38
+ supported ones.
39
+ - 0b4fe43: `resolveScale(inputs, options)` resolves the scale every input of one scale
40
+ channel shares, by Vega-Lite's documented defaults: kind from the field and the
41
+ mark (`band` for bars, rects and surfaces, `point` otherwise, `ordinal` off the
42
+ position channels), `zero` for linear, pow and symlog position and size scales,
43
+ `nice` for linear, pow, symlog and log x, y and z scales (an angle or a radius
44
+ keeps its extent, so a pie closes at its total), band and point paddings, and
45
+ the `sort` order of categories. `ScaleSpec.nice` takes `true`, a tick count, or
46
+ a calendar interval for a time scale (`"month"`, `{ unit: "month", step: 3 }`,
47
+ Vega-Lite's `TimeInterval`), whose boundaries in the chart's time zone the
48
+ domain is widened to. Continuous domains are the union of the finite
49
+ extents (log keeps one sign), widened by `include` (annotation positions) and a
50
+ diverging midpoint, and a single value stays `[v, v]`. An explicit domain is
51
+ final. Binned or stacked inputs are flagged with `ScaleInput.binned` and
52
+ `stacked`. Data grids give lattice domains (cell edges for `rect`, centres
53
+ otherwise). `scaleChannelOf` folds `x2`, `y2`, `theta2` and `radius2` onto their
54
+ scale channel, and `ResolveOptions` carries the time zone (default `"UTC"`),
55
+ week start, tick, bin and class counts. Scales a spec makes impossible throw
56
+ `InvalidScaleError`.
57
+ - 0b4fe43: The spec grows the vocabulary the resolver needs. `Mark` gains `"surface"` (a
58
+ surface over a data grid, height `z`) and `Channel` gains `"parent"` (a
59
+ hierarchy row's parent key, `null` for the root). `CoordSpec` gains
60
+ `parallel.axes` (one `FieldEncoding` per axis, in order) and `hierarchy.radial`
61
+ (x → angle, y → radius). Polar angles are radians, clockwise from 12 o'clock,
62
+ and `innerRadius` is a fraction of the outer radius in [0, 1).
63
+ `RESOLVER_SUPPORT` lists the transforms, projections and layouts model-chart
64
+ itself can resolve, and the `Invalid…Error` classes (`InvalidScaleError`,
65
+ `InvalidTransformError`, `InvalidEncodingError`, `InvalidCoordError`,
66
+ `InvalidLayerSourceError`, `InvalidHierarchyError`, `InvalidNetworkError`) are
67
+ exported. `resolvePlot` gives a `surface` that nothing in its fallback chain can
68
+ draw one last candidate: a `rect` over the same grid, coloured by
69
+ `color ?? z`.
70
+
71
+ Migration: the `Mark` and `Channel` unions are widened, so an exhaustive
72
+ `switch` (or a `Record<Mark, …>` / `Record<Channel, …>`) over either needs a
73
+ case for `"surface"` and `"parent"`. A `{ kind: "parallel" }` and a
74
+ `{ kind: "hierarchy", layout }` coordinate system stay valid. `ScaleSpec.nice`
75
+ widens from `boolean` to `boolean | number | CalendarIntervalSpec` and
76
+ `BinTransform.step` from `number` to `number | CalendarIntervalSpec`
77
+ (`CalendarIntervalSpec` is a calendar unit or `{ unit, step? }`): code that
78
+ reads either from a spec must handle the new forms.
79
+ - 0b4fe43: `resolveView(spec, data, capabilities, options)` resolves a whole view for a
80
+ renderer: each plot through its fallback chain against the renderer's
81
+ capabilities and what model-chart can resolve (`RESOLVER_SUPPORT`), with the
82
+ inherited coordinate system, `maxMarks` checked after transforms
83
+ (`mark count N (limit M)`) and a `crs` other than WGS 84 declined
84
+ (`crs X`); transforms applied; scales shared across a layer composition and,
85
+ unless `sharedScales` is false, across a facet's cells; guides (axes and
86
+ legends with their titles, gridlines and tick settings); and the coordinate
87
+ system (`cartesian` with its dimension, `polar` angles, the checked
88
+ `geographic` projection, `parallel` axes with their own scales, `hierarchy`
89
+ parent rows and `network` node and link index tables). The result is a tree of
90
+ `panel`, `facet`, `concat` and `table` nodes, plus every panel depth-first; a
91
+ root it cannot draw gives `kind: "table"` with the reasons and the frames, and
92
+ an undrawable concatenated view becomes a `table` node. A plot encoding `row`
93
+ or `column` is faceted by those fields; an `arc` with `theta` and no `theta2`
94
+ in polar coordinates stacks `theta` (the pie); annotations widen continuous
95
+ domains. `layerSeries(layer, panel)` gives a line or area layer's paths.
96
+
97
+ Two subpaths keep their dependencies away from the root:
98
+ `@ac-kit/model-chart/layout` lays hierarchy and network panels out in the
99
+ plot's unit square with `@ac-kit/math-graph` (`layoutHierarchy`,
100
+ `layoutNetwork`, `layoutNetworkAsync`, which takes an `AbortSignal`), and
101
+ `@ac-kit/model-chart/geographic` projects a map layer's points and GeoJSON
102
+ geometries with `@ac-kit/math-map-projection` (`projectGeographicLayer`), cut
103
+ at the map's edge, with the bounds a renderer fits. `RESOLVER_SUPPORT`
104
+ includes the `transverse-mercator` projection.
105
+
106
+ Migration: `resolvePlot` is unchanged; a renderer that resolved scales itself
107
+ can call `resolveView` instead.
108
+ - 0b4fe43: Resolved scales come with allocation-free kernels. `scaleTransform` and
109
+ `scaleInvertTransform` map a value into and out of the space where a position
110
+ scale is affine (identity for linear and time, `log_b`, signed power, signed
111
+ `log1p`); a value outside the transform's domain gives NaN and nothing throws.
112
+ `scaleNormalize` gives the `[0, 1]` position, piecewise about a diverging
113
+ midpoint, clamped in data space like d3, mirrored by `reverse`, and ½ for a zero
114
+ span. The array forms (`scaleTransformArray`, `scaleNormalizeArray`,
115
+ `scaleDiscreteIndexArray`, `scaleClassIndexArray`) take `out` first, accept
116
+ `out` as the input for in-place use, and throw `RangeError` on unequal lengths.
117
+ They allocate nothing per pass, whatever mix of scale kinds a caller
118
+ alternates: the first call for a scale object caches its constants (resolved
119
+ scales are immutable records). `scaleBandGeometry` gives the start, step and
120
+ bandwidth of band and point scales. All match d3-scale's log, pow, symlog, band, point, quantile, quantize
121
+ and threshold scales.
122
+ - 0b4fe43: `scaleTicks(scale, { count, visible, values })` gives a resolved scale's axis
123
+ ticks, each with its value, transformed-space position and whether it is major.
124
+ Linear and pow scales give d3's `ticks` with the decimal `precision` to format
125
+ them; symlog scales give `symlogTicks` with the scale's constant (decades
126
+ beyond `±constant`, linear ticks inside) and the `precision` that prints every
127
+ tick exactly; log scales give `logTicks` (a tick is major exactly when it is a
128
+ whole power of the base, with no tolerance); time
129
+ scales give calendar ticks in the scale's time zone and week start, with their
130
+ `unit` and `step`; discrete scales give the band indices and binning scales
131
+ their thresholds; identity gives `{ kind: "none" }`. `visible` (a zoomed range
132
+ in transformed space, ends in either order) restricts the ticks to those whose
133
+ transformed position lies in it, without rounding through the inverse
134
+ transform: a `visible` equal to the transformed domain gives exactly the
135
+ domain's ticks. `values` replaces them with exactly those inside `visible`,
136
+ with the `precision` that prints each one returned exactly. A
137
+ non-positive `count` throws `RangeError`.
138
+
139
+ ### Patch Changes
140
+
141
+ - Updated dependencies [0b4fe43]
142
+ - Updated dependencies [0b4fe43]
143
+ - Updated dependencies [0b4fe43]
144
+ - Updated dependencies [0b4fe43]
145
+ - Updated dependencies [0b4fe43]
146
+ - Updated dependencies [0b4fe43]
147
+ - Updated dependencies [0b4fe43]
148
+ - Updated dependencies [0b4fe43]
149
+ - Updated dependencies [0b4fe43]
150
+ - Updated dependencies [0b4fe43]
151
+ - Updated dependencies [0b4fe43]
152
+ - Updated dependencies [0b4fe43]
153
+ - Updated dependencies [0b4fe43]
154
+ - Updated dependencies [0b4fe43]
155
+ - Updated dependencies [0b4fe43]
156
+ - Updated dependencies [0b4fe43]
157
+ - Updated dependencies [0b4fe43]
158
+ - Updated dependencies [0b4fe43]
159
+ - Updated dependencies [0b4fe43]
160
+ - Updated dependencies [0b4fe43]
161
+ - Updated dependencies [0b4fe43]
162
+ - Updated dependencies [0b4fe43]
163
+ - Updated dependencies [0b4fe43]
164
+ - Updated dependencies [0b4fe43]
165
+ - Updated dependencies [0b4fe43]
166
+ - Updated dependencies [0b4fe43]
167
+ - Updated dependencies [0b4fe43]
168
+ - Updated dependencies [0b4fe43]
169
+ - Updated dependencies [0b4fe43]
170
+ - Updated dependencies [0b4fe43]
171
+ - Updated dependencies [0b4fe43]
172
+ - Updated dependencies [0b4fe43]
173
+ - Updated dependencies [0b4fe43]
174
+ - Updated dependencies [0b4fe43]
175
+ - Updated dependencies [0b4fe43]
176
+ - Updated dependencies [0b4fe43]
177
+ - Updated dependencies [0b4fe43]
178
+ - Updated dependencies [0b4fe43]
179
+ - Updated dependencies [0b4fe43]
180
+ - Updated dependencies [0b4fe43]
181
+ - Updated dependencies [0b4fe43]
182
+ - Updated dependencies [0b4fe43]
183
+ - Updated dependencies [0b4fe43]
184
+ - Updated dependencies [0b4fe43]
185
+ - Updated dependencies [0b4fe43]
186
+ - Updated dependencies [0b4fe43]
187
+ - @ac-kit/algo@0.6.0
188
+ - @ac-kit/core@0.13.0
189
+ - @ac-kit/math-geometry@0.4.0
190
+ - @ac-kit/math-graph@0.2.0
191
+ - @ac-kit/math-linear@0.4.0
192
+ - @ac-kit/math-map-projection@0.2.0
193
+ - @ac-kit/math-scalar@0.4.0
194
+ - @ac-kit/math-stats@0.6.0
195
+ - @ac-kit/model-dataset@0.3.0
196
+
3
197
  ## 0.2.0
4
198
 
5
199
  ### Minor Changes
package/README.md CHANGED
@@ -43,6 +43,11 @@ not a new type someone has to add.
43
43
  | Data | `DataSources`, `resolveDataSource`, `assertDataReferences`, `UnknownDataSourceError`, `InvalidNodeSourceError` |
44
44
  | Annotations | `AnnotationSpec` |
45
45
  | Rendering | `RendererCapabilities`, `canRender`, `resolvePlot`, `unsupportedFeatures` |
46
+ | Resolve | `resolveScale`, `scaleChannelOf`, `ScaleInput`, `ResolvedScale` and its kinds, `ResolveOptions`; the scale kernels `scaleTransform`, `scaleNormalizeArray`, `scaleDiscreteIndexArray`, `scaleClassIndexArray`, `scaleBandGeometry`; the ticks `scaleTicks`, `ScaleTicks`, `ScaleTick`, `ScaleTicksOptions` |
47
+ | View | `resolveView`, `ResolveViewResult`, `ResolvedView`, `ResolvedNode`, `ResolvedPanel`, `ResolvedLayer`, `ResolvedChannel`, `ResolvedGuide`, `ResolvedCoord`, `ResolvedTable`; `layerSeries`, `LayerSeries` |
48
+ | Transforms (run) | `applyTransforms`, `ApplyTransformsOptions`, `RESOLVABLE_TRANSFORMS` |
49
+ | `./layout` | `layoutHierarchy`, `layoutNetwork`, `layoutNetworkAsync`, `ChartLayoutOptions` |
50
+ | `./geographic` | `projectGeographicLayer`, `GeographicLayerProjection`, `GeographicShape` |
46
51
 
47
52
  ## Nothing here is in output units
48
53
 
@@ -107,3 +112,104 @@ which one to apply, not how.
107
112
  See the
108
113
  [generated API docs](https://anthochamp.pages.grenadine.io/node-essentials/api/model-chart/)
109
114
  for the full reference.
115
+
116
+ ## Resolving a view
117
+
118
+ `resolveView(spec, data, capabilities, options)` does what every renderer would
119
+ otherwise repeat: it walks each plot's fallback chain against the renderer's
120
+ capabilities and what model-chart can resolve (`RESOLVER_SUPPORT`), applies the
121
+ transforms, resolves the scales (shared across a layer composition, and across
122
+ a facet's cells unless `sharedScales` is false), the guides and the coordinate
123
+ system, and returns a tree of panels. A root it cannot draw comes back as
124
+ `kind: "table"` with the reasons and the frames to show instead; inside a
125
+ concatenation, an undrawable view becomes a `table` node. Spec and data errors
126
+ throw; renderer limits decline.
127
+
128
+ ```ts
129
+ import { dataFrameFromColumns } from "@ac-kit/model-dataset";
130
+ import { resolveView, scaleNormalizeArray } from "@ac-kit/model-chart";
131
+
132
+ const frame = dataFrameFromColumns(
133
+ [
134
+ { name: "speed", kind: "quantitative" },
135
+ { name: "cost", kind: "quantitative" },
136
+ ],
137
+ [Float64Array.of(6, 18, 48), Float64Array.of(1.5, 9, 4)],
138
+ );
139
+ const result = resolveView(
140
+ { mark: "point", encoding: { x: { field: "speed" }, y: { field: "cost" } } },
141
+ frame,
142
+ {
143
+ marks: new Set(["point"]),
144
+ coords: new Set(["cartesian"]),
145
+ channels: new Set(["x", "y"]),
146
+ transforms: new Set(),
147
+ colorDepth: 24,
148
+ continuous: true,
149
+ },
150
+ );
151
+ if (result.kind === "chart") {
152
+ const [panel] = result.view.panels;
153
+ const x = panel!.scales.get("x")!; // linear, domain [0, 50]: zero and nice
154
+ if (x.kind === "linear") {
155
+ // [0.12, 0.36, 0.96], ready for any output's own units.
156
+ scaleNormalizeArray(new Float64Array(3), Float64Array.of(6, 18, 48), x);
157
+ }
158
+ }
159
+ ```
160
+
161
+ ### Normalised positions
162
+
163
+ Scales declare domains, never ranges. A renderer maps a value to `[0, 1]` with
164
+ `scaleNormalize` or, for a whole column, `scaleNormalizeArray` into a buffer it
165
+ owns (0 B per pass), then to pixels, cells or radians itself; band and point
166
+ scales give `scaleBandGeometry`, binning scales `scaleClassIndexArray`, and
167
+ `scaleTicks` the ticks of an axis, including those of a zoomed range.
168
+
169
+ ### Time zones
170
+
171
+ Domains are epoch milliseconds and never depend on a zone. The zone
172
+ (`options.timeZone`, default `"UTC"`) and week start are fixed once on each time
173
+ scale; they decide only calendar ticks, a time scale's `nice` and temporal
174
+ bins. `nice` takes `true`, a tick count, or a calendar interval (`"month"`,
175
+ `{ unit: "month", step: 3 }`), and a temporal `bin` takes a calendar `step`
176
+ the same way, as Vega-Lite's `TimeInterval`.
177
+
178
+ ### Grids
179
+
180
+ A layer may read a `DataGrid` (`@ac-kit/model-dataset`): its x and y fields are
181
+ continuous lattice axes (cell edges for `rect`, centres otherwise) and its value
182
+ field feeds `z`, `color` or any other channel. `rect`, `surface`, `point` and
183
+ `text` read grids; a `surface` that a 2D renderer cannot draw falls back to a
184
+ `rect` coloured by its height.
185
+
186
+ ### Layouts and maps
187
+
188
+ Hierarchy and network panels carry index tables (parent rows, node keys, link
189
+ ends); `@ac-kit/model-chart/layout` turns them into positions in the plot's
190
+ unit square with `@ac-kit/math-graph`'s layouts (`layoutHierarchy`,
191
+ `layoutNetwork` and its cancellable `layoutNetworkAsync`).
192
+ `@ac-kit/model-chart/geographic` projects a map layer's points and GeoJSON
193
+ geometries with `@ac-kit/math-map-projection` (`projectGeographicLayer`), cut
194
+ at the map's edge. Both are subpaths, so terminal and SVG renderers that need
195
+ neither don't load them.
196
+
197
+ ### Stack offsets
198
+
199
+ `applyTransforms` runs `stack` with five offsets. `zero` stacks positives up
200
+ and negatives down from 0, and `normalize` divides each stack by its total.
201
+ The three others stack magnitudes and differ only in where each stack sits:
202
+
203
+ | Offset | Baseline of each stack | As |
204
+ | ------------ | -------------------------------------------------------- | ------------------------------- |
205
+ | `center` | half of what it lacks to match the tallest stack | Vega's `center` |
206
+ | `silhouette` | −total/2, so every stack centres on 0 | d3's `stackOffsetSilhouette` |
207
+ | `wiggle` | the one minimising the layers' thickness-weighted wiggle | d3's `stackOffsetWiggle` |
208
+
209
+ `wiggle` is Byron and Wattenberg's streamgraph baseline ("Stacked Graphs –
210
+ Geometry & Aesthetics", 2008). It reads the stacks in the order their groups
211
+ first appear, so sort by the position field first. It needs `series`, the
212
+ fields naming each row's layer. With `series`, every offset matches layers by
213
+ key, so a layer sits at the same height in every stack and counts as zero
214
+ where it has no row. Layers stack bottom up in the order their keys first
215
+ appear.
@@ -0,0 +1,2 @@
1
+ export * from "./project-geographic-layer.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/geographic/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./project-geographic-layer.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/geographic/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { type GeometryOptions, type Projection, type VertexRuns } from "@ac-kit/math-map-projection";
2
+ import type { ResolvedGeographicCoord, ResolvedLayer } from "../resolve/view-types.js";
3
+ /**
4
+ * One row's geometry in the plane, by the way it is drawn: points (2 numbers
5
+ * each), polylines to stroke and polygon rings to fill with the non-zero
6
+ * winding rule. A collection fills all three; a ring or a line cut by the map's
7
+ * edge comes back as several runs.
8
+ */
9
+ export type GeographicShape = {
10
+ readonly points: Float64Array;
11
+ readonly lines: VertexRuns;
12
+ readonly polygons: VertexRuns;
13
+ };
14
+ /** A geographic layer projected onto its map's plane (x east, y north). */
15
+ export type GeographicLayerProjection = {
16
+ readonly projection: Projection;
17
+ /**
18
+ * 2 per row from the `longitude` and `latitude` channels (degrees); NaN for a
19
+ * missing coordinate or a point off the map (outside the projection's domain
20
+ * or beyond an azimuthal projection's clip angle). `undefined` without them.
21
+ */
22
+ readonly positions: Float64Array | undefined;
23
+ /** Per row of a `geometry` channel; `undefined` for a missing geometry. */
24
+ readonly shapes: readonly (GeographicShape | undefined)[] | undefined;
25
+ /**
26
+ * `[minX, minY, maxX, maxY]` of every finite point projected, the box a
27
+ * renderer fits; `[∞, ∞, −∞, −∞]` when nothing landed on the map.
28
+ */
29
+ readonly bounds: Float64Array;
30
+ };
31
+ /** Options of {@link projectGeographicLayer}. */
32
+ export type ProjectGeographicLayerOptions = GeometryOptions & {
33
+ /**
34
+ * Angular radius, radians, of an azimuthal projection's map (its default
35
+ * otherwise); see math-map-projection's `ProjectionOptions`.
36
+ */
37
+ readonly clipAngle?: number;
38
+ };
39
+ /**
40
+ * Projects a layer of a geographic panel: `projectionCreate` of the panel's
41
+ * projection, then the `longitude`/`latitude` channels as points (degrees, as
42
+ * GeoJSON) and each row of the `geometry` channel cut at the map's edge and
43
+ * resampled (`projectionPolylineProject`, `projectionPolygonProject`; GeoJSON
44
+ * positions in degrees, closed rings with their repeated last position, RFC
45
+ * 7946 winding).
46
+ *
47
+ * O(points + vertices × samples per arc).
48
+ *
49
+ * @throws {RangeError} From `projectionCreate` or the geometry functions (bad
50
+ * options, too many vertices); `UnsupportedError` for a projection not
51
+ * built.
52
+ */
53
+ export declare function projectGeographicLayer(layer: ResolvedLayer, coord: ResolvedGeographicCoord, options?: ProjectGeographicLayerOptions): GeographicLayerProjection;
54
+ //# sourceMappingURL=project-geographic-layer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-geographic-layer.d.ts","sourceRoot":"","sources":["../../src/geographic/project-geographic-layer.ts"],"names":[],"mappings":"AAKA,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,UAAU,EAIf,KAAK,UAAU,EACf,MAAM,6BAA6B,CAAC;AAUrC,OAAO,KAAK,EACX,uBAAuB,EACvB,aAAa,EACb,MAAM,0BAA0B,CAAC;AAElC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;CAC9B,CAAC;AAEF,2EAA2E;AAC3E,MAAM,MAAM,yBAAyB,GAAG;IACvC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,YAAY,GAAG,SAAS,CAAC;IAC7C,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC;IACtE;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC9B,CAAC;AAEF,iDAAiD;AACjD,MAAM,MAAM,6BAA6B,GAAG,eAAe,GAAG;IAC7D;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AA6GF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,uBAAuB,EAC9B,OAAO,GAAE,6BAAkC,GACzC,yBAAyB,CA8D3B"}
@@ -0,0 +1,214 @@
1
+ import { longitudeLatitudeCreate, vec3FromLongitudeLatitude, } from "@ac-kit/math-geometry";
2
+ import { vec3Create, vec3TransformMat3x3 } from "@ac-kit/math-linear";
3
+ import { projectionCreate, projectionPolygonProject, projectionPolylineProject, } from "@ac-kit/math-map-projection";
4
+ import { DEG_TO_RAD } from "@ac-kit/math-scalar";
5
+ import { columnToFloat64Array } from "@ac-kit/model-dataset";
6
+ const EMPTY_RUNS_ = {
7
+ vertices: new Float64Array(0),
8
+ offsets: Uint32Array.of(0),
9
+ };
10
+ function radians_(position) {
11
+ return [position[0] * DEG_TO_RAD, position[1] * DEG_TO_RAD];
12
+ }
13
+ function runsOf_(rings) {
14
+ let total = 0;
15
+ for (const ring of rings) {
16
+ total += ring.length;
17
+ }
18
+ const vertices = new Float64Array(total * 2);
19
+ const offsets = new Uint32Array(rings.length + 1);
20
+ let at = 0;
21
+ for (const [index, ring] of rings.entries()) {
22
+ for (const position of ring) {
23
+ const [longitude, latitude] = radians_(position);
24
+ vertices[2 * at] = longitude;
25
+ vertices[2 * at + 1] = latitude;
26
+ at++;
27
+ }
28
+ offsets[index + 1] = at;
29
+ }
30
+ return { vertices, offsets };
31
+ }
32
+ // GeoJSON rings repeat their first position last; math-map-projection's do not.
33
+ function openRing_(ring) {
34
+ const first = ring[0];
35
+ const last = ring.at(-1);
36
+ return ring.length > 1 &&
37
+ first !== undefined &&
38
+ last !== undefined &&
39
+ first[0] === last[0] &&
40
+ first[1] === last[1]
41
+ ? ring.slice(0, -1)
42
+ : ring;
43
+ }
44
+ function collect_(geometry, parts) {
45
+ switch (geometry.type) {
46
+ case "Point":
47
+ parts.points.push(...radians_(geometry.coordinates));
48
+ return;
49
+ case "MultiPoint":
50
+ for (const position of geometry.coordinates) {
51
+ parts.points.push(...radians_(position));
52
+ }
53
+ return;
54
+ case "LineString":
55
+ parts.lines.push(geometry.coordinates);
56
+ return;
57
+ case "MultiLineString":
58
+ parts.lines.push(...geometry.coordinates);
59
+ return;
60
+ case "Polygon":
61
+ parts.polygons.push(runsOf_(geometry.coordinates.map(openRing_)));
62
+ return;
63
+ case "MultiPolygon":
64
+ for (const polygon of geometry.coordinates) {
65
+ parts.polygons.push(runsOf_(polygon.map(openRing_)));
66
+ }
67
+ return;
68
+ case "GeometryCollection":
69
+ for (const member of geometry.geometries) {
70
+ collect_(member, parts);
71
+ }
72
+ }
73
+ }
74
+ function concatenate_(runs) {
75
+ if (runs.length === 0) {
76
+ return EMPTY_RUNS_;
77
+ }
78
+ let vertexCount = 0;
79
+ let runCount = 0;
80
+ for (const item of runs) {
81
+ vertexCount += item.vertices.length;
82
+ runCount += item.offsets.length - 1;
83
+ }
84
+ const vertices = new Float64Array(vertexCount);
85
+ const offsets = new Uint32Array(runCount + 1);
86
+ let vertexAt = 0;
87
+ let runAt = 0;
88
+ for (const item of runs) {
89
+ vertices.set(item.vertices, vertexAt);
90
+ for (let index = 1; index < item.offsets.length; index++) {
91
+ offsets[++runAt] = vertexAt / 2 + item.offsets[index];
92
+ }
93
+ vertexAt += item.vertices.length;
94
+ }
95
+ return { vertices, offsets };
96
+ }
97
+ function isGeometry_(value) {
98
+ return typeof value === "object" && value !== null;
99
+ }
100
+ /**
101
+ * Projects a layer of a geographic panel: `projectionCreate` of the panel's
102
+ * projection, then the `longitude`/`latitude` channels as points (degrees, as
103
+ * GeoJSON) and each row of the `geometry` channel cut at the map's edge and
104
+ * resampled (`projectionPolylineProject`, `projectionPolygonProject`; GeoJSON
105
+ * positions in degrees, closed rings with their repeated last position, RFC
106
+ * 7946 winding).
107
+ *
108
+ * O(points + vertices × samples per arc).
109
+ *
110
+ * @throws {RangeError} From `projectionCreate` or the geometry functions (bad
111
+ * options, too many vertices); `UnsupportedError` for a projection not
112
+ * built.
113
+ */
114
+ export function projectGeographicLayer(layer, coord, options = {}) {
115
+ const { clipAngle, ...geometryOptions } = options;
116
+ const projection = projectionCreate(coord.projection, clipAngle === undefined ? {} : { clipAngle });
117
+ const bounds = Float64Array.of(Infinity, Infinity, -Infinity, -Infinity);
118
+ const extend = (x, y) => {
119
+ if (x - x === 0 && y - y === 0) {
120
+ bounds[0] = Math.min(bounds[0], x);
121
+ bounds[1] = Math.min(bounds[1], y);
122
+ bounds[2] = Math.max(bounds[2], x);
123
+ bounds[3] = Math.max(bounds[3], y);
124
+ }
125
+ };
126
+ const visible = visibility_(projection);
127
+ const longitude = layer.channels.get("longitude");
128
+ const latitude = layer.channels.get("latitude");
129
+ let positions;
130
+ if (longitude?.kind === "field" && latitude?.kind === "field") {
131
+ positions = pointsOf_(longitude.column, latitude.column);
132
+ projectPoints_(projection, positions, visible);
133
+ for (let index = 0; index < positions.length; index += 2) {
134
+ extend(positions[index], positions[index + 1]);
135
+ }
136
+ }
137
+ const geometry = layer.channels.get("geometry");
138
+ let shapes;
139
+ if (geometry?.kind === "field") {
140
+ shapes = Array.from({ length: geometry.column.length }, (_, row) => {
141
+ const value = geometry.column[row] ?? null;
142
+ if (!isGeometry_(value)) {
143
+ return undefined;
144
+ }
145
+ const parts = { points: [], lines: [], polygons: [] };
146
+ collect_(value, parts);
147
+ const points = Float64Array.from(parts.points);
148
+ projectPoints_(projection, points, visible);
149
+ const lines = parts.lines.length === 0
150
+ ? EMPTY_RUNS_
151
+ : projectionPolylineProject(projection, runsOf_(parts.lines), geometryOptions);
152
+ const polygons = concatenate_(parts.polygons.map((rings) => projectionPolygonProject(projection, rings, geometryOptions)));
153
+ for (const values of [points, lines.vertices, polygons.vertices]) {
154
+ for (let index = 0; index < values.length; index += 2) {
155
+ extend(values[index], values[index + 1]);
156
+ }
157
+ }
158
+ return { points, lines, polygons };
159
+ });
160
+ }
161
+ return { projection, positions, shapes, bounds };
162
+ }
163
+ function pointsOf_(longitudes, latitudes) {
164
+ const count = longitudes.length;
165
+ const lon = columnToFloat64Array(new Float64Array(count), longitudes);
166
+ const lat = columnToFloat64Array(new Float64Array(count), latitudes);
167
+ const pairs = new Float64Array(2 * count);
168
+ for (let row = 0; row < count; row++) {
169
+ pairs[2 * row] = lon[row] * DEG_TO_RAD;
170
+ pairs[2 * row + 1] = lat[row] * DEG_TO_RAD;
171
+ }
172
+ return pairs;
173
+ }
174
+ // Whether a longitude–latitude (radians) lies on the map: within an azimuthal
175
+ // projection's cap, whose centre the rotation takes to +X.
176
+ function visibility_(projection) {
177
+ if (projection.family !== "azimuthal") {
178
+ return undefined;
179
+ }
180
+ const coords = longitudeLatitudeCreate();
181
+ const unit = vec3Create();
182
+ const cosine = Math.cos(projection.clipAngle);
183
+ return (longitude, latitude) => {
184
+ coords[0] = longitude;
185
+ coords[1] = latitude;
186
+ vec3FromLongitudeLatitude(unit, coords);
187
+ vec3TransformMat3x3(unit, unit, projection.rotation);
188
+ return unit[0] >= cosine;
189
+ };
190
+ }
191
+ // Longitude–latitude pairs (radians) to plane points in place, NaN off the map.
192
+ function projectPoints_(projection, pairs, visible) {
193
+ const hidden = new Uint8Array(pairs.length / 2);
194
+ if (visible !== undefined) {
195
+ for (let index = 0; index < hidden.length; index++) {
196
+ const longitude = pairs[2 * index];
197
+ const latitude = pairs[2 * index + 1];
198
+ hidden[index] =
199
+ longitude - longitude === 0 &&
200
+ latitude - latitude === 0 &&
201
+ visible(longitude, latitude)
202
+ ? 0
203
+ : 1;
204
+ }
205
+ }
206
+ projection.projectArray(pairs, pairs);
207
+ for (let index = 0; index < hidden.length; index++) {
208
+ if (hidden[index] === 1) {
209
+ pairs[2 * index] = Number.NaN;
210
+ pairs[2 * index + 1] = Number.NaN;
211
+ }
212
+ }
213
+ }
214
+ //# sourceMappingURL=project-geographic-layer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BACH,CAAC,CAAC,CAAC,CAAC;QACP,CAAC;IACF,CAAC;IACD,UAAU,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACtC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACpD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC;YAC9B,KAAK,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC;QACnC,CAAC;IACF,CAAC;AACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,12 @@
1
1
  export * from "./render/capabilities.js";
2
+ export * from "./resolve/errors.js";
3
+ export * from "./resolve/options.js";
4
+ export * from "./resolve/scale.js";
5
+ export * from "./resolve/scale-ticks.js";
6
+ export * from "./resolve/scale-transform.js";
7
+ export * from "./resolve/series.js";
8
+ export * from "./resolve/view-types.js";
9
+ export * from "./resolve/view.js";
2
10
  export * from "./spec/annotation.js";
3
11
  export * from "./spec/channel.js";
4
12
  export * from "./spec/coord.js";
@@ -8,4 +16,5 @@ export * from "./spec/mark.js";
8
16
  export * from "./spec/plot.js";
9
17
  export * from "./spec/scale.js";
10
18
  export * from "./spec/transform.js";
19
+ export * from "./transform/apply-transforms.js";
11
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC"}