svelteplot 0.3.10-pr-152.0 → 0.3.11-pr-153.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.
|
@@ -12,5 +12,5 @@ export { renameChannels, replaceChannels } from './rename.js';
|
|
|
12
12
|
export { select, selectFirst, selectLast, selectMaxX, selectMaxY, selectMinX, selectMinY } from './select.js';
|
|
13
13
|
export { shiftX, shiftY } from './shift.js';
|
|
14
14
|
export { sort, shuffle, reverse } from './sort.js';
|
|
15
|
-
export { stackX, stackY } from './stack.js';
|
|
15
|
+
export { stackX, stackY, stackMarimekko } from './stack.js';
|
|
16
16
|
export { windowX, windowY } from './window.js';
|
package/dist/transforms/index.js
CHANGED
|
@@ -12,5 +12,5 @@ export { renameChannels, replaceChannels } from './rename.js';
|
|
|
12
12
|
export { select, selectFirst, selectLast, selectMaxX, selectMaxY, selectMinX, selectMinY } from './select.js';
|
|
13
13
|
export { shiftX, shiftY } from './shift.js';
|
|
14
14
|
export { sort, shuffle, reverse } from './sort.js';
|
|
15
|
-
export { stackX, stackY } from './stack.js';
|
|
15
|
+
export { stackX, stackY, stackMarimekko } from './stack.js';
|
|
16
16
|
export { windowX, windowY } from './window.js';
|
|
@@ -8,3 +8,18 @@ export type StackOptions = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare function stackY<T>({ data, ...channels }: T, opts?: Partial<StackOptions>): T;
|
|
10
10
|
export declare function stackX({ data, ...channels }: TransformArg, opts?: Partial<StackOptions>): TransformArg;
|
|
11
|
+
export declare function stackMarimekko({ data, x, y, value, ...rest }: {
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
data: any;
|
|
14
|
+
x: any;
|
|
15
|
+
y: any;
|
|
16
|
+
value: any;
|
|
17
|
+
}, { x: xOpt, y: yOpt }?: {}): {
|
|
18
|
+
data: any[];
|
|
19
|
+
x: symbol;
|
|
20
|
+
x1: symbol;
|
|
21
|
+
x2: symbol;
|
|
22
|
+
y: symbol;
|
|
23
|
+
y1: symbol;
|
|
24
|
+
y2: symbol;
|
|
25
|
+
};
|
package/dist/transforms/stack.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import isDataRecord from '../helpers/isDataRecord.js';
|
|
2
2
|
import { resolveChannel } from '../helpers/resolve.js';
|
|
3
3
|
import { stack, stackOffsetExpand, stackOffsetSilhouette, stackOffsetWiggle, stackOrderAppearance, stackOrderAscending, stackOrderInsideOut, stackOrderNone, stackOffsetDiverging } from 'd3-shape';
|
|
4
|
-
import { index, union, groups as d3Groups } from 'd3-array';
|
|
4
|
+
import { index, union, sum, groups as d3Groups } from 'd3-array';
|
|
5
5
|
const GROUP = Symbol('group');
|
|
6
6
|
const FACET = Symbol('group');
|
|
7
7
|
const DEFAULT_STACK_OPTIONS = {
|
|
@@ -110,3 +110,33 @@ function applyDefaults(opts) {
|
|
|
110
110
|
}
|
|
111
111
|
return { ...DEFAULT_STACK_OPTIONS, ...opts };
|
|
112
112
|
}
|
|
113
|
+
const X = Symbol('x'), X1 = Symbol('x1'), X2 = Symbol('x2');
|
|
114
|
+
const Y = Symbol('y'), Y1 = Symbol('y1'), Y2 = Symbol('y2');
|
|
115
|
+
export function stackMarimekko({ data, x, y, value, ...rest }, { x: xOpt, y: yOpt } = {}) {
|
|
116
|
+
const total = sum(data, (d) => d[value]);
|
|
117
|
+
let xPos = 0;
|
|
118
|
+
const grouped = d3Groups(data, (d) => d[x]).flatMap(([k, items]) => {
|
|
119
|
+
const groupValue = sum(items, (d) => d[value]);
|
|
120
|
+
const x1 = xPos, x2 = xPos + groupValue;
|
|
121
|
+
xPos = x2;
|
|
122
|
+
let yPos = 0;
|
|
123
|
+
return items.map((d) => {
|
|
124
|
+
const y1 = yPos, y2 = yPos + d[value];
|
|
125
|
+
yPos = y2;
|
|
126
|
+
const normX1 = xOpt?.percent ? x1 / total : x1;
|
|
127
|
+
const normX2 = xOpt?.percent ? x2 / total : x2;
|
|
128
|
+
const normY1 = yOpt?.percent ? y1 / groupValue : y1;
|
|
129
|
+
const normY2 = yOpt?.percent ? y2 / groupValue : y2;
|
|
130
|
+
return {
|
|
131
|
+
...d,
|
|
132
|
+
[X1]: normX1,
|
|
133
|
+
[X2]: normX2,
|
|
134
|
+
[Y1]: normY1,
|
|
135
|
+
[Y2]: normY2,
|
|
136
|
+
[X]: (normX1 + normX2) / 2,
|
|
137
|
+
[Y]: (normY1 + normY2) / 2
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
return { ...rest, data: grouped, x: X, x1: X1, x2: X2, y: Y, y1: Y1, y2: Y2 };
|
|
142
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { resolve } from '$app/paths';
|
|
2
3
|
let { examples } = $props();
|
|
3
4
|
</script>
|
|
4
5
|
|
|
5
6
|
<div class="list">
|
|
6
7
|
{#each examples as page, i (i)}
|
|
7
|
-
<a href={page.url}>
|
|
8
|
+
<a href={resolve(page.url)}>
|
|
8
9
|
<div>
|
|
9
10
|
{#if page.screenshot}
|
|
10
11
|
<img src={page.screenshot} alt={page.title} />{/if}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelteplot",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11-pr-153.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Gregor Aisch",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@aitodotai/json-stringify-pretty-compact": "^1.3.0",
|
|
54
54
|
"@emotion/css": "^11.13.5",
|
|
55
|
-
"@sveltejs/adapter-auto": "^6.0
|
|
56
|
-
"@sveltejs/adapter-static": "^3.0.
|
|
55
|
+
"@sveltejs/adapter-auto": "^6.1.0",
|
|
56
|
+
"@sveltejs/adapter-static": "^3.0.9",
|
|
57
57
|
"@sveltejs/eslint-config": "^8.3.4",
|
|
58
|
-
"@sveltejs/kit": "^2.
|
|
59
|
-
"@sveltejs/package": "^2.
|
|
58
|
+
"@sveltejs/kit": "^2.37.0",
|
|
59
|
+
"@sveltejs/package": "^2.5.0",
|
|
60
60
|
"@sveltejs/vite-plugin-svelte": "5.1.1",
|
|
61
61
|
"@sveltepress/theme-default": "^6.0.4",
|
|
62
62
|
"@sveltepress/twoslash": "^1.2.2",
|
|
@@ -77,32 +77,32 @@
|
|
|
77
77
|
"@types/geojson": "^7946.0.16",
|
|
78
78
|
"@types/topojson": "^3.2.6",
|
|
79
79
|
"@types/topojson-client": "^3.1.5",
|
|
80
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
81
|
-
"@typescript-eslint/parser": "^8.
|
|
80
|
+
"@typescript-eslint/eslint-plugin": "^8.42.0",
|
|
81
|
+
"@typescript-eslint/parser": "^8.42.0",
|
|
82
82
|
"csstype": "^3.1.3",
|
|
83
83
|
"d3-dsv": "^3.0.1",
|
|
84
84
|
"d3-fetch": "^3.0.1",
|
|
85
85
|
"d3-force": "^3.0.0",
|
|
86
|
-
"eslint": "^9.
|
|
86
|
+
"eslint": "^9.34.0",
|
|
87
87
|
"eslint-config-prettier": "^10.1.8",
|
|
88
|
-
"eslint-plugin-svelte": "3.
|
|
88
|
+
"eslint-plugin-svelte": "3.12.1",
|
|
89
89
|
"jsdom": "^26.1.0",
|
|
90
90
|
"prettier": "^3.6.2",
|
|
91
91
|
"prettier-plugin-svelte": "^3.4.0",
|
|
92
|
-
"puppeteer": "^24.
|
|
92
|
+
"puppeteer": "^24.19.0",
|
|
93
93
|
"remark-code-extra": "^1.0.1",
|
|
94
94
|
"remark-code-frontmatter": "^1.0.0",
|
|
95
95
|
"resize-observer-polyfill": "^1.5.1",
|
|
96
|
-
"sass": "^1.
|
|
96
|
+
"sass": "^1.92.0",
|
|
97
97
|
"svelte-check": "^4.3.1",
|
|
98
98
|
"svelte-eslint-parser": "1.3.1",
|
|
99
|
-
"svelte-highlight": "^7.8.
|
|
99
|
+
"svelte-highlight": "^7.8.4",
|
|
100
100
|
"svg-path-parser": "^1.1.0",
|
|
101
101
|
"topojson-client": "^3.1.0",
|
|
102
102
|
"ts-essentials": "^10.1.1",
|
|
103
103
|
"tslib": "^2.8.1",
|
|
104
|
-
"typedoc": "^0.28.
|
|
105
|
-
"typedoc-plugin-markdown": "^4.8.
|
|
104
|
+
"typedoc": "^0.28.12",
|
|
105
|
+
"typedoc-plugin-markdown": "^4.8.1",
|
|
106
106
|
"typescript": "^5.9.2",
|
|
107
107
|
"vite": "^6.3.5",
|
|
108
108
|
"vitest": "^3.2.4",
|
|
@@ -124,9 +124,9 @@
|
|
|
124
124
|
"d3-scale-chromatic": "^3.1.0",
|
|
125
125
|
"d3-shape": "^3.2.0",
|
|
126
126
|
"d3-time": "^3.1.0",
|
|
127
|
-
"es-toolkit": "^1.39.
|
|
127
|
+
"es-toolkit": "^1.39.10",
|
|
128
128
|
"fast-equals": "^5.2.2",
|
|
129
129
|
"merge-deep": "^3.0.3",
|
|
130
|
-
"svelte": "5.
|
|
130
|
+
"svelte": "5.38.7"
|
|
131
131
|
}
|
|
132
132
|
}
|