svelteplot 0.4.4 → 0.4.5-pr-208.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 (61) hide show
  1. package/dist/Mark.svelte +87 -73
  2. package/dist/Mark.svelte.d.ts +37 -33
  3. package/dist/core/Plot.svelte +1 -0
  4. package/dist/helpers/colors.d.ts +1 -1
  5. package/dist/helpers/index.d.ts +2 -2
  6. package/dist/helpers/resolve.js +1 -1
  7. package/dist/helpers/scales.d.ts +1 -1
  8. package/dist/helpers/typeChecks.d.ts +4 -4
  9. package/dist/marks/Area.svelte.d.ts +37 -33
  10. package/dist/marks/AreaX.svelte.d.ts +38 -34
  11. package/dist/marks/AreaY.svelte +2 -1
  12. package/dist/marks/AreaY.svelte.d.ts +38 -34
  13. package/dist/marks/Arrow.svelte.d.ts +37 -33
  14. package/dist/marks/AxisX.svelte +5 -1
  15. package/dist/marks/AxisX.svelte.d.ts +46 -39
  16. package/dist/marks/AxisY.svelte +3 -2
  17. package/dist/marks/AxisY.svelte.d.ts +44 -39
  18. package/dist/marks/BarX.svelte.d.ts +38 -34
  19. package/dist/marks/BarY.svelte.d.ts +37 -33
  20. package/dist/marks/BollingerX.svelte.d.ts +2 -73
  21. package/dist/marks/BollingerY.svelte.d.ts +2 -73
  22. package/dist/marks/Cell.svelte.d.ts +37 -33
  23. package/dist/marks/ColorLegend.svelte +1 -1
  24. package/dist/marks/CustomMark.svelte.d.ts +2 -80
  25. package/dist/marks/DifferenceY.svelte.d.ts +7 -66
  26. package/dist/marks/Dot.svelte +1 -1
  27. package/dist/marks/Dot.svelte.d.ts +37 -33
  28. package/dist/marks/DotX.svelte.d.ts +37 -33
  29. package/dist/marks/DotY.svelte.d.ts +37 -33
  30. package/dist/marks/Geo.svelte.d.ts +37 -33
  31. package/dist/marks/GridX.svelte.d.ts +37 -33
  32. package/dist/marks/GridY.svelte.d.ts +37 -33
  33. package/dist/marks/Line.svelte.d.ts +39 -35
  34. package/dist/marks/LineX.svelte.d.ts +38 -34
  35. package/dist/marks/LineY.svelte.d.ts +38 -34
  36. package/dist/marks/Link.svelte.d.ts +37 -33
  37. package/dist/marks/Rect.svelte.d.ts +37 -33
  38. package/dist/marks/RuleX.svelte.d.ts +37 -33
  39. package/dist/marks/RuleY.svelte.d.ts +37 -33
  40. package/dist/marks/Spike.svelte.d.ts +36 -33
  41. package/dist/marks/Text.svelte.d.ts +37 -33
  42. package/dist/marks/TickX.svelte.d.ts +37 -33
  43. package/dist/marks/TickY.svelte.d.ts +37 -33
  44. package/dist/marks/Vector.svelte.d.ts +37 -33
  45. package/dist/marks/helpers/RectPath.svelte.d.ts +3 -62
  46. package/dist/marks/helpers/Regression.svelte +1 -1
  47. package/dist/transforms/bollinger.d.ts +1 -66
  48. package/dist/transforms/dodge.d.ts +17 -0
  49. package/dist/transforms/dodge.js +128 -0
  50. package/dist/transforms/group.d.ts +4 -12
  51. package/dist/transforms/interval.d.ts +2 -122
  52. package/dist/transforms/recordize.d.ts +1 -4
  53. package/dist/transforms/recordize.js +8 -2
  54. package/dist/transforms/select.d.ts +7 -427
  55. package/dist/transforms/sort.d.ts +3 -242
  56. package/dist/transforms/sort.js +13 -1
  57. package/dist/transforms/stack.d.ts +5 -25
  58. package/dist/transforms/stack.js +96 -41
  59. package/dist/transforms/window.d.ts +2 -128
  60. package/dist/types/mark.d.ts +40 -33
  61. package/package.json +130 -128
@@ -1,74 +1,15 @@
1
- import type { BaseRectMarkProps } from '../../types/mark.js';
1
+ import type { BaseMarkProps, BaseRectMarkProps } from '../../types/mark.js';
2
2
  import type { DataRecord, ScaledDataRecord } from '../../types/data.js';
3
3
  import type { UsedScales } from '../../types/index.js';
4
4
  declare class __sveltets_Render<Datum extends DataRecord> {
5
5
  props(): {
6
- datum: ScaledDataRecord<Datum>;
6
+ datum: ScaledDataRecord<Datum_1>;
7
7
  class: string | null;
8
8
  x: number;
9
9
  y: number;
10
10
  width: number;
11
11
  height: number;
12
- options: BaseRectMarkProps<Datum> & Partial<{
13
- filter?: import("../../types/index.js").ConstantAccessor<boolean, Datum>;
14
- facet?: "auto" | "include" | "exclude";
15
- fx: import("../../types/index.js").ChannelAccessor<Datum>;
16
- fy: import("../../types/index.js").ChannelAccessor<Datum>;
17
- dx: import("../../types/index.js").ConstantAccessor<number, Datum>;
18
- dy: import("../../types/index.js").ConstantAccessor<number, Datum>;
19
- fill: import("../../types/index.js").ChannelAccessor<Datum>;
20
- fillOpacity: import("../../types/index.js").ConstantAccessor<number, Datum>;
21
- sort: {
22
- channel: string;
23
- order?: "ascending" | "descending";
24
- } | ((a: import("../../types/data.js").RawValue, b: import("../../types/data.js").RawValue) => number) | import("../../types/index.js").ConstantAccessor<import("../../types/data.js").RawValue, Datum>;
25
- stroke: import("../../types/index.js").ChannelAccessor<Datum>;
26
- strokeWidth: import("../../types/index.js").ConstantAccessor<number, Datum>;
27
- strokeOpacity: import("../../types/index.js").ConstantAccessor<number, Datum>;
28
- strokeLinejoin: import("../../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
29
- strokeLinecap: import("../../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
30
- strokeMiterlimit: import("../../types/index.js").ConstantAccessor<number, Datum>;
31
- opacity: import("../../types/index.js").ChannelAccessor<Datum>;
32
- strokeDasharray: import("../../types/index.js").ConstantAccessor<string, Datum>;
33
- strokeDashoffset: import("../../types/index.js").ConstantAccessor<number, Datum>;
34
- mixBlendMode: import("../../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
35
- clipPath: string;
36
- imageFilter: import("../../types/index.js").ConstantAccessor<string, Datum>;
37
- shapeRendering: import("../../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
38
- paintOrder: import("../../types/index.js").ConstantAccessor<string, Datum>;
39
- onclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
40
- ondblclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
41
- onmouseup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
42
- onmousedown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
43
- onmouseenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
44
- onmousemove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
45
- onmouseleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
46
- onmouseout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
47
- onmouseover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
48
- onpointercancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
49
- onpointerdown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
50
- onpointerup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
51
- onpointerenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
52
- onpointerleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
53
- onpointermove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
54
- onpointerover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
55
- onpointerout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
56
- ondrag?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
57
- ondrop?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
58
- ondragstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
59
- ondragenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
60
- ondragleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
61
- ondragover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
62
- ondragend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
63
- ontouchstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
64
- ontouchmove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
65
- ontouchend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
66
- ontouchcancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
67
- oncontextmenu?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
68
- onwheel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
69
- class: string | null;
70
- cursor: import("../../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
71
- }>;
12
+ options: BaseRectMarkProps<Datum_1> & BaseMarkProps<Datum_1>;
72
13
  /**
73
14
  * By default, the `inset` property is applied to all four insets. Mark components
74
15
  * can tweak this behavior for insetTop and insetBottom by setting the
@@ -43,7 +43,7 @@
43
43
  regressionLog,
44
44
  regressionPow,
45
45
  regressionLoess
46
- } from 'd3-regression/dist/d3-regression.esm.js';
46
+ } from '@gka/d3-regression';
47
47
  import { resolveChannel } from '../../helpers/resolve.js';
48
48
  import { confidenceInterval } from '../../helpers/math.js';
49
49
  import callWithProps from '../../helpers/callWithProps.js';
@@ -11,69 +11,4 @@ export type BollingerOptions = {
11
11
  };
12
12
  export declare function bollingerX(args: TransformArg<DataRecord>, options?: BollingerOptions): TransformArg<DataRecord>;
13
13
  export declare function bollingerY(args: TransformArg<DataRecord>, options?: BollingerOptions): TransformArg<DataRecord>;
14
- export declare function bollingerDim(dim: 'x' | 'y', { data, ...channels }: TransformArg<DataRecord>, options?: BollingerOptions): {
15
- filter?: import("../types/index.js").ConstantAccessor<boolean, Record<string | symbol, import("../types/index.js").RawValue>>;
16
- facet?: "auto" | "include" | "exclude" | undefined;
17
- fx?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
18
- fy?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
19
- dx?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
20
- dy?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
21
- fill?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
22
- fillOpacity?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
23
- sort?: {
24
- channel: string;
25
- order?: "ascending" | "descending";
26
- } | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, Record<string | symbol, import("../types/index.js").RawValue>>;
27
- stroke?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
28
- strokeWidth?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
29
- strokeOpacity?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
30
- strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Record<string | symbol, import("../types/index.js").RawValue>>;
31
- strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Record<string | symbol, import("../types/index.js").RawValue>>;
32
- strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
33
- opacity?: import("../types/index.js").ChannelAccessor<Record<string | symbol, import("../types/index.js").RawValue>>;
34
- strokeDasharray?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/index.js").RawValue>>;
35
- strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/index.js").RawValue>>;
36
- mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/index.js").RawValue>>;
37
- clipPath?: string | undefined;
38
- imageFilter?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/index.js").RawValue>>;
39
- shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/index.js").RawValue>>;
40
- paintOrder?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/index.js").RawValue>>;
41
- onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
42
- ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
43
- onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
44
- onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
45
- onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
46
- onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
47
- onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
48
- onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
49
- onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
50
- onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
51
- onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
52
- onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
53
- onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
54
- onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
55
- onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
56
- onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
57
- onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
58
- ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
59
- ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
60
- ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
61
- ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
62
- ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
63
- ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
64
- ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
65
- ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
66
- ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
67
- ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
68
- ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
69
- oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
70
- onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
71
- class?: string | null | undefined;
72
- cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Record<string | symbol, import("../types/index.js").RawValue>>;
73
- data: {
74
- __x: import("../types/index.js").RawValue;
75
- __lo: number;
76
- __avg: number;
77
- __hi: number;
78
- }[];
79
- };
14
+ export declare function bollingerDim(dim: 'x' | 'y', { data, ...channels }: TransformArg<DataRecord>, options?: BollingerOptions): any;
@@ -0,0 +1,17 @@
1
+ import type { ScaledDataRecord, TransformArg, PlotState } from '../types';
2
+ type BaseDodgeOptions = {
3
+ anchor?: string;
4
+ padding?: number;
5
+ r?: number;
6
+ };
7
+ type AnchorX = 'left' | 'right' | 'middle';
8
+ type AnchorY = 'top' | 'bottom' | 'middle';
9
+ export type DodgeXOptions = AnchorX | (BaseDodgeOptions & {
10
+ anchor?: 'left' | 'right' | 'middle';
11
+ });
12
+ export type DodgeYOptions = AnchorY | (BaseDodgeOptions & {
13
+ anchor?: 'top' | 'bottom' | 'middle';
14
+ });
15
+ export declare function dodgeX(args: TransformArg<ScaledDataRecord>, plotState: PlotState): ScaledDataRecord[];
16
+ export declare function dodgeY(args: TransformArg<ScaledDataRecord>, plotState: PlotState): ScaledDataRecord[];
17
+ export {};
@@ -0,0 +1,128 @@
1
+ import IntervalTree from 'interval-tree-1d';
2
+ import { groupFacetsAndZ } from '../helpers/group';
3
+ export function dodgeX(args, plotState) {
4
+ if (!args.dodgeX)
5
+ return args.data;
6
+ let { anchor = 'left', padding = 1, r = args.dodgeX.r } = maybeAnchor(args.dodgeX);
7
+ let anchorFunction;
8
+ switch (`${anchor}`.toLowerCase()) {
9
+ case 'left':
10
+ anchorFunction = anchorXLeft;
11
+ break;
12
+ case 'right':
13
+ anchorFunction = anchorXRight;
14
+ break;
15
+ case 'middle':
16
+ anchorFunction = anchorXMiddle;
17
+ break;
18
+ default:
19
+ throw new Error(`unknown dodge anchor: ${anchor}`);
20
+ }
21
+ return dodge('x', 'y', anchorFunction, Number(padding), r, args, plotState);
22
+ }
23
+ export function dodgeY(args, plotState) {
24
+ if (!args.dodgeY)
25
+ return args.data;
26
+ let { anchor = 'bottom', padding = 1, r = args.dodgeY.r } = maybeAnchor(args.dodgeY);
27
+ let anchorFunction;
28
+ switch (`${anchor}`.toLowerCase()) {
29
+ case 'top':
30
+ anchorFunction = anchorYTop;
31
+ break;
32
+ case 'bottom':
33
+ anchorFunction = anchorYBottom;
34
+ break;
35
+ case 'middle':
36
+ anchorFunction = anchorYMiddle;
37
+ break;
38
+ default:
39
+ throw new Error(`unknown dodge anchor: ${anchor}`);
40
+ }
41
+ return dodge('y', 'x', anchorFunction, Number(padding), r, args, plotState);
42
+ }
43
+ function dodge(y, x, anchor, padding, r, { data, ...channels }, plotState) {
44
+ if (r != null && typeof r !== 'number') {
45
+ // use the r channel
46
+ // let { channels, sort, reverse } = options;
47
+ // channels = maybeNamed(channels);
48
+ // if (channels?.r === undefined)
49
+ // options = { ...options, channels: { ...channels, r: { value: r, scale: 'r' } } };
50
+ // if (sort === undefined && reverse === undefined) options.sort = { channel: '-r' };
51
+ }
52
+ const { fx, fy } = channels;
53
+ let [ky, ty] = anchor(plotState);
54
+ const compare = ky ? compareAscending : compareSymmetric;
55
+ const cr = r !== undefined ? r : 3; // default radius if no r channel
56
+ // group data by facets
57
+ groupFacetsAndZ(data, { fx, fy }, (items) => {
58
+ // apply dodge within each facet
59
+ const tree = IntervalTree();
60
+ const data = items.filter((d) => (typeof d.r !== 'number' || d.r >= 0) && isFinite(d[x]) && isFinite(d[y]));
61
+ const intervals = new Float64Array(2 * data.length + 2);
62
+ data.forEach((d, i) => {
63
+ const ri = d.r ?? r ?? 3;
64
+ const y0 = ky ? ri + padding : 0; // offset baseline for varying radius
65
+ const l = d[x] - ri;
66
+ const h = d[x] + ri;
67
+ // The first two positions are 0 to test placing the dot on the baseline.
68
+ let k = 2;
69
+ // For any previously placed circles that may overlap this circle, compute
70
+ // the y-positions that place this circle tangent to these other circles.
71
+ // https://observablehq.com/@mbostock/circle-offset-along-line
72
+ tree.queryInterval(l - padding, h + padding, ([, , j]) => {
73
+ const yj = data[j][y] - y0;
74
+ const dx = d[x] - data[j][x];
75
+ const dr = padding + (channels.r ? d.r + data[j].r : 2 * cr);
76
+ const dy = Math.sqrt(dr * dr - dx * dx);
77
+ intervals[k++] = yj - dy;
78
+ intervals[k++] = yj + dy;
79
+ });
80
+ // Find the best y-value where this circle can fit.
81
+ let candidates = intervals.slice(0, k);
82
+ if (ky)
83
+ candidates = candidates.filter((y) => y >= 0);
84
+ out: for (const diff of candidates.sort(compare)) {
85
+ for (let j = 0; j < k; j += 2) {
86
+ if (intervals[j] + 1e-6 < diff && diff < intervals[j + 1] - 1e-6) {
87
+ continue out;
88
+ }
89
+ }
90
+ d[y] = diff + y0;
91
+ break;
92
+ }
93
+ // Insert the placed circle into the interval tree.
94
+ tree.insert([l, h, i]);
95
+ });
96
+ if (!ky)
97
+ ky = 1;
98
+ data.forEach((d) => (d[y] = d[y] * ky + ty));
99
+ });
100
+ return data;
101
+ }
102
+ function maybeAnchor(anchor) {
103
+ return typeof anchor === 'string' ? { anchor } : anchor;
104
+ }
105
+ function anchorXLeft({ options: { marginLeft } }) {
106
+ return [1, marginLeft];
107
+ }
108
+ function anchorXRight({ facetWidth: width, options: { marginLeft } }) {
109
+ return [-1, marginLeft + width];
110
+ }
111
+ function anchorXMiddle({ facetWidth: width, options: { marginLeft } }) {
112
+ return [0, marginLeft + width / 2];
113
+ }
114
+ function anchorYTop({ options: { marginTop } }) {
115
+ return [1, marginTop];
116
+ }
117
+ function anchorYBottom({ facetHeight: height }) {
118
+ return [-1, height];
119
+ }
120
+ function anchorYMiddle({ facetHeight: height, options: { marginTop, marginBottom } }) {
121
+ return [0, (marginTop + height) / 2];
122
+ }
123
+ function compareSymmetric(a, b) {
124
+ return Math.abs(a) - Math.abs(b);
125
+ }
126
+ function compareAscending(a, b) {
127
+ return a - b;
128
+ }
@@ -38,29 +38,21 @@ type GroupZOptions = GroupXOptions | GroupYOptions;
38
38
  * groups the dataset by x and y channel and optionally reduces the group items
39
39
  * to output channels fill, stroke, r, opacity, fillOpacity, or strokeOpacity
40
40
  */
41
- export declare function group({ data, ...channels }: TransformArg<T, DataRecord>, options?: GroupXOptions): {
42
- data: Record<string | symbol, RawValue>[];
43
- };
41
+ export declare function group({ data, ...channels }: TransformArg<T, DataRecord>, options?: GroupXOptions): any;
44
42
  /**
45
43
  * groups the dataset by the x channel and optionally reduces the group items
46
44
  * to output channels y, y1, y2, fill, stroke, r, opacity, fillOpacity, or strokeOpacity
47
45
  */
48
- export declare function groupX(input: TransformArg<T, DataRecord>, options?: GroupXOptions): {
49
- data: Record<string | symbol, RawValue>[];
50
- };
46
+ export declare function groupX(input: TransformArg<T, DataRecord>, options?: GroupXOptions): any;
51
47
  /**
52
48
  * groups the dataset by the y channel and optionally reduces the group items
53
49
  * to output channels x, x1, x2, fill, stroke, r, opacity, fillOpacity, or strokeOpacity
54
50
  */
55
- export declare function groupY(input: TransformArg<T, DataRecord>, options?: GroupYOptions): {
56
- data: Record<string | symbol, RawValue>[];
57
- };
51
+ export declare function groupY(input: TransformArg<T, DataRecord>, options?: GroupYOptions): any;
58
52
  /**
59
53
  * groups the dataset by the z channel and optionally reduces the group items
60
54
  * to output channels x, x1, x2, y, y1, y2, fill, stroke, r, opacity, fillOpacity,
61
55
  * or strokeOpacity
62
56
  */
63
- export declare function groupZ(input: TransformArg<T, DataRecord>, options?: GroupZOptions): {
64
- data: Record<string | symbol, RawValue>[];
65
- };
57
+ export declare function groupZ(input: TransformArg<T, DataRecord>, options?: GroupZOptions): any;
66
58
  export {};
@@ -1,127 +1,7 @@
1
1
  import type { PlotState, TransformArg } from '../types/index.js';
2
2
  export declare function intervalX<T>(args: TransformArg<T>, { plot }: {
3
3
  plot: PlotState;
4
- }): {
5
- filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
6
- facet?: "auto" | "include" | "exclude" | undefined;
7
- fx?: import("../types/index.js").ChannelAccessor<T>;
8
- fy?: import("../types/index.js").ChannelAccessor<T>;
9
- dx?: import("../types/index.js").ConstantAccessor<number, T>;
10
- dy?: import("../types/index.js").ConstantAccessor<number, T>;
11
- fill?: import("../types/index.js").ChannelAccessor<T>;
12
- fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
13
- sort?: {
14
- channel: string;
15
- order?: "ascending" | "descending";
16
- } | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, T>;
17
- stroke?: import("../types/index.js").ChannelAccessor<T>;
18
- strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
19
- strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
20
- strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
21
- strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
22
- strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
23
- opacity?: import("../types/index.js").ChannelAccessor<T>;
24
- strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
25
- strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
26
- mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
27
- clipPath?: string | undefined;
28
- imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
29
- shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
30
- paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
31
- onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
32
- ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
33
- onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
34
- onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
35
- onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
36
- onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
37
- onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
38
- onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
39
- onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
40
- onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
41
- onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
42
- onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
43
- onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
44
- onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
45
- onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
46
- onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
47
- onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
48
- ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
49
- ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
50
- ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
51
- ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
52
- ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
53
- ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
54
- ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
55
- ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
56
- ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
57
- ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
58
- ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
59
- oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
60
- onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
61
- class?: string | null | undefined;
62
- cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
63
- data: T[];
64
- };
4
+ }): any;
65
5
  export declare function intervalY<T>(args: TransformArg<T>, { plot }: {
66
6
  plot: PlotState;
67
- }): {
68
- filter?: import("../types/index.js").ConstantAccessor<boolean, T>;
69
- facet?: "auto" | "include" | "exclude" | undefined;
70
- fx?: import("../types/index.js").ChannelAccessor<T>;
71
- fy?: import("../types/index.js").ChannelAccessor<T>;
72
- dx?: import("../types/index.js").ConstantAccessor<number, T>;
73
- dy?: import("../types/index.js").ConstantAccessor<number, T>;
74
- fill?: import("../types/index.js").ChannelAccessor<T>;
75
- fillOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
76
- sort?: {
77
- channel: string;
78
- order?: "ascending" | "descending";
79
- } | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, T>;
80
- stroke?: import("../types/index.js").ChannelAccessor<T>;
81
- strokeWidth?: import("../types/index.js").ConstantAccessor<number, T>;
82
- strokeOpacity?: import("../types/index.js").ConstantAccessor<number, T>;
83
- strokeLinejoin?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, T>;
84
- strokeLinecap?: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, T>;
85
- strokeMiterlimit?: import("../types/index.js").ConstantAccessor<number, T>;
86
- opacity?: import("../types/index.js").ChannelAccessor<T>;
87
- strokeDasharray?: import("../types/index.js").ConstantAccessor<string, T>;
88
- strokeDashoffset?: import("../types/index.js").ConstantAccessor<number, T>;
89
- mixBlendMode?: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, T>;
90
- clipPath?: string | undefined;
91
- imageFilter?: import("../types/index.js").ConstantAccessor<string, T>;
92
- shapeRendering?: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, T>;
93
- paintOrder?: import("../types/index.js").ConstantAccessor<string, T>;
94
- onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
95
- ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
96
- onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
97
- onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
98
- onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
99
- onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
100
- onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
101
- onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
102
- onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
103
- onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
104
- onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
105
- onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
106
- onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
107
- onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
108
- onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
109
- onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
110
- onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
111
- ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
112
- ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
113
- ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
114
- ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
115
- ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
116
- ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
117
- ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
118
- ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
119
- ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
120
- ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
121
- ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
122
- oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
123
- onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement> | undefined;
124
- class?: string | null | undefined;
125
- cursor?: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, T>;
126
- data: T[];
127
- };
7
+ }): any;
@@ -1,11 +1,8 @@
1
1
  import type { TransformArgsRow, TransformArgsRecord } from '../types/index.js';
2
- import { INDEX } from '../constants';
3
2
  export declare const X: unique symbol;
4
3
  export declare const Y: unique symbol;
5
4
  export declare const RAW_VALUE: unique symbol;
6
- export declare function indexData<T extends object>(data: T[]): (T & {
7
- [INDEX]: number;
8
- })[];
5
+ export declare function indexData<T extends object>(data: T[]): (T & {})[];
9
6
  export declare function recordizeX<T>({ data, ...channels }: TransformArgsRow<T>, { withIndex }?: {
10
7
  withIndex: boolean;
11
8
  }): TransformArgsRecord<T>;
@@ -13,12 +13,15 @@ export function indexData(data) {
13
13
  export function recordizeX({ data, ...channels }, { withIndex } = { withIndex: true }) {
14
14
  const dataIsRawValueArray = !isDataRecord(data[0]) && !Array.isArray(data[0]) && channels.x == null;
15
15
  if (dataIsRawValueArray) {
16
+ // we remove x, x1 and x2 from the channels since they make no sense when
17
+ // the data is a raw value array
18
+ const { x, x1, x2, ...nonXChannels } = channels;
16
19
  return {
17
20
  data: data.map((value, index) => ({
18
21
  [RAW_VALUE]: value,
19
22
  [INDEX]: index
20
23
  })),
21
- ...channels,
24
+ ...nonXChannels,
22
25
  x: RAW_VALUE,
23
26
  ...(withIndex ? { y: INDEX } : {})
24
27
  };
@@ -34,12 +37,15 @@ export function recordizeY({ data, ...channels }, { withIndex } = { withIndex: t
34
37
  return { data, ...channels };
35
38
  const dataIsRawValueArray = !isDataRecord(data[0]) && !Array.isArray(data[0]) && channels.y == null;
36
39
  if (dataIsRawValueArray) {
40
+ // we remove y, y1 and y2 from the channels since they make no sense when
41
+ // the data is a raw value array
42
+ const { y, y1, y2, ...nonYChannels } = channels;
37
43
  return {
38
44
  data: Array.from(data).map((value, index) => ({
39
45
  [INDEX]: index,
40
46
  [RAW_VALUE]: value
41
47
  })),
42
- ...channels,
48
+ ...nonYChannels,
43
49
  ...(withIndex ? { x: INDEX } : {}),
44
50
  y: RAW_VALUE
45
51
  };