svelteplot 0.3.11 → 0.4.1
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.
- package/dist/core/FacetGrid.svelte +3 -0
- package/dist/helpers/autoScales.js +1 -1
- package/dist/helpers/group.d.ts +2 -2
- package/dist/helpers/index.d.ts +3 -6
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/mergeDeep.js +0 -1
- package/dist/helpers/reduce.js +0 -1
- package/dist/helpers/scales.js +1 -1
- package/dist/marks/AreaX.svelte.d.ts +29 -29
- package/dist/marks/AreaY.svelte.d.ts +29 -29
- package/dist/marks/DotX.svelte.d.ts +29 -29
- package/dist/marks/DotY.svelte.d.ts +29 -29
- package/dist/marks/GridX.svelte +4 -2
- package/dist/marks/GridY.svelte +4 -2
- package/dist/marks/HTMLTooltip.svelte +38 -12
- package/dist/marks/HTMLTooltip.svelte.d.ts +2 -0
- package/dist/marks/LineX.svelte.d.ts +33 -33
- package/dist/marks/LineY.svelte.d.ts +33 -33
- package/dist/marks/Spike.svelte.d.ts +27 -27
- package/dist/marks/Text.svelte +9 -6
- package/dist/marks/Text.svelte.d.ts +8 -4
- package/dist/marks/helpers/MultilineText.svelte +6 -8
- package/dist/transforms/bollinger.d.ts +22 -22
- package/dist/transforms/filter.d.ts +2 -2
- package/dist/transforms/group.d.ts +4 -4
- package/dist/transforms/index.d.ts +1 -1
- package/dist/transforms/index.js +1 -1
- package/dist/transforms/map.d.ts +4 -184
- package/dist/transforms/normalize.d.ts +3 -123
- package/dist/transforms/select.d.ts +161 -161
- package/dist/transforms/sort.d.ts +50 -50
- package/dist/transforms/stack.d.ts +23 -1
- package/dist/transforms/stack.js +71 -2
- package/dist/transforms/window.d.ts +44 -46
- package/dist/types/channel.d.ts +1 -1
- package/dist/types/data.d.ts +1 -3
- package/dist/types/index.d.ts +4 -4
- package/dist/types/scale.d.ts +1 -1
- package/dist/ui/ExamplesGrid.svelte +2 -1
- package/package.json +16 -16
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
{#each fyValues as facetY, j (j)}
|
|
60
60
|
<g
|
|
61
61
|
class="facet"
|
|
62
|
+
data-facet-x={i}
|
|
63
|
+
data-facet-y={j}
|
|
64
|
+
data-facet={i * fyValues.length + j}
|
|
62
65
|
fill="currentColor"
|
|
63
66
|
style:display={emptyFacets.get(facetX)?.get(facetY) ? 'none' : 'block'}
|
|
64
67
|
transform="translate({useFacetX ? facetXScale(facetX) : 0}, {useFacetY
|
|
@@ -180,7 +180,7 @@ export function autoScaleColor({ type, domain, scaleOptions, plotOptions, plotWi
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
if (!fn) {
|
|
183
|
-
console.
|
|
183
|
+
console.error('color problem', type);
|
|
184
184
|
// problem
|
|
185
185
|
fn = () => 'red';
|
|
186
186
|
fn.range = () => ['red'];
|
package/dist/helpers/group.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Channels
|
|
1
|
+
import type { Channels } from '../types/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Groups the data by the fx, fy and z channels and calls the reduce function
|
|
4
4
|
* for each group. Returns the new channels to be added in the transform.
|
|
5
5
|
*/
|
|
6
|
-
export declare function groupFacetsAndZ(items:
|
|
6
|
+
export declare function groupFacetsAndZ<T>(items: T[], channels: Channels<T>, reduce: (items: T[]) => any): any;
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChannelName, Channels, DataRecord, RawValue } from '../types/index.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
/**
|
|
4
4
|
* Returns first argument that is not null or undefined
|
|
5
5
|
*/
|
|
6
6
|
export declare function coalesce(...args: (RawValue | undefined | null)[]): RawValue | null;
|
|
7
|
-
export declare function testFilter(datum:
|
|
8
|
-
value: import("../types/index.js").ChannelValue<Record<string | symbol, RawValue>>;
|
|
9
|
-
scale: boolean | null;
|
|
10
|
-
} | null;
|
|
7
|
+
export declare function testFilter<T>(datum: T, options: Channels<T>): true | T | null;
|
|
11
8
|
export declare function randomId(): string;
|
|
12
9
|
export declare function isSnippet(value: unknown): value is Snippet;
|
|
13
10
|
export declare function isValid(value: RawValue | undefined): value is number | Date | string;
|
|
14
11
|
export declare function maybeData(data: DataRecord[]): DataRecord[];
|
|
15
|
-
export declare function isObject(option: object |
|
|
12
|
+
export declare function isObject<T>(option: object | T): option is object;
|
|
16
13
|
export declare function maybeNumber(value: RawValue | null): number | null;
|
|
17
14
|
export declare const constant: <T>(x: T) => () => T;
|
|
18
15
|
export declare const POSITION_CHANNELS: Set<ChannelName>;
|
package/dist/helpers/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export function coalesce(...args) {
|
|
|
14
14
|
}
|
|
15
15
|
export function testFilter(datum, options) {
|
|
16
16
|
return (options.filter == null ||
|
|
17
|
-
resolveProp(options.filter, datum
|
|
17
|
+
resolveProp(options.filter, isObject(datum) && datum.hasOwnProperty(RAW_VALUE) ? datum[RAW_VALUE] : datum));
|
|
18
18
|
}
|
|
19
19
|
export function randomId() {
|
|
20
20
|
return Math.ceil(1e9 + Math.random() * 1e9).toString(36);
|
package/dist/helpers/reduce.js
CHANGED
|
@@ -72,7 +72,6 @@ export function reduceOutputs(newDatum, data, options, outputs, channels, newCha
|
|
|
72
72
|
if (typeof channels[k] === 'string') {
|
|
73
73
|
// the named reducer is applied to a column name, so we can use a combination
|
|
74
74
|
// of both as axis labels, e.g. MEAN(weight)
|
|
75
|
-
// eslint-disable-next-line no-irregular-whitespace
|
|
76
75
|
newChannels[`__${k}_origField`] = `${reducerName} ( ${channels[k]} )`;
|
|
77
76
|
}
|
|
78
77
|
else {
|
package/dist/helpers/scales.js
CHANGED
|
@@ -177,7 +177,7 @@ export function createScale(name, scaleOptions, marks, plotOptions, plotWidth, p
|
|
|
177
177
|
}
|
|
178
178
|
else {
|
|
179
179
|
if (markTypes.size > 0) {
|
|
180
|
-
console.
|
|
180
|
+
console.error('Setting interval via axis options is only supported for ordinal scales');
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import type { ChannelAccessor, DataRow } from '../types/index.js';
|
|
2
2
|
declare class __sveltets_Render<Datum extends DataRow> {
|
|
3
3
|
props(): Omit<Partial<{
|
|
4
|
-
filter?: import("../types/index.js").ConstantAccessor<boolean, import("../types/data").
|
|
4
|
+
filter?: import("../types/index.js").ConstantAccessor<boolean, Record<string | symbol, import("../types/data").RawValue>>;
|
|
5
5
|
facet?: "auto" | "include" | "exclude";
|
|
6
|
-
fx: ChannelAccessor<import("../types/data").
|
|
7
|
-
fy: ChannelAccessor<import("../types/data").
|
|
8
|
-
dx: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
9
|
-
dy: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
10
|
-
fill: ChannelAccessor<import("../types/data").
|
|
11
|
-
fillOpacity: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
6
|
+
fx: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
7
|
+
fy: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
8
|
+
dx: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
9
|
+
dy: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
10
|
+
fill: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
11
|
+
fillOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
12
12
|
sort: {
|
|
13
13
|
channel: string;
|
|
14
14
|
order?: "ascending" | "descending";
|
|
15
|
-
} | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, import("../types/data").
|
|
16
|
-
stroke: ChannelAccessor<import("../types/data").
|
|
17
|
-
strokeWidth: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
18
|
-
strokeOpacity: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
19
|
-
strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, import("../types/data").
|
|
20
|
-
strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, import("../types/data").
|
|
21
|
-
strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
22
|
-
opacity: ChannelAccessor<import("../types/data").
|
|
23
|
-
strokeDasharray: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
24
|
-
strokeDashoffset: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
25
|
-
mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, import("../types/data").
|
|
15
|
+
} | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, Record<string | symbol, import("../types/data").RawValue>>;
|
|
16
|
+
stroke: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
17
|
+
strokeWidth: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
18
|
+
strokeOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
19
|
+
strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Record<string | symbol, import("../types/data").RawValue>>;
|
|
20
|
+
strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Record<string | symbol, import("../types/data").RawValue>>;
|
|
21
|
+
strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
22
|
+
opacity: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
23
|
+
strokeDasharray: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
24
|
+
strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
25
|
+
mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/data").RawValue>>;
|
|
26
26
|
clipPath: string;
|
|
27
|
-
imageFilter: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
28
|
-
shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, import("../types/data").
|
|
29
|
-
paintOrder: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
27
|
+
imageFilter: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
28
|
+
shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/data").RawValue>>;
|
|
29
|
+
paintOrder: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
30
30
|
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
31
31
|
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
32
32
|
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
@@ -58,14 +58,14 @@ declare class __sveltets_Render<Datum extends DataRow> {
|
|
|
58
58
|
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
59
59
|
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
60
60
|
class: string | null;
|
|
61
|
-
cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, import("../types/data").
|
|
62
|
-
}> & import("../types/mark").LinkableMarkProps<import("../types/data").
|
|
63
|
-
data: import("../types/data").
|
|
64
|
-
x1?: ChannelAccessor<import("../types/data").
|
|
65
|
-
x2?: ChannelAccessor<import("../types/data").
|
|
66
|
-
y1?: ChannelAccessor<import("../types/data").
|
|
67
|
-
y2?: ChannelAccessor<import("../types/data").
|
|
68
|
-
z?: ChannelAccessor<import("../types/data").
|
|
61
|
+
cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Record<string | symbol, import("../types/data").RawValue>>;
|
|
62
|
+
}> & import("../types/mark").LinkableMarkProps<Record<string | symbol, import("../types/data").RawValue>> & {
|
|
63
|
+
data: Record<string | symbol, import("../types/data").RawValue>[];
|
|
64
|
+
x1?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
65
|
+
x2?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
66
|
+
y1?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
67
|
+
y2?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
68
|
+
z?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
69
69
|
curve?: import("../types/index.js").CurveName | import("d3-shape").CurveFactory;
|
|
70
70
|
tension?: number;
|
|
71
71
|
sort?: import("../types/index.js").ConstantAccessor<import("../types/data").RawValue> | {
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import type { ChannelAccessor, DataRow } from '../types/index.js';
|
|
2
2
|
declare class __sveltets_Render<Datum extends DataRow> {
|
|
3
3
|
props(): Omit<Partial<{
|
|
4
|
-
filter?: import("../types/index.js").ConstantAccessor<boolean, import("../types/data").
|
|
4
|
+
filter?: import("../types/index.js").ConstantAccessor<boolean, Record<string | symbol, import("../types/data").RawValue>>;
|
|
5
5
|
facet?: "auto" | "include" | "exclude";
|
|
6
|
-
fx: ChannelAccessor<import("../types/data").
|
|
7
|
-
fy: ChannelAccessor<import("../types/data").
|
|
8
|
-
dx: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
9
|
-
dy: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
10
|
-
fill: ChannelAccessor<import("../types/data").
|
|
11
|
-
fillOpacity: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
6
|
+
fx: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
7
|
+
fy: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
8
|
+
dx: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
9
|
+
dy: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
10
|
+
fill: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
11
|
+
fillOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
12
12
|
sort: {
|
|
13
13
|
channel: string;
|
|
14
14
|
order?: "ascending" | "descending";
|
|
15
|
-
} | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, import("../types/data").
|
|
16
|
-
stroke: ChannelAccessor<import("../types/data").
|
|
17
|
-
strokeWidth: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
18
|
-
strokeOpacity: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
19
|
-
strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, import("../types/data").
|
|
20
|
-
strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, import("../types/data").
|
|
21
|
-
strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
22
|
-
opacity: ChannelAccessor<import("../types/data").
|
|
23
|
-
strokeDasharray: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
24
|
-
strokeDashoffset: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
25
|
-
mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, import("../types/data").
|
|
15
|
+
} | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, Record<string | symbol, import("../types/data").RawValue>>;
|
|
16
|
+
stroke: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
17
|
+
strokeWidth: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
18
|
+
strokeOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
19
|
+
strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Record<string | symbol, import("../types/data").RawValue>>;
|
|
20
|
+
strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Record<string | symbol, import("../types/data").RawValue>>;
|
|
21
|
+
strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
22
|
+
opacity: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
23
|
+
strokeDasharray: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
24
|
+
strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
25
|
+
mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/data").RawValue>>;
|
|
26
26
|
clipPath: string;
|
|
27
|
-
imageFilter: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
28
|
-
shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, import("../types/data").
|
|
29
|
-
paintOrder: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
27
|
+
imageFilter: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
28
|
+
shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/data").RawValue>>;
|
|
29
|
+
paintOrder: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
30
30
|
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
31
31
|
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
32
32
|
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
@@ -58,14 +58,14 @@ declare class __sveltets_Render<Datum extends DataRow> {
|
|
|
58
58
|
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
59
59
|
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
60
60
|
class: string | null;
|
|
61
|
-
cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, import("../types/data").
|
|
62
|
-
}> & import("../types/mark").LinkableMarkProps<import("../types/data").
|
|
63
|
-
data: import("../types/data").
|
|
64
|
-
x1?: ChannelAccessor<import("../types/data").
|
|
65
|
-
x2?: ChannelAccessor<import("../types/data").
|
|
66
|
-
y1?: ChannelAccessor<import("../types/data").
|
|
67
|
-
y2?: ChannelAccessor<import("../types/data").
|
|
68
|
-
z?: ChannelAccessor<import("../types/data").
|
|
61
|
+
cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Record<string | symbol, import("../types/data").RawValue>>;
|
|
62
|
+
}> & import("../types/mark").LinkableMarkProps<Record<string | symbol, import("../types/data").RawValue>> & {
|
|
63
|
+
data: Record<string | symbol, import("../types/data").RawValue>[];
|
|
64
|
+
x1?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
65
|
+
x2?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
66
|
+
y1?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
67
|
+
y2?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
68
|
+
z?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
69
69
|
curve?: import("../types/index.js").CurveName | import("d3-shape").CurveFactory;
|
|
70
70
|
tension?: number;
|
|
71
71
|
sort?: import("../types/index.js").ConstantAccessor<import("../types/data").RawValue> | {
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import type { DataRow } from '../types/index.js';
|
|
2
2
|
declare class __sveltets_Render<Datum extends DataRow> {
|
|
3
3
|
props(): Omit<Partial<{
|
|
4
|
-
filter?: import("../types/index.js").ConstantAccessor<boolean, import("../types/data").
|
|
4
|
+
filter?: import("../types/index.js").ConstantAccessor<boolean, Record<string | symbol, import("../types/data").RawValue>>;
|
|
5
5
|
facet?: "auto" | "include" | "exclude";
|
|
6
|
-
fx: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
7
|
-
fy: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
8
|
-
dx: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
9
|
-
dy: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
10
|
-
fill: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
11
|
-
fillOpacity: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
6
|
+
fx: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
7
|
+
fy: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
8
|
+
dx: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
9
|
+
dy: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
10
|
+
fill: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
11
|
+
fillOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
12
12
|
sort: {
|
|
13
13
|
channel: string;
|
|
14
14
|
order?: "ascending" | "descending";
|
|
15
|
-
} | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, import("../types/data").
|
|
16
|
-
stroke: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
17
|
-
strokeWidth: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
18
|
-
strokeOpacity: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
19
|
-
strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, import("../types/data").
|
|
20
|
-
strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, import("../types/data").
|
|
21
|
-
strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
22
|
-
opacity: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
23
|
-
strokeDasharray: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
24
|
-
strokeDashoffset: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
25
|
-
mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, import("../types/data").
|
|
15
|
+
} | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, Record<string | symbol, import("../types/data").RawValue>>;
|
|
16
|
+
stroke: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
17
|
+
strokeWidth: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
18
|
+
strokeOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
19
|
+
strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Record<string | symbol, import("../types/data").RawValue>>;
|
|
20
|
+
strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Record<string | symbol, import("../types/data").RawValue>>;
|
|
21
|
+
strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
22
|
+
opacity: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
23
|
+
strokeDasharray: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
24
|
+
strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
25
|
+
mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/data").RawValue>>;
|
|
26
26
|
clipPath: string;
|
|
27
|
-
imageFilter: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
28
|
-
shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, import("../types/data").
|
|
29
|
-
paintOrder: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
27
|
+
imageFilter: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
28
|
+
shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/data").RawValue>>;
|
|
29
|
+
paintOrder: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
30
30
|
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
31
31
|
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
32
32
|
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
@@ -58,15 +58,15 @@ declare class __sveltets_Render<Datum extends DataRow> {
|
|
|
58
58
|
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
59
59
|
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
60
60
|
class: string | null;
|
|
61
|
-
cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, import("../types/data").
|
|
62
|
-
}> & import("../types/mark").LinkableMarkProps<import("../types/data").
|
|
63
|
-
data: import("../types/data").
|
|
64
|
-
x: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
65
|
-
y: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
66
|
-
r?: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
67
|
-
symbol?: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
61
|
+
cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Record<string | symbol, import("../types/data").RawValue>>;
|
|
62
|
+
}> & import("../types/mark").LinkableMarkProps<Record<string | symbol, import("../types/data").RawValue>> & {
|
|
63
|
+
data: Record<string | symbol, import("../types/data").RawValue>[];
|
|
64
|
+
x: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
65
|
+
y: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
66
|
+
r?: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
67
|
+
symbol?: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>> | import("svelte").Snippet<[number, string]>;
|
|
68
68
|
canvas?: boolean;
|
|
69
|
-
dotClass?: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
69
|
+
dotClass?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
70
70
|
}, "y" | "data"> & {
|
|
71
71
|
data: Datum[];
|
|
72
72
|
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import type { DataRow } from '../types/index.js';
|
|
2
2
|
declare class __sveltets_Render<Datum extends DataRow> {
|
|
3
3
|
props(): Omit<Partial<{
|
|
4
|
-
filter?: import("../types/index.js").ConstantAccessor<boolean, import("../types/data").
|
|
4
|
+
filter?: import("../types/index.js").ConstantAccessor<boolean, Record<string | symbol, import("../types/data").RawValue>>;
|
|
5
5
|
facet?: "auto" | "include" | "exclude";
|
|
6
|
-
fx: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
7
|
-
fy: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
8
|
-
dx: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
9
|
-
dy: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
10
|
-
fill: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
11
|
-
fillOpacity: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
6
|
+
fx: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
7
|
+
fy: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
8
|
+
dx: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
9
|
+
dy: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
10
|
+
fill: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
11
|
+
fillOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
12
12
|
sort: {
|
|
13
13
|
channel: string;
|
|
14
14
|
order?: "ascending" | "descending";
|
|
15
|
-
} | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, import("../types/data").
|
|
16
|
-
stroke: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
17
|
-
strokeWidth: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
18
|
-
strokeOpacity: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
19
|
-
strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, import("../types/data").
|
|
20
|
-
strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, import("../types/data").
|
|
21
|
-
strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
22
|
-
opacity: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
23
|
-
strokeDasharray: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
24
|
-
strokeDashoffset: import("../types/index.js").ConstantAccessor<number, import("../types/data").
|
|
25
|
-
mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, import("../types/data").
|
|
15
|
+
} | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, Record<string | symbol, import("../types/data").RawValue>>;
|
|
16
|
+
stroke: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
17
|
+
strokeWidth: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
18
|
+
strokeOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
19
|
+
strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Record<string | symbol, import("../types/data").RawValue>>;
|
|
20
|
+
strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Record<string | symbol, import("../types/data").RawValue>>;
|
|
21
|
+
strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
22
|
+
opacity: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
23
|
+
strokeDasharray: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
24
|
+
strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
|
|
25
|
+
mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/data").RawValue>>;
|
|
26
26
|
clipPath: string;
|
|
27
|
-
imageFilter: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
28
|
-
shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, import("../types/data").
|
|
29
|
-
paintOrder: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
27
|
+
imageFilter: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
28
|
+
shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/data").RawValue>>;
|
|
29
|
+
paintOrder: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
30
30
|
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
31
31
|
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
32
32
|
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
@@ -58,15 +58,15 @@ declare class __sveltets_Render<Datum extends DataRow> {
|
|
|
58
58
|
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
59
59
|
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
60
60
|
class: string | null;
|
|
61
|
-
cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, import("../types/data").
|
|
62
|
-
}> & import("../types/mark").LinkableMarkProps<import("../types/data").
|
|
63
|
-
data: import("../types/data").
|
|
64
|
-
x: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
65
|
-
y: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
66
|
-
r?: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
67
|
-
symbol?: import("../types/channel").ChannelAccessor<import("../types/data").
|
|
61
|
+
cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Record<string | symbol, import("../types/data").RawValue>>;
|
|
62
|
+
}> & import("../types/mark").LinkableMarkProps<Record<string | symbol, import("../types/data").RawValue>> & {
|
|
63
|
+
data: Record<string | symbol, import("../types/data").RawValue>[];
|
|
64
|
+
x: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
65
|
+
y: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
66
|
+
r?: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
|
|
67
|
+
symbol?: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>> | import("svelte").Snippet<[number, string]>;
|
|
68
68
|
canvas?: boolean;
|
|
69
|
-
dotClass?: import("../types/index.js").ConstantAccessor<string, import("../types/data").
|
|
69
|
+
dotClass?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
|
|
70
70
|
}, "x" | "data"> & {
|
|
71
71
|
data: Datum[];
|
|
72
72
|
};
|
package/dist/marks/GridX.svelte
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { getContext } from 'svelte';
|
|
10
10
|
import Mark from '../Mark.svelte';
|
|
11
11
|
import type { PlotContext, BaseMarkProps, RawValue, PlotDefaults } from '../types/index.js';
|
|
12
|
-
import { resolveChannel, resolveStyles } from '../helpers/resolve.js';
|
|
12
|
+
import { resolveChannel, resolveProp, resolveStyles } from '../helpers/resolve.js';
|
|
13
13
|
import { autoTicks } from '../helpers/autoTicks.js';
|
|
14
14
|
import { testFilter } from '../helpers/index.js';
|
|
15
15
|
import { RAW_VALUE } from '../transforms/recordize.js';
|
|
@@ -68,6 +68,8 @@
|
|
|
68
68
|
(plot.scales.x.type === 'band' ? plot.scales.x.fn.bandwidth() * 0.5 : 0)}
|
|
69
69
|
{@const y1_ = resolveChannel('y1', tick, options)}
|
|
70
70
|
{@const y2_ = resolveChannel('y2', tick, options)}
|
|
71
|
+
{@const dx = +resolveProp(options?.dx, tick, 0)}
|
|
72
|
+
{@const dy = +resolveProp(options?.dy, tick, 0)}
|
|
71
73
|
{@const y1 = options.y1 != null ? plot.scales.y.fn(y1_) : 0}
|
|
72
74
|
{@const y2 = options.y2 != null ? plot.scales.y.fn(y2_) : plot.facetHeight}
|
|
73
75
|
{@const [style, styleClass] = resolveStyles(
|
|
@@ -80,7 +82,7 @@
|
|
|
80
82
|
)}
|
|
81
83
|
<line
|
|
82
84
|
class={styleClass}
|
|
83
|
-
transform="translate({x},{plot.options.marginTop})"
|
|
85
|
+
transform="translate({x + dx},{plot.options.marginTop + dy})"
|
|
84
86
|
{style}
|
|
85
87
|
{y1}
|
|
86
88
|
{y2} />
|
package/dist/marks/GridY.svelte
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { getContext } from 'svelte';
|
|
10
10
|
import Mark from '../Mark.svelte';
|
|
11
11
|
import type { PlotContext, BaseMarkProps, RawValue, PlotDefaults } from '../types/index.js';
|
|
12
|
-
import { resolveChannel, resolveStyles } from '../helpers/resolve.js';
|
|
12
|
+
import { resolveChannel, resolveProp, resolveStyles } from '../helpers/resolve.js';
|
|
13
13
|
import { autoTicks } from '../helpers/autoTicks.js';
|
|
14
14
|
import { testFilter } from '../helpers/index.js';
|
|
15
15
|
import { RAW_VALUE } from '../transforms/recordize.js';
|
|
@@ -70,6 +70,8 @@
|
|
|
70
70
|
{@const x2_ = resolveChannel('x2', tick, options)}
|
|
71
71
|
{@const x1 = options.x1 != null ? plot.scales.x.fn(x1_) : 0}
|
|
72
72
|
{@const x2 = options.x2 != null ? plot.scales.x.fn(x2_) : plot.facetWidth}
|
|
73
|
+
{@const dx = +resolveProp(options?.dx, tick, 0)}
|
|
74
|
+
{@const dy = +resolveProp(options?.dy, tick, 0)}
|
|
73
75
|
{@const [style, styleClass] = resolveStyles(
|
|
74
76
|
plot,
|
|
75
77
|
{ datum: { [RAW_VALUE]: tick } },
|
|
@@ -81,7 +83,7 @@
|
|
|
81
83
|
<line
|
|
82
84
|
{style}
|
|
83
85
|
class={styleClass}
|
|
84
|
-
transform="translate({plot.options.marginLeft},{y})"
|
|
86
|
+
transform="translate({plot.options.marginLeft + dx},{y + dy})"
|
|
85
87
|
{x1}
|
|
86
88
|
{x2} />
|
|
87
89
|
{/if}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
x?: ChannelAccessor<Datum>;
|
|
9
9
|
y?: ChannelAccessor<Datum>;
|
|
10
10
|
r?: ChannelAccessor<Datum>;
|
|
11
|
+
fx?: ChannelAccessor<Datum>;
|
|
12
|
+
fy?: ChannelAccessor<Datum>;
|
|
11
13
|
children: Snippet<[{ datum: Datum }]>;
|
|
12
14
|
}
|
|
13
15
|
import { getContext, type Snippet } from 'svelte';
|
|
@@ -19,18 +21,33 @@
|
|
|
19
21
|
import { resolveChannel } from '../helpers/resolve.js';
|
|
20
22
|
import { quadtree } from 'd3-quadtree';
|
|
21
23
|
import { projectX, projectY } from '../helpers/scales.js';
|
|
24
|
+
import { groupFacetsAndZ } from '../helpers/group.js';
|
|
22
25
|
|
|
23
|
-
let { data, x, y, r, children }: HTMLTooltipMarkProps = $props();
|
|
26
|
+
let { data, x, y, r, fx, fy, children }: HTMLTooltipMarkProps = $props();
|
|
24
27
|
|
|
25
28
|
let datum = $state(false);
|
|
26
29
|
let tooltipX = $state();
|
|
27
30
|
let tooltipY = $state();
|
|
28
31
|
|
|
32
|
+
let facetOffsetX = $state(0);
|
|
33
|
+
let facetOffsetY = $state(0);
|
|
34
|
+
|
|
29
35
|
function onPointerMove(evt: MouseEvent) {
|
|
30
36
|
const plotRect = plot.body.getBoundingClientRect();
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
let facetEl = evt.target as SVGElement;
|
|
38
|
+
while (facetEl && !facetEl.classList.contains('facet')) {
|
|
39
|
+
facetEl = facetEl.parentElement;
|
|
40
|
+
}
|
|
41
|
+
const facetIndex = +(facetEl?.dataset?.facet ?? 0);
|
|
42
|
+
const facetRect = (facetEl?.firstChild ?? plot.body).getBoundingClientRect();
|
|
43
|
+
|
|
44
|
+
facetOffsetX = facetRect.left - plotRect.left - plot.options.marginLeft;
|
|
45
|
+
facetOffsetY = facetRect.top - plotRect.top - plot.options.marginTop;
|
|
46
|
+
|
|
47
|
+
const relativeX = evt.clientX - facetRect.left + (plot.options.marginLeft ?? 0);
|
|
48
|
+
const relativeY = evt.clientY - facetRect.top + (plot.options.marginTop ?? 0);
|
|
49
|
+
|
|
50
|
+
const pt = trees[facetIndex].find(relativeX, relativeY, 25);
|
|
34
51
|
if (pt) {
|
|
35
52
|
tooltipX = resolveChannel('x', pt, { x, y, r });
|
|
36
53
|
tooltipY = resolveChannel('y', pt, { x, y, r });
|
|
@@ -54,18 +71,26 @@
|
|
|
54
71
|
};
|
|
55
72
|
});
|
|
56
73
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
const groups = $derived.by(() => {
|
|
75
|
+
const groups: Datum[][] = [];
|
|
76
|
+
groupFacetsAndZ(data, { fx, fy }, (d) => groups.push(d));
|
|
77
|
+
return groups;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const trees = $derived(
|
|
81
|
+
groups.map((items) =>
|
|
82
|
+
quadtree()
|
|
83
|
+
.x((d) => projectX('x', plot.scales, resolveChannel('x', d, { x, y, r })))
|
|
84
|
+
.y((d) => projectY('y', plot.scales, resolveChannel('y', d, { x, y, r })))
|
|
85
|
+
.addAll(items)
|
|
86
|
+
)
|
|
62
87
|
);
|
|
63
88
|
</script>
|
|
64
89
|
|
|
65
90
|
<div
|
|
66
91
|
class={['tooltip', { hide: !datum }]}
|
|
67
|
-
style:left="{tooltipX ? projectX('x', plot.scales, tooltipX) : 0}px"
|
|
68
|
-
style:top="{tooltipY ? projectY('y', plot.scales, tooltipY) : 0}px">
|
|
92
|
+
style:left="{tooltipX ? facetOffsetX + projectX('x', plot.scales, tooltipX) : 0}px"
|
|
93
|
+
style:top="{tooltipY ? facetOffsetY + projectY('y', plot.scales, tooltipY) : 0}px">
|
|
69
94
|
<div class="tooltip-body">
|
|
70
95
|
{@render children({ datum })}
|
|
71
96
|
</div>
|
|
@@ -77,9 +102,10 @@
|
|
|
77
102
|
background: var(--svelteplot-tooltip-bg);
|
|
78
103
|
border: 1px solid #ccc;
|
|
79
104
|
border-color: var(--svelteplot-tooltip-border);
|
|
80
|
-
font-size:
|
|
105
|
+
font-size: 12px;
|
|
81
106
|
padding: 1ex 1em;
|
|
82
107
|
border-radius: 3px;
|
|
108
|
+
line-height: 1.2;
|
|
83
109
|
box-shadow:
|
|
84
110
|
rgba(50, 50, 93, 0.25) 0px 2px 5px -1px,
|
|
85
111
|
rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
|