svelteplot 0.3.11-pr-153.4 → 0.3.11-pr-153.6

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.
@@ -11,7 +11,7 @@ export declare function stackX({ data, ...channels }: TransformArg, opts?: Parti
11
11
  export declare function stackMarimekko<T>({ data, x, y, value, ...rest }: {
12
12
  data: T[];
13
13
  x: ChannelAccessor<T>;
14
- y: ChannelAccessor<T>;
14
+ y?: ChannelAccessor<T>;
15
15
  value: ChannelAccessor<T>;
16
16
  fx?: ChannelAccessor<T>;
17
17
  fy?: ChannelAccessor<T>;
@@ -3,6 +3,7 @@ import { resolveChannel, resolveProp } from '../helpers/resolve.js';
3
3
  import { stack, stackOffsetExpand, stackOffsetSilhouette, stackOffsetWiggle, stackOrderAppearance, stackOrderAscending, stackOrderInsideOut, stackOrderNone, stackOffsetDiverging } from 'd3-shape';
4
4
  import { index, union, sum, groups as d3Groups } from 'd3-array';
5
5
  import { groupFacetsAndZ } from '../helpers/group';
6
+ import { filter } from './filter.js';
6
7
  const GROUP = Symbol('group');
7
8
  const FACET = Symbol('group');
8
9
  const DEFAULT_STACK_OPTIONS = {
@@ -115,6 +116,10 @@ const X = Symbol('x'), X1 = Symbol('x1'), X2 = Symbol('x2');
115
116
  const Y = Symbol('y'), Y1 = Symbol('y1'), Y2 = Symbol('y2');
116
117
  export function stackMarimekko({ data, x, y, value, ...rest }, { x: xOpt, y: yOpt } = {}) {
117
118
  const out = [];
119
+ if (rest.filter) {
120
+ const d = filter({ data, ...rest });
121
+ data = d.data;
122
+ }
118
123
  groupFacetsAndZ(data, { ...rest }, (data) => {
119
124
  const total = sum(data, (d) => d[value]);
120
125
  let xPos = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.3.11-pr-153.4",
3
+ "version": "0.3.11-pr-153.6",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",