svelteplot 0.3.3 → 0.3.5-pr-121.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.
- package/dist/Mark.svelte +25 -27
- package/dist/Mark.svelte.d.ts +87 -17
- package/dist/Plot.svelte +1 -2
- package/dist/Plot.svelte.d.ts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/core/Facet.svelte +1 -1
- package/dist/core/Facet.svelte.d.ts +1 -1
- package/dist/core/FacetAxes.svelte +3 -1
- package/dist/core/FacetGrid.svelte +1 -1
- package/dist/core/FacetGrid.svelte.d.ts +1 -1
- package/dist/core/Plot.svelte +1 -1
- package/dist/core/Plot.svelte.d.ts +1 -1
- package/dist/helpers/autoScales.d.ts +1 -1
- package/dist/helpers/autoTicks.d.ts +1 -1
- package/dist/helpers/autoTicks.js +1 -1
- package/dist/helpers/callWithProps.d.ts +1 -1
- package/dist/helpers/colors.d.ts +2 -2
- package/dist/helpers/curves.d.ts +1 -1
- package/dist/helpers/facets.d.ts +1 -1
- package/dist/helpers/getBaseStyles.d.ts +4 -2
- package/dist/helpers/getBaseStyles.js +8 -0
- package/dist/helpers/group.d.ts +1 -1
- package/dist/helpers/index.d.ts +3 -3
- package/dist/helpers/isDataRecord.d.ts +1 -1
- package/dist/helpers/isRawValue.d.ts +1 -1
- package/dist/helpers/projection.d.ts +1 -1
- package/dist/helpers/reduce.d.ts +1 -1
- package/dist/helpers/regressionLoess.d.ts +1 -1
- package/dist/helpers/resolve.d.ts +3 -3
- package/dist/helpers/scales.d.ts +2 -2
- package/dist/helpers/typeChecks.d.ts +5 -5
- package/dist/marks/Area.svelte +14 -17
- package/dist/marks/Area.svelte.d.ts +91 -19
- package/dist/marks/AreaX.svelte +15 -12
- package/dist/marks/AreaX.svelte.d.ts +94 -3
- package/dist/marks/AreaY.svelte +15 -15
- package/dist/marks/AreaY.svelte.d.ts +94 -3
- package/dist/marks/Arrow.svelte +16 -19
- package/dist/marks/Arrow.svelte.d.ts +110 -38
- package/dist/marks/AxisX.svelte +60 -56
- package/dist/marks/AxisX.svelte.d.ts +98 -25
- package/dist/marks/AxisY.svelte +73 -54
- package/dist/marks/AxisY.svelte.d.ts +100 -27
- package/dist/marks/BarX.svelte +28 -30
- package/dist/marks/BarX.svelte.d.ts +89 -17
- package/dist/marks/BarY.svelte +27 -27
- package/dist/marks/BarY.svelte.d.ts +88 -16
- package/dist/marks/BollingerX.svelte +21 -16
- package/dist/marks/BollingerX.svelte.d.ts +17 -16
- package/dist/marks/BollingerY.svelte +21 -16
- package/dist/marks/BollingerY.svelte.d.ts +17 -16
- package/dist/marks/BoxX.svelte +5 -7
- package/dist/marks/BoxX.svelte.d.ts +5 -3
- package/dist/marks/BoxY.svelte +13 -16
- package/dist/marks/BoxY.svelte.d.ts +41 -28
- package/dist/marks/Brush.svelte +27 -30
- package/dist/marks/Brush.svelte.d.ts +20 -15
- package/dist/marks/BrushX.svelte +9 -7
- package/dist/marks/BrushX.svelte.d.ts +5 -2
- package/dist/marks/BrushY.svelte +9 -7
- package/dist/marks/BrushY.svelte.d.ts +5 -2
- package/dist/marks/Cell.svelte +17 -18
- package/dist/marks/Cell.svelte.d.ts +80 -8
- package/dist/marks/CellX.svelte +12 -8
- package/dist/marks/CellX.svelte.d.ts +5 -2
- package/dist/marks/CellY.svelte +12 -8
- package/dist/marks/CellY.svelte.d.ts +5 -2
- package/dist/marks/ColorLegend.svelte +5 -8
- package/dist/marks/ColorLegend.svelte.d.ts +2 -2
- package/dist/marks/CustomMark.svelte +23 -16
- package/dist/marks/CustomMark.svelte.d.ts +17 -14
- package/dist/marks/CustomMarkHTML.svelte +20 -18
- package/dist/marks/CustomMarkHTML.svelte.d.ts +29 -15
- package/dist/marks/DifferenceY.svelte +54 -18
- package/dist/marks/DifferenceY.svelte.d.ts +59 -28
- package/dist/marks/Dot.svelte +13 -14
- package/dist/marks/Dot.svelte.d.ts +84 -12
- package/dist/marks/DotX.svelte +9 -9
- package/dist/marks/DotX.svelte.d.ts +86 -4
- package/dist/marks/DotY.svelte +10 -9
- package/dist/marks/DotY.svelte.d.ts +87 -5
- package/dist/marks/Frame.svelte +20 -27
- package/dist/marks/Frame.svelte.d.ts +24 -10
- package/dist/marks/Geo.svelte +22 -15
- package/dist/marks/Geo.svelte.d.ts +97 -13
- package/dist/marks/Graticule.svelte +16 -19
- package/dist/marks/Graticule.svelte.d.ts +3 -3
- package/dist/marks/GridX.svelte +5 -8
- package/dist/marks/GridX.svelte.d.ts +79 -7
- package/dist/marks/GridY.svelte +5 -8
- package/dist/marks/GridY.svelte.d.ts +79 -7
- package/dist/marks/HTMLTooltip.svelte +9 -14
- package/dist/marks/HTMLTooltip.svelte.d.ts +25 -12
- package/dist/marks/Line.svelte +24 -29
- package/dist/marks/Line.svelte.d.ts +97 -25
- package/dist/marks/LineX.svelte +9 -4
- package/dist/marks/LineX.svelte.d.ts +99 -3
- package/dist/marks/LineY.svelte +11 -5
- package/dist/marks/LineY.svelte.d.ts +100 -4
- package/dist/marks/Link.svelte +35 -19
- package/dist/marks/Link.svelte.d.ts +107 -18
- package/dist/marks/Pointer.svelte +13 -18
- package/dist/marks/Pointer.svelte.d.ts +34 -21
- package/dist/marks/Rect.svelte +19 -19
- package/dist/marks/Rect.svelte.d.ts +86 -13
- package/dist/marks/RectX.svelte +10 -9
- package/dist/marks/RectX.svelte.d.ts +22 -6
- package/dist/marks/RectY.svelte +9 -10
- package/dist/marks/RectY.svelte.d.ts +22 -6
- package/dist/marks/RegressionX.svelte +1 -1
- package/dist/marks/RegressionX.svelte.d.ts +1 -1
- package/dist/marks/RegressionY.svelte +1 -1
- package/dist/marks/RegressionY.svelte.d.ts +1 -1
- package/dist/marks/RuleX.svelte +14 -16
- package/dist/marks/RuleX.svelte.d.ts +84 -12
- package/dist/marks/RuleY.svelte +12 -15
- package/dist/marks/RuleY.svelte.d.ts +84 -12
- package/dist/marks/Sphere.svelte +6 -7
- package/dist/marks/Sphere.svelte.d.ts +3 -2
- package/dist/marks/Spike.svelte +17 -9
- package/dist/marks/Spike.svelte.d.ts +94 -4
- package/dist/marks/SymbolLegend.svelte +1 -1
- package/dist/marks/Text.svelte +34 -124
- package/dist/marks/Text.svelte.d.ts +101 -20
- package/dist/marks/TickX.svelte +12 -13
- package/dist/marks/TickX.svelte.d.ts +92 -20
- package/dist/marks/TickY.svelte +11 -14
- package/dist/marks/TickY.svelte.d.ts +92 -20
- package/dist/marks/Vector.svelte +19 -23
- package/dist/marks/Vector.svelte.d.ts +93 -21
- package/dist/marks/helpers/AreaCanvas.svelte +1 -1
- package/dist/marks/helpers/AreaCanvas.svelte.d.ts +1 -1
- package/dist/marks/helpers/BaseAxisX.svelte +5 -3
- package/dist/marks/helpers/BaseAxisX.svelte.d.ts +1 -1
- package/dist/marks/helpers/BaseAxisY.svelte +10 -8
- package/dist/marks/helpers/BaseAxisY.svelte.d.ts +3 -1
- package/dist/marks/helpers/CanvasLayer.svelte +1 -1
- package/dist/marks/helpers/DotCanvas.svelte +1 -1
- package/dist/marks/helpers/DotCanvas.svelte.d.ts +1 -1
- package/dist/marks/helpers/GeoCanvas.svelte +1 -1
- package/dist/marks/helpers/GeoCanvas.svelte.d.ts +1 -1
- package/dist/marks/helpers/LineCanvas.svelte +1 -1
- package/dist/marks/helpers/LineCanvas.svelte.d.ts +1 -1
- package/dist/marks/helpers/LinearGradientX.svelte +1 -1
- package/dist/marks/helpers/LinearGradientX.svelte.d.ts +1 -1
- package/dist/marks/helpers/LinearGradientY.svelte +1 -1
- package/dist/marks/helpers/LinearGradientY.svelte.d.ts +1 -1
- package/dist/marks/helpers/MarkerPath.svelte +1 -1
- package/dist/marks/helpers/MarkerPath.svelte.d.ts +1 -41
- package/dist/marks/helpers/MultilineText.svelte +158 -0
- package/dist/marks/helpers/MultilineText.svelte.d.ts +12 -0
- package/dist/marks/helpers/RectPath.svelte +29 -26
- package/dist/marks/helpers/RectPath.svelte.d.ts +39 -26
- package/dist/marks/helpers/Regression.svelte +7 -2
- package/dist/marks/helpers/Regression.svelte.d.ts +2 -5
- package/dist/marks/helpers/events.d.ts +1 -1
- package/dist/transforms/bin.d.ts +2 -2
- package/dist/transforms/bollinger.d.ts +2 -67
- package/dist/transforms/centroid.d.ts +8 -66
- package/dist/transforms/centroid.js +10 -7
- package/dist/transforms/filter.d.ts +1 -1
- package/dist/transforms/group.d.ts +5 -13
- package/dist/transforms/interval.d.ts +3 -123
- package/dist/transforms/jitter.d.ts +1 -1
- package/dist/transforms/map.d.ts +4 -184
- package/dist/transforms/normalize.d.ts +3 -123
- package/dist/transforms/recordize.d.ts +1 -1
- package/dist/transforms/rename.d.ts +2 -2
- package/dist/transforms/select.d.ts +8 -428
- package/dist/transforms/shift.d.ts +1 -1
- package/dist/transforms/sort.d.ts +4 -243
- package/dist/transforms/stack.d.ts +1 -1
- package/dist/transforms/window.d.ts +3 -131
- package/dist/types/channel.d.ts +11 -0
- package/dist/types/channel.js +1 -0
- package/dist/types/colorScheme.d.ts +1 -0
- package/dist/types/colorScheme.js +1 -0
- package/dist/types/data.d.ts +13 -0
- package/dist/types/data.js +1 -0
- package/dist/types/facet.d.ts +50 -0
- package/dist/types/facet.js +1 -0
- package/dist/types/index.d.ts +58 -0
- package/dist/types/index.js +7 -0
- package/dist/types/mark.d.ts +123 -0
- package/dist/types/mark.js +1 -0
- package/dist/types/plot.d.ts +459 -0
- package/dist/types/plot.js +1 -0
- package/dist/types/scale.d.ts +143 -0
- package/dist/types/scale.js +1 -0
- package/dist/types.d.ts +120 -127
- package/package.json +125 -120
|
@@ -2,21 +2,22 @@
|
|
|
2
2
|
@component
|
|
3
3
|
For showing custom SVG marks positioned at x/y coordinates
|
|
4
4
|
-->
|
|
5
|
-
<script
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
y?: ChannelAccessor;
|
|
13
|
-
children: Snippet<{ datum: DataRow; x: number; y: number }>;
|
|
14
|
-
};
|
|
15
|
-
</script>
|
|
5
|
+
<script lang="ts" generics="Datum extends DataRecord">
|
|
6
|
+
interface CustomMarkProps extends BaseMarkProps<Datum> {
|
|
7
|
+
data: Datum[];
|
|
8
|
+
x?: ChannelAccessor<Datum>;
|
|
9
|
+
y?: ChannelAccessor<Datum>;
|
|
10
|
+
children: Snippet<[{ datum: Datum; x: number; y: number }]>;
|
|
11
|
+
}
|
|
16
12
|
|
|
17
|
-
<script lang="ts">
|
|
18
13
|
import { getContext } from 'svelte';
|
|
19
|
-
import type {
|
|
14
|
+
import type {
|
|
15
|
+
PlotContext,
|
|
16
|
+
DataRecord,
|
|
17
|
+
ChannelAccessor,
|
|
18
|
+
BaseMarkProps
|
|
19
|
+
} from '../types/index.js';
|
|
20
|
+
import type { Snippet } from 'svelte';
|
|
20
21
|
|
|
21
22
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
22
23
|
let plot = $derived(getPlotState());
|
|
@@ -26,13 +27,19 @@
|
|
|
26
27
|
import { isValid } from '../helpers/index.js';
|
|
27
28
|
import GroupMultiple from './helpers/GroupMultiple.svelte';
|
|
28
29
|
|
|
29
|
-
let {
|
|
30
|
+
let {
|
|
31
|
+
data = [{} as Datum],
|
|
32
|
+
x,
|
|
33
|
+
y,
|
|
34
|
+
children,
|
|
35
|
+
class: className = null
|
|
36
|
+
}: CustomMarkProps = $props();
|
|
30
37
|
</script>
|
|
31
38
|
|
|
32
39
|
<GroupMultiple class="g-custom-mark {className || ''}" length={className ? 2 : data.length}>
|
|
33
40
|
{#each data as datum, i (i)}
|
|
34
|
-
{@const x_ = resolveChannel('x', datum, { x, y })}
|
|
35
|
-
{@const y_ = resolveChannel('y', datum, { x, y })}
|
|
41
|
+
{@const x_ = resolveChannel<Datum>('x', datum, { x, y })}
|
|
42
|
+
{@const y_ = resolveChannel<Datum>('y', datum, { x, y })}
|
|
36
43
|
{#if isValid(x_) && isValid(y_)}
|
|
37
44
|
{@const [px, py] = projectXY(plot.scales, x_, y_)}
|
|
38
45
|
<g transform="translate({px}, {py})">
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
1
|
+
import type { DataRecord } from '../types/index.js';
|
|
2
|
+
declare class __sveltets_Render<Datum extends DataRecord> {
|
|
3
|
+
props(): any;
|
|
4
|
+
events(): {};
|
|
5
|
+
slots(): {};
|
|
6
|
+
bindings(): "";
|
|
7
|
+
exports(): {};
|
|
8
|
+
}
|
|
9
|
+
interface $$IsomorphicComponent {
|
|
10
|
+
new <Datum extends DataRecord>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Datum>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Datum>['props']>, ReturnType<__sveltets_Render<Datum>['events']>, ReturnType<__sveltets_Render<Datum>['slots']>> & {
|
|
11
|
+
$$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
|
|
12
|
+
} & ReturnType<__sveltets_Render<Datum>['exports']>;
|
|
13
|
+
<Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
|
|
14
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
15
|
+
}
|
|
13
16
|
/** For showing custom SVG marks positioned at x/y coordinates */
|
|
14
|
-
declare const CustomMark:
|
|
15
|
-
type CustomMark =
|
|
17
|
+
declare const CustomMark: $$IsomorphicComponent;
|
|
18
|
+
type CustomMark<Datum extends DataRecord> = InstanceType<typeof CustomMark<Datum>>;
|
|
16
19
|
export default CustomMark;
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
@component
|
|
3
3
|
For showing custom HTML tooltips positioned at x/y coordinates
|
|
4
4
|
-->
|
|
5
|
-
<script module lang="ts">
|
|
6
|
-
import type { ChannelAccessor, ConstantAccessor, DataRow } from '../types.js';
|
|
7
|
-
import type { Snippet } from 'svelte';
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
<script lang="ts" generics="Datum extends DataRecord">
|
|
7
|
+
interface CustomMarkHTMLProps {
|
|
8
|
+
data: Datum[];
|
|
9
|
+
x?: ChannelAccessor<Datum>;
|
|
10
|
+
y?: ChannelAccessor<Datum>;
|
|
13
11
|
frameAnchor?: ConstantAccessor<
|
|
14
12
|
| 'bottom'
|
|
15
13
|
| 'top'
|
|
@@ -19,15 +17,19 @@
|
|
|
19
17
|
| 'bottom-left'
|
|
20
18
|
| 'top-right'
|
|
21
19
|
| 'bottom-right'
|
|
22
|
-
| 'center'
|
|
20
|
+
| 'center',
|
|
21
|
+
Datum
|
|
23
22
|
>;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
class: string | null;
|
|
24
|
+
children: Snippet<{ datum: Datum; x: number; y: number }>;
|
|
25
|
+
}
|
|
26
|
+
import { getContext, type Snippet } from 'svelte';
|
|
27
|
+
import type {
|
|
28
|
+
ChannelAccessor,
|
|
29
|
+
ConstantAccessor,
|
|
30
|
+
DataRecord,
|
|
31
|
+
PlotContext
|
|
32
|
+
} from '../types/index.js';
|
|
31
33
|
|
|
32
34
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
33
35
|
const plot = $derived(getPlotState());
|
|
@@ -37,15 +39,15 @@
|
|
|
37
39
|
import { isValid } from '../helpers/index.js';
|
|
38
40
|
|
|
39
41
|
let {
|
|
40
|
-
data = [{}],
|
|
42
|
+
data = [{} as Datum],
|
|
41
43
|
x,
|
|
42
44
|
y,
|
|
43
45
|
frameAnchor,
|
|
44
46
|
children,
|
|
45
47
|
class: className = null
|
|
46
|
-
}:
|
|
48
|
+
}: CustomMarkHTMLProps = $props();
|
|
47
49
|
|
|
48
|
-
function getXY(datum) {
|
|
50
|
+
function getXY(datum: Datum) {
|
|
49
51
|
const fa = frameAnchor || 'center';
|
|
50
52
|
const isLeft = fa.endsWith('left');
|
|
51
53
|
const isRight = fa.endsWith('right');
|
|
@@ -1,17 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { ChannelAccessor, ConstantAccessor, DataRecord } from '../types/index.js';
|
|
3
|
+
declare class __sveltets_Render<Datum extends DataRecord> {
|
|
4
|
+
props(): {
|
|
5
|
+
data: Datum[];
|
|
6
|
+
x?: ChannelAccessor<Datum>;
|
|
7
|
+
y?: ChannelAccessor<Datum>;
|
|
8
|
+
frameAnchor?: ConstantAccessor<"bottom" | "top" | "left" | "right" | "center" | "top-left" | "bottom-left" | "top-right" | "bottom-right", Datum>;
|
|
9
|
+
class: string | null;
|
|
10
|
+
children: Snippet<{
|
|
11
|
+
datum: Datum;
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
16
|
+
events(): {};
|
|
17
|
+
slots(): {};
|
|
18
|
+
bindings(): "";
|
|
19
|
+
exports(): {};
|
|
20
|
+
}
|
|
21
|
+
interface $$IsomorphicComponent {
|
|
22
|
+
new <Datum extends DataRecord>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Datum>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Datum>['props']>, ReturnType<__sveltets_Render<Datum>['events']>, ReturnType<__sveltets_Render<Datum>['slots']>> & {
|
|
23
|
+
$$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
|
|
24
|
+
} & ReturnType<__sveltets_Render<Datum>['exports']>;
|
|
25
|
+
<Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
|
|
26
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
27
|
+
}
|
|
14
28
|
/** For showing custom HTML tooltips positioned at x/y coordinates */
|
|
15
|
-
declare const CustomMarkHtml:
|
|
16
|
-
type CustomMarkHtml =
|
|
29
|
+
declare const CustomMarkHtml: $$IsomorphicComponent;
|
|
30
|
+
type CustomMarkHtml<Datum extends DataRecord> = InstanceType<typeof CustomMarkHtml<Datum>>;
|
|
17
31
|
export default CustomMarkHtml;
|
|
@@ -1,43 +1,59 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
data:
|
|
1
|
+
<script lang="ts" generics="Datum extends DataRecord">
|
|
2
|
+
interface DifferenceYMarkProps extends Omit<BaseMarkProps<Datum>, 'fill' | 'fillOpacity'> {
|
|
3
|
+
data: Datum[];
|
|
4
4
|
/*
|
|
5
5
|
* the horizontal position of the comparison; bound to the x scale
|
|
6
6
|
*/
|
|
7
|
-
x1: ChannelAccessor
|
|
7
|
+
x1: ChannelAccessor<Datum>;
|
|
8
8
|
/**
|
|
9
9
|
* the horizontal position of the metric; bound to the x scale
|
|
10
10
|
*/
|
|
11
|
-
x2: ChannelAccessor
|
|
12
|
-
x: ChannelAccessor
|
|
11
|
+
x2: ChannelAccessor<Datum>;
|
|
12
|
+
x: ChannelAccessor<Datum>;
|
|
13
13
|
/**
|
|
14
14
|
* the vertical position of the comparison; bound to the y scale
|
|
15
15
|
*/
|
|
16
|
-
y1: ChannelAccessor
|
|
16
|
+
y1: ChannelAccessor<Datum>;
|
|
17
17
|
/**
|
|
18
18
|
* the vertical position of the metric; bound to the y scale
|
|
19
19
|
*/
|
|
20
|
-
y2: ChannelAccessor
|
|
21
|
-
y: ChannelAccessor
|
|
20
|
+
y2: ChannelAccessor<Datum>;
|
|
21
|
+
y: ChannelAccessor<Datum>;
|
|
22
22
|
fillOpacity?: number;
|
|
23
|
+
/**
|
|
24
|
+
* the stroke color of the "positive" area; defaults to 'blue'
|
|
25
|
+
*/
|
|
23
26
|
positiveFill?: string;
|
|
27
|
+
/**
|
|
28
|
+
* the fill opacity of the "positive" area; defaults to 1
|
|
29
|
+
*/
|
|
24
30
|
positiveFillOpacity?: number;
|
|
31
|
+
/**
|
|
32
|
+
* the stroke color of the "negative" area; defaults to 'red'
|
|
33
|
+
*/
|
|
25
34
|
negativeFill?: string;
|
|
35
|
+
/**
|
|
36
|
+
* the fill opacity of the "negative" area; defaults to 1
|
|
37
|
+
*/
|
|
26
38
|
negativeFillOpacity?: number;
|
|
39
|
+
/**
|
|
40
|
+
* curve type for the area; defaults to 'linear'
|
|
41
|
+
*/
|
|
27
42
|
curve?: CurveName | CurveFactory;
|
|
43
|
+
/**
|
|
44
|
+
* the tension of the area curve; defaults to 0
|
|
45
|
+
*/
|
|
28
46
|
tension?: number;
|
|
29
|
-
}
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<script lang="ts">
|
|
47
|
+
}
|
|
33
48
|
import type {
|
|
34
49
|
BaseMarkProps,
|
|
35
50
|
ChannelAccessor,
|
|
36
51
|
CurveName,
|
|
37
52
|
DataRecord,
|
|
38
|
-
PlotContext
|
|
39
|
-
|
|
40
|
-
|
|
53
|
+
PlotContext,
|
|
54
|
+
PlotDefaults
|
|
55
|
+
} from '../types/index.js';
|
|
56
|
+
import { Line, Area } from './';
|
|
41
57
|
import { randomId, coalesce } from '../helpers/index.js';
|
|
42
58
|
import { getContext } from 'svelte';
|
|
43
59
|
import { extent, max, min } from 'd3-array';
|
|
@@ -47,8 +63,28 @@
|
|
|
47
63
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
48
64
|
let plot = $derived(getPlotState());
|
|
49
65
|
|
|
50
|
-
let
|
|
51
|
-
|
|
66
|
+
let markProps: DifferenceYMarkProps = $props();
|
|
67
|
+
|
|
68
|
+
const DEFAULTS = {
|
|
69
|
+
positiveFill: 'red',
|
|
70
|
+
positiveFillOpacity: 1,
|
|
71
|
+
negativeFill: 'blue',
|
|
72
|
+
negativeFillOpacity: 1,
|
|
73
|
+
curve: 'linear' as CurveName,
|
|
74
|
+
tension: 0,
|
|
75
|
+
...getContext<PlotDefaults>('svelteplot/_defaults').differenceY
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const {
|
|
79
|
+
data,
|
|
80
|
+
stroke,
|
|
81
|
+
class: className = null,
|
|
82
|
+
...options
|
|
83
|
+
}: DifferenceYMarkProps = $derived({
|
|
84
|
+
...DEFAULTS,
|
|
85
|
+
...markProps
|
|
86
|
+
});
|
|
87
|
+
const { x, x1, x2, y, y1, y2 } = $derived(options);
|
|
52
88
|
|
|
53
89
|
const x1x2Differ = $derived((x1 == null || x2 == null) && x1 !== x2);
|
|
54
90
|
|
|
@@ -1,30 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
data: DataRecord[];
|
|
3
|
-
x1: ChannelAccessor;
|
|
4
|
-
/**
|
|
5
|
-
* the horizontal position of the metric; bound to the x scale
|
|
6
|
-
*/
|
|
7
|
-
x2: ChannelAccessor;
|
|
8
|
-
x: ChannelAccessor;
|
|
9
|
-
/**
|
|
10
|
-
* the vertical position of the comparison; bound to the y scale
|
|
11
|
-
*/
|
|
12
|
-
y1: ChannelAccessor;
|
|
13
|
-
/**
|
|
14
|
-
* the vertical position of the metric; bound to the y scale
|
|
15
|
-
*/
|
|
16
|
-
y2: ChannelAccessor;
|
|
17
|
-
y: ChannelAccessor;
|
|
18
|
-
fillOpacity?: number;
|
|
19
|
-
positiveFill?: string;
|
|
20
|
-
positiveFillOpacity?: number;
|
|
21
|
-
negativeFill?: string;
|
|
22
|
-
negativeFillOpacity?: number;
|
|
23
|
-
curve?: CurveName | CurveFactory;
|
|
24
|
-
tension?: number;
|
|
25
|
-
};
|
|
26
|
-
import type { BaseMarkProps, ChannelAccessor, CurveName, DataRecord } from '../types.js';
|
|
1
|
+
import type { ChannelAccessor, CurveName, DataRecord } from '../types/index.js';
|
|
27
2
|
import type { CurveFactory } from 'd3-shape';
|
|
28
|
-
declare
|
|
29
|
-
|
|
3
|
+
declare class __sveltets_Render<Datum extends DataRecord> {
|
|
4
|
+
props(): Omit<BaseMarkProps<Datum_1>, "fill" | "fillOpacity"> & {
|
|
5
|
+
data: Datum[];
|
|
6
|
+
x1: ChannelAccessor<Datum_1>;
|
|
7
|
+
/**
|
|
8
|
+
* the horizontal position of the metric; bound to the x scale
|
|
9
|
+
*/
|
|
10
|
+
x2: ChannelAccessor<Datum_1>;
|
|
11
|
+
x: ChannelAccessor<Datum_1>;
|
|
12
|
+
/**
|
|
13
|
+
* the vertical position of the comparison; bound to the y scale
|
|
14
|
+
*/
|
|
15
|
+
y1: ChannelAccessor<Datum_1>;
|
|
16
|
+
/**
|
|
17
|
+
* the vertical position of the metric; bound to the y scale
|
|
18
|
+
*/
|
|
19
|
+
y2: ChannelAccessor<Datum_1>;
|
|
20
|
+
y: ChannelAccessor<Datum_1>;
|
|
21
|
+
fillOpacity?: number;
|
|
22
|
+
/**
|
|
23
|
+
* the stroke color of the "positive" area; defaults to 'blue'
|
|
24
|
+
*/
|
|
25
|
+
positiveFill?: string;
|
|
26
|
+
/**
|
|
27
|
+
* the fill opacity of the "positive" area; defaults to 1
|
|
28
|
+
*/
|
|
29
|
+
positiveFillOpacity?: number;
|
|
30
|
+
/**
|
|
31
|
+
* the stroke color of the "negative" area; defaults to 'red'
|
|
32
|
+
*/
|
|
33
|
+
negativeFill?: string;
|
|
34
|
+
/**
|
|
35
|
+
* the fill opacity of the "negative" area; defaults to 1
|
|
36
|
+
*/
|
|
37
|
+
negativeFillOpacity?: number;
|
|
38
|
+
/**
|
|
39
|
+
* curve type for the area; defaults to 'linear'
|
|
40
|
+
*/
|
|
41
|
+
curve?: CurveName | CurveFactory;
|
|
42
|
+
/**
|
|
43
|
+
* the tension of the area curve; defaults to 0
|
|
44
|
+
*/
|
|
45
|
+
tension?: number;
|
|
46
|
+
};
|
|
47
|
+
events(): {};
|
|
48
|
+
slots(): {};
|
|
49
|
+
bindings(): "";
|
|
50
|
+
exports(): {};
|
|
51
|
+
}
|
|
52
|
+
interface $$IsomorphicComponent {
|
|
53
|
+
new <Datum extends DataRecord>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Datum>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Datum>['props']>, ReturnType<__sveltets_Render<Datum>['events']>, ReturnType<__sveltets_Render<Datum>['slots']>> & {
|
|
54
|
+
$$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
|
|
55
|
+
} & ReturnType<__sveltets_Render<Datum>['exports']>;
|
|
56
|
+
<Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
|
|
57
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
58
|
+
}
|
|
59
|
+
declare const DifferenceY: $$IsomorphicComponent;
|
|
60
|
+
type DifferenceY<Datum extends DataRecord> = InstanceType<typeof DifferenceY<Datum>>;
|
|
30
61
|
export default DifferenceY;
|
package/dist/marks/Dot.svelte
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
<!-- @component
|
|
2
2
|
Creates dots or symbols at specified positions with customizable size and appearance
|
|
3
3
|
-->
|
|
4
|
-
<script
|
|
5
|
-
|
|
6
|
-
data:
|
|
7
|
-
x: ChannelAccessor
|
|
8
|
-
y: ChannelAccessor
|
|
9
|
-
r?: ChannelAccessor
|
|
10
|
-
symbol?: ChannelAccessor | Snippet<[number, string]>;
|
|
4
|
+
<script lang="ts" generics="Datum extends DataRecord">
|
|
5
|
+
interface DotMarkProps extends BaseMarkProps<Datum>, LinkableMarkProps<Datum> {
|
|
6
|
+
data: Datum[];
|
|
7
|
+
x: ChannelAccessor<Datum>;
|
|
8
|
+
y: ChannelAccessor<Datum>;
|
|
9
|
+
r?: ChannelAccessor<Datum>;
|
|
10
|
+
symbol?: ChannelAccessor<Datum> | Snippet<[number, string]>;
|
|
11
11
|
canvas?: boolean;
|
|
12
|
-
dotClass?: ConstantAccessor<string>;
|
|
13
|
-
}
|
|
14
|
-
</script>
|
|
12
|
+
dotClass?: ConstantAccessor<string, Datum>;
|
|
13
|
+
}
|
|
15
14
|
|
|
16
|
-
<script lang="ts">
|
|
17
15
|
import { getContext, type Snippet } from 'svelte';
|
|
18
16
|
import type {
|
|
19
17
|
PlotContext,
|
|
@@ -23,17 +21,18 @@
|
|
|
23
21
|
ChannelAccessor,
|
|
24
22
|
PlotDefaults,
|
|
25
23
|
LinkableMarkProps
|
|
26
|
-
} from '../types.js';
|
|
24
|
+
} from '../types/index.js';
|
|
27
25
|
import { resolveProp, resolveStyles } from '../helpers/resolve.js';
|
|
28
26
|
import { maybeSymbol } from '../helpers/symbols.js';
|
|
29
27
|
import { symbol as d3Symbol } from 'd3-shape';
|
|
30
|
-
import { sort } from '
|
|
28
|
+
import { sort } from '..';
|
|
31
29
|
import Mark from '../Mark.svelte';
|
|
32
30
|
import DotCanvas from './helpers/DotCanvas.svelte';
|
|
33
31
|
import { maybeData, isValid } from '../helpers/index.js';
|
|
34
32
|
import { recordizeXY } from '../transforms/recordize.js';
|
|
35
33
|
import { addEventHandlers } from './helpers/events.js';
|
|
36
34
|
import Anchor from './helpers/Anchor.svelte';
|
|
35
|
+
import type { D } from 'vitest/dist/chunks/reporters.d.DL9pg5DB.js';
|
|
37
36
|
|
|
38
37
|
const DEFAULTS = {
|
|
39
38
|
...getContext<PlotDefaults>('svelteplot/_defaults').dot
|
|
@@ -42,7 +41,7 @@
|
|
|
42
41
|
let markProps: DotMarkProps = $props();
|
|
43
42
|
|
|
44
43
|
const {
|
|
45
|
-
data = [{}],
|
|
44
|
+
data = [{} as Datum],
|
|
46
45
|
canvas = false,
|
|
47
46
|
class: className = '',
|
|
48
47
|
dotClass = null,
|
|
@@ -1,15 +1,87 @@
|
|
|
1
|
-
export type DotMarkProps = BaseMarkProps & {
|
|
2
|
-
data: DataRecord[];
|
|
3
|
-
x: ChannelAccessor;
|
|
4
|
-
y: ChannelAccessor;
|
|
5
|
-
r?: ChannelAccessor;
|
|
6
|
-
symbol?: ChannelAccessor | Snippet<[number, string]>;
|
|
7
|
-
canvas?: boolean;
|
|
8
|
-
dotClass?: ConstantAccessor<string>;
|
|
9
|
-
} & LinkableMarkProps;
|
|
10
1
|
import { type Snippet } from 'svelte';
|
|
11
|
-
import type { DataRecord,
|
|
2
|
+
import type { DataRecord, ConstantAccessor, ChannelAccessor, LinkableMarkProps } from '../types/index.js';
|
|
3
|
+
declare class __sveltets_Render<Datum extends DataRecord> {
|
|
4
|
+
props(): Partial<{
|
|
5
|
+
filter?: ConstantAccessor<boolean, Datum>;
|
|
6
|
+
facet?: "auto" | "include" | "exclude";
|
|
7
|
+
fx: ChannelAccessor<Datum>;
|
|
8
|
+
fy: ChannelAccessor<Datum>;
|
|
9
|
+
dx: ConstantAccessor<number, Datum>;
|
|
10
|
+
dy: ConstantAccessor<number, Datum>;
|
|
11
|
+
fill: ChannelAccessor<Datum>;
|
|
12
|
+
fillOpacity: ConstantAccessor<number, Datum>;
|
|
13
|
+
sort: {
|
|
14
|
+
channel: string;
|
|
15
|
+
order?: "ascending" | "descending";
|
|
16
|
+
} | ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | ConstantAccessor<import("../types/data.js").RawValue, Datum>;
|
|
17
|
+
stroke: ChannelAccessor<Datum>;
|
|
18
|
+
strokeWidth: ConstantAccessor<number, Datum>;
|
|
19
|
+
strokeOpacity: ConstantAccessor<number, Datum>;
|
|
20
|
+
strokeLinejoin: ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
|
|
21
|
+
strokeLinecap: ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
|
|
22
|
+
strokeMiterlimit: ConstantAccessor<number, Datum>;
|
|
23
|
+
opacity: ChannelAccessor<Datum>;
|
|
24
|
+
strokeDasharray: ConstantAccessor<string, Datum>;
|
|
25
|
+
strokeDashoffset: ConstantAccessor<number, Datum>;
|
|
26
|
+
mixBlendMode: ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
|
|
27
|
+
clipPath: string;
|
|
28
|
+
imageFilter: ConstantAccessor<string, Datum>;
|
|
29
|
+
shapeRendering: ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
|
|
30
|
+
paintOrder: ConstantAccessor<string, Datum>;
|
|
31
|
+
onclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
32
|
+
ondblclick?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
33
|
+
onmouseup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
34
|
+
onmousedown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
35
|
+
onmouseenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
36
|
+
onmousemove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
37
|
+
onmouseleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
38
|
+
onmouseout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
39
|
+
onmouseover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
40
|
+
onpointercancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
41
|
+
onpointerdown?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
42
|
+
onpointerup?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
43
|
+
onpointerenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
44
|
+
onpointerleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
45
|
+
onpointermove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
46
|
+
onpointerover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
47
|
+
onpointerout?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
48
|
+
ondrag?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
49
|
+
ondrop?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
50
|
+
ondragstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
51
|
+
ondragenter?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
52
|
+
ondragleave?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
53
|
+
ondragover?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
54
|
+
ondragend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
55
|
+
ontouchstart?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
56
|
+
ontouchmove?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
57
|
+
ontouchend?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
58
|
+
ontouchcancel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
59
|
+
oncontextmenu?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
60
|
+
onwheel?: import("svelte/elements.js").MouseEventHandler<SVGPathElement>;
|
|
61
|
+
class: string | null;
|
|
62
|
+
cursor: ConstantAccessor<import("csstype").Property.Cursor, Datum>;
|
|
63
|
+
}> & LinkableMarkProps<Datum> & {
|
|
64
|
+
data: Datum[];
|
|
65
|
+
x: ChannelAccessor<Datum>;
|
|
66
|
+
y: ChannelAccessor<Datum>;
|
|
67
|
+
r?: ChannelAccessor<Datum>;
|
|
68
|
+
symbol?: Snippet<[number, string]> | ChannelAccessor<Datum>;
|
|
69
|
+
canvas?: boolean;
|
|
70
|
+
dotClass?: ConstantAccessor<string, Datum>;
|
|
71
|
+
};
|
|
72
|
+
events(): {};
|
|
73
|
+
slots(): {};
|
|
74
|
+
bindings(): "";
|
|
75
|
+
exports(): {};
|
|
76
|
+
}
|
|
77
|
+
interface $$IsomorphicComponent {
|
|
78
|
+
new <Datum extends DataRecord>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Datum>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Datum>['props']>, ReturnType<__sveltets_Render<Datum>['events']>, ReturnType<__sveltets_Render<Datum>['slots']>> & {
|
|
79
|
+
$$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
|
|
80
|
+
} & ReturnType<__sveltets_Render<Datum>['exports']>;
|
|
81
|
+
<Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
|
|
82
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
83
|
+
}
|
|
12
84
|
/** Creates dots or symbols at specified positions with customizable size and appearance */
|
|
13
|
-
declare const Dot:
|
|
14
|
-
type Dot =
|
|
85
|
+
declare const Dot: $$IsomorphicComponent;
|
|
86
|
+
type Dot<Datum extends DataRecord> = InstanceType<typeof Dot<Datum>>;
|
|
15
87
|
export default Dot;
|
package/dist/marks/DotX.svelte
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<!-- @component
|
|
2
2
|
Creates a horizontal dot plot with x values along a single y position
|
|
3
3
|
-->
|
|
4
|
-
<script
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import type {
|
|
4
|
+
<script lang="ts" generics="Datum extends DataRow">
|
|
5
|
+
interface DotXMarkProps extends Omit<ComponentProps<typeof Dot>, 'y' | 'data'> {
|
|
6
|
+
data: Datum[];
|
|
7
|
+
}
|
|
8
|
+
import Dot from './Dot.svelte';
|
|
9
|
+
import { recordizeX } from '..';
|
|
10
|
+
import type { DataRow } from '../types/index.js';
|
|
11
|
+
import type { ComponentProps } from 'svelte';
|
|
12
12
|
|
|
13
|
-
let { data = [{}], ...options }: DotXMarkProps = $props();
|
|
13
|
+
let { data = [{} as Datum], ...options }: DotXMarkProps = $props();
|
|
14
14
|
|
|
15
15
|
const args = $derived(recordizeX({ data, ...options, y: 1 }, { withIndex: false }));
|
|
16
16
|
</script>
|