svelteplot 0.7.0-pr-276.1 → 0.7.0-pr-277.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.
@@ -3,7 +3,7 @@ export { bollingerX, bollingerY } from './bollinger.js';
3
3
  export { geoCentroid } from './centroid.js';
4
4
  export { filter } from './filter.js';
5
5
  export { map, mapX, mapY } from './map.js';
6
- export { normalizeX, normalizeY } from './normalize.js';
6
+ export { normalizeX, normalizeY, normalizeParallelX, normalizeParallelY } from './normalize.js';
7
7
  export { group, groupX, groupY, groupZ } from './group.js';
8
8
  export { intervalX, intervalY } from './interval.js';
9
9
  export { jitterX, jitterY } from './jitter.js';
@@ -3,7 +3,7 @@ export { bollingerX, bollingerY } from './bollinger.js';
3
3
  export { geoCentroid } from './centroid.js';
4
4
  export { filter } from './filter.js';
5
5
  export { map, mapX, mapY } from './map.js';
6
- export { normalizeX, normalizeY } from './normalize.js';
6
+ export { normalizeX, normalizeY, normalizeParallelX, normalizeParallelY } from './normalize.js';
7
7
  export { group, groupX, groupY, groupZ } from './group.js';
8
8
  export { intervalX, intervalY } from './interval.js';
9
9
  export { jitterX, jitterY } from './jitter.js';
@@ -2,4 +2,22 @@ import type { TransformArg, MapIndexObject } from '../types/index.js';
2
2
  type NormalizeBasis = 'deviation' | 'first' | 'last' | 'min' | 'max' | 'mean' | 'median' | 'sum' | 'extent' | MapIndexObject;
3
3
  export declare function normalizeX<T>(args: TransformArg<T>, basis: NormalizeBasis): any;
4
4
  export declare function normalizeY<T>(args: TransformArg<T>, basis: NormalizeBasis): any;
5
+ /**
6
+ * Convenience wrapper for normalizeY for parallel coordinates.
7
+ *
8
+ * Channels:
9
+ * - x: the categorical axis (e.g., 'Measurement')
10
+ * - y: the value to normalize (e.g., 'Value')
11
+ * - z: the grouping variable (e.g., 'Id')
12
+ */
13
+ export declare function normalizeParallelY<T>(args: TransformArg<T>, basis: NormalizeBasis): any;
14
+ /**
15
+ * Convenience wrapper for normalizeY for parallel coordinates.
16
+ *
17
+ * Channels:
18
+ * - x: the categorical axis (e.g., 'Measurement')
19
+ * - y: the value to normalize (e.g., 'Value')
20
+ * - z: the grouping variable (e.g., 'Id')
21
+ */
22
+ export declare function normalizeParallelX<T>(args: TransformArg<T>, basis: NormalizeBasis): any;
5
23
  export {};
@@ -1,5 +1,6 @@
1
1
  import { mapX, mapY } from './map.js';
2
2
  import { min, max, mean, median, sum, deviation, extent } from 'd3-array';
3
+ import { sort } from './sort.js';
3
4
  export function normalizeX(args, basis) {
4
5
  return mapX(args, normalize(basis));
5
6
  }
@@ -84,3 +85,47 @@ const normalizeMean = normalizeAccessor(mean);
84
85
  const normalizeMedian = normalizeAccessor(median);
85
86
  const normalizeMin = normalizeAccessor(min);
86
87
  const normalizeSum = normalizeAccessor(sum);
88
+ /**
89
+ * Convenience wrapper for normalizeY for parallel coordinates.
90
+ *
91
+ * Channels:
92
+ * - x: the categorical axis (e.g., 'Measurement')
93
+ * - y: the value to normalize (e.g., 'Value')
94
+ * - z: the grouping variable (e.g., 'Id')
95
+ */
96
+ export function normalizeParallelY(args, basis) {
97
+ return sort({
98
+ ...normalizeY({
99
+ ...args,
100
+ // use x as the grouping variable for normalization to normalize
101
+ // each axis independently
102
+ z: args.x
103
+ }, basis),
104
+ // restore original grouping by line
105
+ z: args.z,
106
+ // sort by original order
107
+ sort: args.z
108
+ });
109
+ }
110
+ /**
111
+ * Convenience wrapper for normalizeY for parallel coordinates.
112
+ *
113
+ * Channels:
114
+ * - x: the categorical axis (e.g., 'Measurement')
115
+ * - y: the value to normalize (e.g., 'Value')
116
+ * - z: the grouping variable (e.g., 'Id')
117
+ */
118
+ export function normalizeParallelX(args, basis) {
119
+ return sort({
120
+ ...normalizeX({
121
+ ...args,
122
+ // use x as the grouping variable for normalization to normalize
123
+ // each axis independently
124
+ z: args.y
125
+ }, basis),
126
+ // restore original grouping by line
127
+ z: args.z,
128
+ // sort by original order
129
+ sort: args.z
130
+ });
131
+ }
@@ -18,11 +18,13 @@
18
18
  {#each examples as page, i (i)}
19
19
  <a href={resolve(page.url)}>
20
20
  <div>
21
- <enhanced:img
22
- src={ds.isDark
23
- ? exampleImages[`../../snapshots/${page.key}.dark.png`].default.img.src
24
- : exampleImages[`../../snapshots/${page.key}.png`].default.img.src}
25
- alt={page.title} />
21
+ {#if exampleImages[`../../snapshots/${page.key}.png`]}
22
+ <enhanced:img
23
+ src={ds.isDark
24
+ ? exampleImages[`../../snapshots/${page.key}.dark.png`].default.img.src
25
+ : exampleImages[`../../snapshots/${page.key}.png`].default.img.src}
26
+ alt={page.title} />
27
+ {/if}
26
28
  </div>
27
29
  <h4>
28
30
  {page.title}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.7.0-pr-276.1",
3
+ "version": "0.7.0-pr-277.0",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",