@fundar/data-chart-telling 0.0.25 → 0.0.26
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/charts/bar/Chart.svelte +2 -0
- package/dist/charts/heatmap/Chart.svelte +3 -1
- package/dist/charts/heatmap/Chart.svelte.d.ts +1 -2
- package/dist/charts/line/Chart.svelte +2 -0
- package/dist/charts/pyramid/Chart.svelte +3 -1
- package/dist/charts/pyramid/Chart.svelte.d.ts +1 -2
- package/dist/charts/scatter/Chart.svelte +95 -0
- package/dist/charts/scatter/Chart.svelte.d.ts +28 -0
- package/dist/configuration/config.svelte.js +2 -0
- package/dist/configuration/themes/index.d.ts +48 -0
- package/dist/index.d.ts +20 -14
- package/dist/index.js +9 -3
- package/dist/layout/coordinates/CoordinatesLayout.svelte +95 -0
- package/dist/layout/{plot/RuleLayout.svelte.d.ts → coordinates/CoordinatesLayout.svelte.d.ts} +13 -16
- package/dist/layout/coordinates/margins.d.ts +16 -0
- package/dist/layout/coordinates/margins.js +11 -0
- package/dist/{plots/geo → layout/coordinates}/projections/argentina.d.ts +1 -1
- package/dist/layout/{geo → coordinates}/resolveProjection.d.ts +1 -1
- package/dist/layout/coordinates/resolveProjection.js +24 -0
- package/dist/{plots/geo → layout/coordinates}/zoom.svelte.d.ts +1 -1
- package/dist/layout/geometry/GeometryLayout.svelte +231 -0
- package/dist/layout/geometry/GeometryLayout.svelte.d.ts +62 -0
- package/dist/layout/plot/BasePlotLayout.svelte +142 -155
- package/dist/layout/plot/BasePlotLayout.svelte.d.ts +61 -51
- package/dist/layout/plot/margins.d.ts +0 -16
- package/dist/layout/plot/margins.js +0 -11
- package/dist/layout/{plot/AxisLayout.svelte → scales/ScalesLayout.svelte} +23 -16
- package/dist/layout/{plot/AxisLayout.svelte.d.ts → scales/ScalesLayout.svelte.d.ts} +4 -5
- package/dist/layout/scales/buildScale.d.ts +8 -0
- package/dist/layout/scales/buildScale.js +43 -0
- package/dist/layout/styles/StylesLayout.svelte +75 -0
- package/dist/layout/styles/StylesLayout.svelte.d.ts +15 -0
- package/dist/{plots/geo → layout/styles}/TileLayer.svelte +2 -2
- package/dist/{plots/geo → layout/styles}/TileLayer.svelte.d.ts +1 -1
- package/dist/layout/tooltip/Tooltip.svelte +16 -20
- package/dist/layout/tooltip/Tooltip.svelte.d.ts +5 -0
- package/dist/layout/tooltip/TooltipLayout.svelte +7 -1
- package/dist/layout/tooltip/TooltipLayout.svelte.d.ts +4 -0
- package/dist/layout/tooltip/controller.svelte.d.ts +4 -5
- package/dist/layout/tooltip/controller.svelte.js +28 -16
- package/dist/layout/tooltip/resolveTooltipPlacement.d.ts +24 -0
- package/dist/layout/tooltip/resolveTooltipPlacement.js +49 -0
- package/dist/layout/tooltip/utils.d.ts +27 -19
- package/dist/layout/tooltip/utils.js +16 -15
- package/dist/markers/BarMarker.svelte +92 -0
- package/dist/markers/BarMarker.svelte.d.ts +7 -0
- package/dist/markers/CellMarker.svelte +21 -0
- package/dist/markers/CellMarker.svelte.d.ts +7 -0
- package/dist/markers/ContourMarker.svelte +28 -0
- package/dist/markers/ContourMarker.svelte.d.ts +7 -0
- package/dist/markers/DeltaMarker.svelte +32 -39
- package/dist/markers/DeltaMarker.svelte.d.ts +4 -5
- package/dist/markers/DotMarker.svelte +35 -6
- package/dist/markers/DotMarker.svelte.d.ts +11 -2
- package/dist/markers/GeoFeaturesMarker.svelte +19 -0
- package/dist/markers/GeoFeaturesMarker.svelte.d.ts +7 -0
- package/dist/markers/GeoHoverMarker.svelte +25 -0
- package/dist/markers/GeoHoverMarker.svelte.d.ts +9 -0
- package/dist/markers/GraticuleMarker.svelte +18 -0
- package/dist/markers/GraticuleMarker.svelte.d.ts +7 -0
- package/dist/markers/HoverMarker.svelte +32 -33
- package/dist/markers/HoverMarker.svelte.d.ts +15 -9
- package/dist/markers/LineMarker.svelte +19 -0
- package/dist/markers/LineMarker.svelte.d.ts +7 -0
- package/dist/markers/LinkMarker.svelte +42 -0
- package/dist/markers/LinkMarker.svelte.d.ts +7 -0
- package/dist/markers/RuleMarker.svelte +24 -0
- package/dist/markers/RuleMarker.svelte.d.ts +10 -0
- package/dist/markers/SphereMarker.svelte +15 -0
- package/dist/markers/SphereMarker.svelte.d.ts +7 -0
- package/dist/markers/TextMarker.svelte +1 -1
- package/dist/markers/TextMarker.svelte.d.ts +1 -1
- package/dist/markers/VectorMarker.svelte +20 -0
- package/dist/markers/VectorMarker.svelte.d.ts +7 -0
- package/dist/markers/inset/InsetMarker.svelte +38 -45
- package/dist/markers/inset/InsetMarker.svelte.d.ts +6 -2
- package/dist/plots/bar/Plot.svelte +54 -84
- package/dist/plots/bar/Plot.svelte.d.ts +4 -5
- package/dist/plots/bar/ValueLabels.svelte +1 -1
- package/dist/plots/bar/ValueLabels.svelte.d.ts +1 -1
- package/dist/plots/bar/buildBarMarkers.d.ts +30 -0
- package/dist/plots/bar/buildBarMarkers.js +100 -0
- package/dist/plots/bar/layout.svelte.d.ts +1 -2
- package/dist/plots/bar/layout.svelte.js +1 -1
- package/dist/plots/geo/Plot.svelte +113 -387
- package/dist/plots/geo/Plot.svelte.d.ts +5 -4
- package/dist/plots/geo/buildGeoMarkers.d.ts +33 -0
- package/dist/plots/geo/buildGeoMarkers.js +47 -0
- package/dist/plots/heatmap/Plot.svelte +24 -49
- package/dist/plots/heatmap/Plot.svelte.d.ts +4 -5
- package/dist/plots/heatmap/ValueLabels.svelte +2 -2
- package/dist/plots/heatmap/ValueLabels.svelte.d.ts +2 -2
- package/dist/plots/heatmap/buildCellMarkers.d.ts +21 -0
- package/dist/plots/heatmap/buildCellMarkers.js +25 -0
- package/dist/plots/line/Plot.svelte +68 -141
- package/dist/plots/line/Plot.svelte.d.ts +4 -4
- package/dist/plots/line/ValueLabels.svelte +29 -52
- package/dist/plots/line/ValueLabels.svelte.d.ts +6 -1
- package/dist/plots/line/buildLineMarkers.d.ts +15 -0
- package/dist/plots/line/buildLineMarkers.js +57 -0
- package/dist/plots/pyramid/Plot.svelte +41 -117
- package/dist/plots/pyramid/Plot.svelte.d.ts +4 -5
- package/dist/plots/pyramid/ValueLabels.svelte +1 -1
- package/dist/plots/pyramid/ValueLabels.svelte.d.ts +1 -1
- package/dist/plots/pyramid/buildPyramidBarMarkers.d.ts +19 -0
- package/dist/plots/pyramid/buildPyramidBarMarkers.js +32 -0
- package/dist/plots/scatter/Plot.svelte +206 -0
- package/dist/plots/{bar/BarSegments.svelte.d.ts → scatter/Plot.svelte.d.ts} +9 -20
- package/dist/plots/scatter/ValueLabels.svelte +106 -0
- package/dist/{layout/plot/GridLayout.svelte.d.ts → plots/scatter/ValueLabels.svelte.d.ts} +11 -5
- package/dist/plots/scatter/buildScatterMarkers.d.ts +11 -0
- package/dist/plots/scatter/buildScatterMarkers.js +37 -0
- package/dist/plots/scatter/resolveRadiusPaddedDomain.d.ts +10 -0
- package/dist/plots/scatter/resolveRadiusPaddedDomain.js +23 -0
- package/dist/plots/utils/declutter.d.ts +55 -37
- package/dist/plots/utils/declutter.js +79 -64
- package/dist/plots/utils/geoAccessors.d.ts +1 -1
- package/dist/plots/utils/geoAccessors.js +1 -1
- package/dist/plots/utils/segments.d.ts +17 -10
- package/dist/plots/utils/segments.js +26 -16
- package/dist/types/charts/common.d.ts +1 -1
- package/dist/types/charts/props.d.ts +5 -6
- package/dist/types/configuration/styling.d.ts +7 -2
- package/dist/types/{plots/scales/geo.d.ts → layout/coordinates.d.ts} +33 -1
- package/dist/types/layout/geometry.d.ts +17 -0
- package/dist/types/{plots/axis.d.ts → layout/scales.d.ts} +11 -0
- package/dist/types/layout/styles.d.ts +126 -0
- package/dist/types/layout/tooltip.d.ts +20 -1
- package/dist/types/markers/all.d.ts +11 -0
- package/dist/types/markers/base.d.ts +45 -0
- package/dist/types/markers/base.js +1 -0
- package/dist/types/markers/common.d.ts +64 -16
- package/dist/types/markers/geo.d.ts +75 -100
- package/dist/types/markers/line.d.ts +34 -0
- package/dist/types/markers/line.js +1 -0
- package/dist/types/markers/props.d.ts +1 -1
- package/dist/types/plots/data/common.d.ts +1 -1
- package/dist/types/plots/data/scatter.d.ts +13 -0
- package/dist/types/plots/data/scatter.js +1 -0
- package/dist/types/plots/props.d.ts +46 -74
- package/dist/types/plots/segments/common.d.ts +6 -12
- package/dist/types/plots/segments/config.d.ts +1 -1
- package/dist/types/plots/styling.d.ts +10 -0
- package/dist/{plots/utils → utils}/delta.d.ts +2 -2
- package/dist/{plots/utils → utils}/delta.js +1 -1
- package/dist/utils/edgeAwareAnchor.d.ts +37 -0
- package/dist/utils/edgeAwareAnchor.js +65 -0
- package/dist/utils/grouping.d.ts +1 -1
- package/dist/utils/interpolate.d.ts +1 -1
- package/package.json +3 -1
- package/dist/layout/geo/GeoLayout.svelte +0 -51
- package/dist/layout/geo/GeoLayout.svelte.d.ts +0 -24
- package/dist/layout/geo/resolveProjection.js +0 -48
- package/dist/layout/plot/GridLayout.svelte +0 -30
- package/dist/layout/plot/RuleLayout.svelte +0 -111
- package/dist/plots/bar/BarSegments.svelte +0 -69
- package/dist/types/plots/delta.d.ts +0 -19
- package/dist/types/plots/styles/common.d.ts +0 -52
- package/dist/types/plots/styles/geo.d.ts +0 -42
- /package/dist/{plots/geo → layout/coordinates}/projections/argentina.js +0 -0
- /package/dist/{plots/geo → layout/coordinates}/projections/fit.d.ts +0 -0
- /package/dist/{plots/geo → layout/coordinates}/projections/fit.js +0 -0
- /package/dist/{plots/geo → layout/coordinates}/rotate.svelte.d.ts +0 -0
- /package/dist/{plots/geo → layout/coordinates}/rotate.svelte.js +0 -0
- /package/dist/{plots/geo → layout/coordinates}/zoom.svelte.js +0 -0
- /package/dist/types/{plots/axis.js → layout/coordinates.js} +0 -0
- /package/dist/types/{plots/delta.js → layout/geometry.js} +0 -0
- /package/dist/types/{plots/scales/geo.js → layout/scales.js} +0 -0
- /package/dist/types/{plots/styles/common.js → layout/styles.js} +0 -0
- /package/dist/types/{plots/styles/geo.js → markers/all.js} +0 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
} from '../../layout/tooltip/utils';
|
|
10
10
|
import { resolveAccessor } from '../../plots/utils/accessors';
|
|
11
11
|
import type { Accessor } from '../../types/plots/data/common';
|
|
12
|
-
import type { AxisBasedScalesConfig } from '../../types/
|
|
12
|
+
import type { AxisBasedScalesConfig } from '../../types/layout/scales';
|
|
13
13
|
import type { CellSegmentStyle } from '../../types/plots/segments/common';
|
|
14
14
|
import type { ChartProps } from '../../types/charts/props';
|
|
15
15
|
|
|
@@ -105,6 +105,8 @@
|
|
|
105
105
|
sync: tip.sync,
|
|
106
106
|
series: tip.series,
|
|
107
107
|
content: tip.content,
|
|
108
|
+
anchorX: tip.anchorX,
|
|
109
|
+
anchorY: tip.anchorY,
|
|
108
110
|
}
|
|
109
111
|
: undefined}
|
|
110
112
|
/>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Accessor } from '../../types/plots/data/common';
|
|
2
|
-
import type { CellSegmentStyle } from '../../types/plots/segments/common';
|
|
3
2
|
import type { ChartProps } from '../../types/charts/props';
|
|
4
3
|
declare function $$render<TRow extends Record<string, unknown>>(): {
|
|
5
|
-
props: ChartProps<TRow,
|
|
4
|
+
props: ChartProps<TRow, import("../..").AreaStyle> & {
|
|
6
5
|
z: Accessor<TRow, number>;
|
|
7
6
|
};
|
|
8
7
|
exports: {};
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
} from '../../layout/tooltip/utils';
|
|
10
10
|
import { resolveAccessor } from '../../plots/utils/accessors';
|
|
11
11
|
import { resolveTimelineInterpolation } from '../../utils/interpolate';
|
|
12
|
-
import type { AxisValue } from '../../types/
|
|
12
|
+
import type { AxisValue } from '../../types/layout/scales';
|
|
13
13
|
import type { Accessor } from '../../types/plots/data/common';
|
|
14
14
|
import type { BarSegmentStyle } from '../../types/plots/segments/common';
|
|
15
15
|
import type { ChartProps } from '../../types/charts/props';
|
|
@@ -125,6 +125,8 @@
|
|
|
125
125
|
sync: tip.sync,
|
|
126
126
|
series: tip.series,
|
|
127
127
|
content: tip.content,
|
|
128
|
+
anchorX: tip.anchorX,
|
|
129
|
+
anchorY: tip.anchorY,
|
|
128
130
|
}
|
|
129
131
|
: undefined}
|
|
130
132
|
/>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Accessor } from '../../types/plots/data/common';
|
|
2
|
-
import type { BarSegmentStyle } from '../../types/plots/segments/common';
|
|
3
2
|
import type { ChartProps } from '../../types/charts/props';
|
|
4
3
|
declare function $$render<TRow extends Record<string, unknown>>(): {
|
|
5
|
-
props: ChartProps<TRow,
|
|
4
|
+
props: ChartProps<TRow, import("../..").AreaStyle> & {
|
|
6
5
|
x: Accessor<TRow, number>;
|
|
7
6
|
z: Accessor<TRow, unknown>;
|
|
8
7
|
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script lang="ts" generics="TRow extends Record<string, unknown>">
|
|
2
|
+
import BaseChart from '../BaseChart.svelte';
|
|
3
|
+
import ScatterPlot from '../../plots/scatter/Plot.svelte';
|
|
4
|
+
import {
|
|
5
|
+
resolveTooltip,
|
|
6
|
+
resolveHoverStrategy,
|
|
7
|
+
resolveHoverSync,
|
|
8
|
+
hasHoverMarker
|
|
9
|
+
} from '../../layout/tooltip/utils';
|
|
10
|
+
import { resolveAccessor } from '../../plots/utils/accessors';
|
|
11
|
+
import type { Accessor } from '../../types/plots/data/common';
|
|
12
|
+
import type { ScatterSegmentStyle } from '../../types/plots/segments/common';
|
|
13
|
+
import type { ChartProps } from '../../types/charts/props';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* High-level scatter chart. Groups flat rows by `z` into one point cloud
|
|
17
|
+
* per group and delegates all chrome to {@link BaseChart}. `r` gives every
|
|
18
|
+
* point a per-row radius (bubble sizing), independent of `z` grouping.
|
|
19
|
+
*/
|
|
20
|
+
let {
|
|
21
|
+
width,
|
|
22
|
+
height,
|
|
23
|
+
title,
|
|
24
|
+
subtitle,
|
|
25
|
+
caption,
|
|
26
|
+
legend,
|
|
27
|
+
header,
|
|
28
|
+
footer,
|
|
29
|
+
data,
|
|
30
|
+
x,
|
|
31
|
+
y,
|
|
32
|
+
z,
|
|
33
|
+
r,
|
|
34
|
+
styles = {},
|
|
35
|
+
segments,
|
|
36
|
+
markers = [],
|
|
37
|
+
scales = {},
|
|
38
|
+
margins,
|
|
39
|
+
facet,
|
|
40
|
+
timeline,
|
|
41
|
+
tooltip,
|
|
42
|
+
}: ChartProps<TRow, ScatterSegmentStyle> & { r?: Accessor<TRow, number> | number } = $props();
|
|
43
|
+
|
|
44
|
+
const tip = $derived(resolveTooltip(tooltip, 'punctual'));
|
|
45
|
+
const hoverEnabled = $derived(tip.enabled || hasHoverMarker(markers));
|
|
46
|
+
const resolvedStrategy = $derived(resolveHoverStrategy(tip.enabled ? tip.strategy : undefined, markers, 'punctual'));
|
|
47
|
+
const resolvedSync = $derived(resolveHoverSync(tip.enabled ? tip.sync : undefined, markers));
|
|
48
|
+
const getX = $derived(resolveAccessor<TRow>(x));
|
|
49
|
+
const getY = $derived(resolveAccessor<TRow>(y));
|
|
50
|
+
const defaultFormat = $derived((row: TRow) => `${String(getX(row))}, ${String(getY(row))}`);
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<BaseChart
|
|
54
|
+
{width}
|
|
55
|
+
{height}
|
|
56
|
+
{title}
|
|
57
|
+
{subtitle}
|
|
58
|
+
{caption}
|
|
59
|
+
{legend}
|
|
60
|
+
{header}
|
|
61
|
+
{footer}
|
|
62
|
+
{data}
|
|
63
|
+
{facet}
|
|
64
|
+
{timeline}
|
|
65
|
+
hover={hoverEnabled ? { strategy: resolvedStrategy, sync: resolvedSync } : undefined}
|
|
66
|
+
>
|
|
67
|
+
{#snippet plot({ data: rows, width: w, height: h, facetValue })}
|
|
68
|
+
<ScatterPlot
|
|
69
|
+
width={w}
|
|
70
|
+
height={h}
|
|
71
|
+
data={rows}
|
|
72
|
+
{x}
|
|
73
|
+
{y}
|
|
74
|
+
{z}
|
|
75
|
+
{r}
|
|
76
|
+
{styles}
|
|
77
|
+
{segments}
|
|
78
|
+
{markers}
|
|
79
|
+
{scales}
|
|
80
|
+
{margins}
|
|
81
|
+
tooltip={tip.enabled
|
|
82
|
+
? {
|
|
83
|
+
format: tip.format ?? defaultFormat,
|
|
84
|
+
facetId: facetValue ?? '',
|
|
85
|
+
strategy: tip.strategy,
|
|
86
|
+
sync: tip.sync,
|
|
87
|
+
series: tip.series,
|
|
88
|
+
content: tip.content,
|
|
89
|
+
anchorX: tip.anchorX,
|
|
90
|
+
anchorY: tip.anchorY,
|
|
91
|
+
}
|
|
92
|
+
: undefined}
|
|
93
|
+
/>
|
|
94
|
+
{/snippet}
|
|
95
|
+
</BaseChart>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Accessor } from '../../types/plots/data/common';
|
|
2
|
+
import type { ChartProps } from '../../types/charts/props';
|
|
3
|
+
declare function $$render<TRow extends Record<string, unknown>>(): {
|
|
4
|
+
props: ChartProps<TRow, import("../..").DotStyle> & {
|
|
5
|
+
r?: Accessor<TRow, number> | number;
|
|
6
|
+
};
|
|
7
|
+
exports: {};
|
|
8
|
+
bindings: "";
|
|
9
|
+
slots: {};
|
|
10
|
+
events: {};
|
|
11
|
+
};
|
|
12
|
+
declare class __sveltets_Render<TRow extends Record<string, unknown>> {
|
|
13
|
+
props(): ReturnType<typeof $$render<TRow>>['props'];
|
|
14
|
+
events(): ReturnType<typeof $$render<TRow>>['events'];
|
|
15
|
+
slots(): ReturnType<typeof $$render<TRow>>['slots'];
|
|
16
|
+
bindings(): "";
|
|
17
|
+
exports(): {};
|
|
18
|
+
}
|
|
19
|
+
interface $$IsomorphicComponent {
|
|
20
|
+
new <TRow extends Record<string, unknown>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TRow>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TRow>['props']>, ReturnType<__sveltets_Render<TRow>['events']>, ReturnType<__sveltets_Render<TRow>['slots']>> & {
|
|
21
|
+
$$bindings?: ReturnType<__sveltets_Render<TRow>['bindings']>;
|
|
22
|
+
} & ReturnType<__sveltets_Render<TRow>['exports']>;
|
|
23
|
+
<TRow extends Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<TRow>['props']> & {}): ReturnType<__sveltets_Render<TRow>['exports']>;
|
|
24
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
25
|
+
}
|
|
26
|
+
declare const Chart: $$IsomorphicComponent;
|
|
27
|
+
type Chart<TRow extends Record<string, unknown>> = InstanceType<typeof Chart<TRow>>;
|
|
28
|
+
export default Chart;
|
|
@@ -81,11 +81,13 @@ export const DEFAULT_CONFIG = {
|
|
|
81
81
|
connectorWidth: 0.5,
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
|
+
scatter: { dotRadius: 5 },
|
|
84
85
|
timeline: { axisColor: 'currentColor', activeColor: '#e6580d', thickness: 60 },
|
|
85
86
|
hover: {
|
|
86
87
|
rule: { stroke: '#e6580d', strokeOpacity: 0.35, strokeWidth: 1.5, strokeDasharray: '4 4' },
|
|
87
88
|
dot: { dotRadius: 5, dotFill: 'currentColor' },
|
|
88
89
|
font: { fill: 'currentColor', fontSize: 12, dy: -18 },
|
|
90
|
+
area: { stroke: '#e6580d', strokeWidth: 2, fillOpacity: 0 },
|
|
89
91
|
},
|
|
90
92
|
};
|
|
91
93
|
// ── Merge ─────────────────────────────────────────────────────────────────────
|
|
@@ -92,6 +92,9 @@ export declare const THEMES: {
|
|
|
92
92
|
connectorWidth?: number | undefined;
|
|
93
93
|
} | undefined;
|
|
94
94
|
} | undefined;
|
|
95
|
+
scatter?: {
|
|
96
|
+
dotRadius?: number | undefined;
|
|
97
|
+
} | undefined;
|
|
95
98
|
timeline?: {
|
|
96
99
|
axisColor?: string | undefined;
|
|
97
100
|
activeColor?: string | undefined;
|
|
@@ -133,6 +136,15 @@ export declare const THEMES: {
|
|
|
133
136
|
class?: string | undefined;
|
|
134
137
|
textClass?: string | undefined;
|
|
135
138
|
} | undefined;
|
|
139
|
+
area?: {
|
|
140
|
+
fill?: string | undefined;
|
|
141
|
+
fillOpacity?: number | undefined;
|
|
142
|
+
stroke?: string | undefined;
|
|
143
|
+
strokeWidth?: number | undefined;
|
|
144
|
+
strokeOpacity?: number | undefined;
|
|
145
|
+
strokeDasharray?: (string | import("../..").LineStyle) | undefined;
|
|
146
|
+
borderRadius?: number | undefined;
|
|
147
|
+
} | undefined;
|
|
136
148
|
} | undefined;
|
|
137
149
|
};
|
|
138
150
|
Editorial: {
|
|
@@ -222,6 +234,9 @@ export declare const THEMES: {
|
|
|
222
234
|
connectorWidth?: number | undefined;
|
|
223
235
|
} | undefined;
|
|
224
236
|
} | undefined;
|
|
237
|
+
scatter?: {
|
|
238
|
+
dotRadius?: number | undefined;
|
|
239
|
+
} | undefined;
|
|
225
240
|
timeline?: {
|
|
226
241
|
axisColor?: string | undefined;
|
|
227
242
|
activeColor?: string | undefined;
|
|
@@ -263,6 +278,15 @@ export declare const THEMES: {
|
|
|
263
278
|
class?: string | undefined;
|
|
264
279
|
textClass?: string | undefined;
|
|
265
280
|
} | undefined;
|
|
281
|
+
area?: {
|
|
282
|
+
fill?: string | undefined;
|
|
283
|
+
fillOpacity?: number | undefined;
|
|
284
|
+
stroke?: string | undefined;
|
|
285
|
+
strokeWidth?: number | undefined;
|
|
286
|
+
strokeOpacity?: number | undefined;
|
|
287
|
+
strokeDasharray?: (string | import("../..").LineStyle) | undefined;
|
|
288
|
+
borderRadius?: number | undefined;
|
|
289
|
+
} | undefined;
|
|
266
290
|
} | undefined;
|
|
267
291
|
};
|
|
268
292
|
Dark: {
|
|
@@ -352,6 +376,9 @@ export declare const THEMES: {
|
|
|
352
376
|
connectorWidth?: number | undefined;
|
|
353
377
|
} | undefined;
|
|
354
378
|
} | undefined;
|
|
379
|
+
scatter?: {
|
|
380
|
+
dotRadius?: number | undefined;
|
|
381
|
+
} | undefined;
|
|
355
382
|
timeline?: {
|
|
356
383
|
axisColor?: string | undefined;
|
|
357
384
|
activeColor?: string | undefined;
|
|
@@ -393,6 +420,15 @@ export declare const THEMES: {
|
|
|
393
420
|
class?: string | undefined;
|
|
394
421
|
textClass?: string | undefined;
|
|
395
422
|
} | undefined;
|
|
423
|
+
area?: {
|
|
424
|
+
fill?: string | undefined;
|
|
425
|
+
fillOpacity?: number | undefined;
|
|
426
|
+
stroke?: string | undefined;
|
|
427
|
+
strokeWidth?: number | undefined;
|
|
428
|
+
strokeOpacity?: number | undefined;
|
|
429
|
+
strokeDasharray?: (string | import("../..").LineStyle) | undefined;
|
|
430
|
+
borderRadius?: number | undefined;
|
|
431
|
+
} | undefined;
|
|
396
432
|
} | undefined;
|
|
397
433
|
};
|
|
398
434
|
Compact: {
|
|
@@ -482,6 +518,9 @@ export declare const THEMES: {
|
|
|
482
518
|
connectorWidth?: number | undefined;
|
|
483
519
|
} | undefined;
|
|
484
520
|
} | undefined;
|
|
521
|
+
scatter?: {
|
|
522
|
+
dotRadius?: number | undefined;
|
|
523
|
+
} | undefined;
|
|
485
524
|
timeline?: {
|
|
486
525
|
axisColor?: string | undefined;
|
|
487
526
|
activeColor?: string | undefined;
|
|
@@ -523,6 +562,15 @@ export declare const THEMES: {
|
|
|
523
562
|
class?: string | undefined;
|
|
524
563
|
textClass?: string | undefined;
|
|
525
564
|
} | undefined;
|
|
565
|
+
area?: {
|
|
566
|
+
fill?: string | undefined;
|
|
567
|
+
fillOpacity?: number | undefined;
|
|
568
|
+
stroke?: string | undefined;
|
|
569
|
+
strokeWidth?: number | undefined;
|
|
570
|
+
strokeOpacity?: number | undefined;
|
|
571
|
+
strokeDasharray?: (string | import("../..").LineStyle) | undefined;
|
|
572
|
+
borderRadius?: number | undefined;
|
|
573
|
+
} | undefined;
|
|
526
574
|
} | undefined;
|
|
527
575
|
};
|
|
528
576
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,49 +2,55 @@ export { default as BarPlot } from './plots/bar/Plot.svelte';
|
|
|
2
2
|
export { default as HeatmapPlot } from './plots/heatmap/Plot.svelte';
|
|
3
3
|
export { default as LinePlot } from './plots/line/Plot.svelte';
|
|
4
4
|
export { default as PyramidPlot } from './plots/pyramid/Plot.svelte';
|
|
5
|
+
export { default as ScatterPlot } from './plots/scatter/Plot.svelte';
|
|
5
6
|
export { default as GeoPlot } from './plots/geo/Plot.svelte';
|
|
6
7
|
export { default as BaseChart } from './charts/BaseChart.svelte';
|
|
7
8
|
export { default as BarChart } from './charts/bar/Chart.svelte';
|
|
8
9
|
export { default as HeatmapChart } from './charts/heatmap/Chart.svelte';
|
|
9
10
|
export { default as LineChart } from './charts/line/Chart.svelte';
|
|
10
11
|
export { default as PyramidChart } from './charts/pyramid/Chart.svelte';
|
|
12
|
+
export { default as ScatterChart } from './charts/scatter/Chart.svelte';
|
|
11
13
|
export { default as ChartContainer } from './charts/container/ChartContainer.svelte';
|
|
12
14
|
export { default as BasePlotLayout } from './layout/plot/BasePlotLayout.svelte';
|
|
13
|
-
export { default as
|
|
14
|
-
export { default as TileLayer } from './
|
|
15
|
-
export { argentinaBicontinental } from './
|
|
15
|
+
export { default as CoordinatesLayout } from './layout/coordinates/CoordinatesLayout.svelte';
|
|
16
|
+
export { default as TileLayer } from './layout/styles/TileLayer.svelte';
|
|
17
|
+
export { argentinaBicontinental } from './layout/coordinates/projections/argentina';
|
|
16
18
|
export { default as Timeline } from './layout/timeline/Timeline.svelte';
|
|
17
19
|
export { default as TimelineLayout } from './layout/timeline/TimelineLayout.svelte';
|
|
18
20
|
export { default as FacetLayout } from './layout/facet/FacetLayout.svelte';
|
|
19
21
|
export { default as LegendLayout } from './layout/legend/LegendLayout.svelte';
|
|
20
22
|
export { default as Tooltip } from './layout/tooltip/Tooltip.svelte';
|
|
23
|
+
export { default as BarMarker } from './markers/BarMarker.svelte';
|
|
24
|
+
export { default as CellMarker } from './markers/CellMarker.svelte';
|
|
21
25
|
export { default as DeltaMarker } from './markers/DeltaMarker.svelte';
|
|
22
26
|
export { default as DotMarker } from './markers/DotMarker.svelte';
|
|
23
27
|
export { default as HoverMarker } from './markers/HoverMarker.svelte';
|
|
28
|
+
export { default as LineMarker } from './markers/LineMarker.svelte';
|
|
24
29
|
export { default as PeakMarker } from './markers/PeakMarker.svelte';
|
|
30
|
+
export { default as RuleMarker } from './markers/RuleMarker.svelte';
|
|
25
31
|
export { default as TextMarker } from './markers/TextMarker.svelte';
|
|
26
32
|
export { setConfiguration, getConfiguration, resetConfiguration, configToCssVars, cssVarsStyle, DEFAULT_CONFIG, } from './configuration/config.svelte';
|
|
27
33
|
export { THEMES } from './configuration/themes';
|
|
28
34
|
export type { ThemeName } from './configuration/themes';
|
|
29
35
|
export { groupBy, buildSeries } from './utils/grouping';
|
|
30
36
|
export { makeColorScale, normalize, resolveCssColor, paletteColor } from './utils/color';
|
|
31
|
-
export type { AxisValue, AxisScale } from './types/
|
|
37
|
+
export type { AxisValue, AxisScale, AxisBasedScalesConfig } from './types/layout/scales';
|
|
32
38
|
export type { Accessor, Series, SeriesProps, DataProps } from './types/plots/data/common';
|
|
33
|
-
export type { BasePlotProps, StylesConfig, MarkersConfig, SegmentsConfig,
|
|
34
|
-
export type {
|
|
35
|
-
export type {
|
|
36
|
-
export type { LineSegmentStyle, BarSegmentStyle, CellSegmentStyle, GeoSegmentStyle } from './types/plots/segments/common';
|
|
39
|
+
export type { BasePlotProps, StylesConfig, MarkersConfig, SegmentsConfig, ScalesConfig, MarginConfig, TooltipConfig, HoverConfig, PointMatchingStrategy, } from './types/plots/props';
|
|
40
|
+
export type { ValuesStyle, ColorsStyle, FrameStyle, FrameProp, BasePlotStylesConfig, GeoStylesConfig, GeoTileLayerConfig, } from './types/layout/styles';
|
|
41
|
+
export type { LineSegmentStyle, BarSegmentStyle, CellSegmentStyle, GeoSegmentStyle, ScatterSegmentStyle } from './types/plots/segments/common';
|
|
37
42
|
export type { Range, Area, Segment } from './types/plots/segments/config';
|
|
38
43
|
export type { ValueAnchor, SymbolType, LineStyle, LineCap, LineJoin, FontWeight, FontStyleKeyword, TextAnchor, LineAnchor, } from './types/plots/constants';
|
|
39
|
-
export type { FontStyle, StrokeStyle, DotStyle } from './types/plots/styling';
|
|
40
|
-
export type {
|
|
44
|
+
export type { FontStyle, StrokeStyle, DotStyle, AreaStyle } from './types/plots/styling';
|
|
45
|
+
export type { AxisBasedMarkersConfig } from './types/markers/common';
|
|
46
|
+
export type { LineMarkersConfig, DeltaMarkerConfig, DeltaConfig, DeltaTarget } from './types/markers/line';
|
|
41
47
|
export type { MarkerProps } from './types/markers/props';
|
|
42
48
|
export type { GeoFeature, GeoJsonInput, GeoDataProps, Topology } from './types/plots/data/geo';
|
|
43
|
-
export type {
|
|
44
|
-
export type {
|
|
45
|
-
export type {
|
|
49
|
+
export type { ScatterDataProps } from './types/plots/data/scatter';
|
|
50
|
+
export type { GeoProjectionName, GeoProjectionConfig, GeoCustomProjection, GeoCustomProjectionFactory, GeoScalesConfig, GeoZoomConfig, CoordinatesConfig, } from './types/layout/coordinates';
|
|
51
|
+
export type { GeoMarkersConfig, GeoInsetMarkerConfig, GeoInsetTooltipConfig, GeoInsetLocation, GeoInsetProjectionName, GeoInsetProjectionConfig, } from './types/markers/geo';
|
|
46
52
|
export type { TimeValue, Orientation, FacetColumns, FacetConfig, TimelineConfig, ChartPlotContext, ChartPlotSnippet, } from './types/charts/common';
|
|
47
53
|
export type { LegendSection, DiscreteLegendSection, ContinuousLegendSection, LegendItem, LegendDisabledStyle, } from './types/charts/legend';
|
|
48
|
-
export type { HoverStrategy, TooltipOptions, TooltipProp, } from './types/layout/tooltip';
|
|
54
|
+
export type { HoverStrategy, TooltipOptions, TooltipProp, TooltipAnchorX, TooltipAnchorY, } from './types/layout/tooltip';
|
|
49
55
|
export type { ChartConfig, ChartConfigInput, TextStyle } from './types/configuration/styling';
|
|
50
56
|
export type { ChartProps } from './types/charts/props';
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { default as BarPlot } from './plots/bar/Plot.svelte';
|
|
|
4
4
|
export { default as HeatmapPlot } from './plots/heatmap/Plot.svelte';
|
|
5
5
|
export { default as LinePlot } from './plots/line/Plot.svelte';
|
|
6
6
|
export { default as PyramidPlot } from './plots/pyramid/Plot.svelte';
|
|
7
|
+
export { default as ScatterPlot } from './plots/scatter/Plot.svelte';
|
|
7
8
|
export { default as GeoPlot } from './plots/geo/Plot.svelte';
|
|
8
9
|
// ── Charts ──────────────────────────────────────────────────────────────────
|
|
9
10
|
// High-level, plot-agnostic chrome plus ready-made chart kinds.
|
|
@@ -12,23 +13,28 @@ export { default as BarChart } from './charts/bar/Chart.svelte';
|
|
|
12
13
|
export { default as HeatmapChart } from './charts/heatmap/Chart.svelte';
|
|
13
14
|
export { default as LineChart } from './charts/line/Chart.svelte';
|
|
14
15
|
export { default as PyramidChart } from './charts/pyramid/Chart.svelte';
|
|
16
|
+
export { default as ScatterChart } from './charts/scatter/Chart.svelte';
|
|
15
17
|
// Interchangeable layout primitives (compose your own chart kinds with these).
|
|
16
18
|
export { default as ChartContainer } from './charts/container/ChartContainer.svelte';
|
|
17
19
|
export { default as BasePlotLayout } from './layout/plot/BasePlotLayout.svelte';
|
|
18
|
-
export { default as
|
|
19
|
-
export { default as TileLayer } from './
|
|
20
|
+
export { default as CoordinatesLayout } from './layout/coordinates/CoordinatesLayout.svelte';
|
|
21
|
+
export { default as TileLayer } from './layout/styles/TileLayer.svelte';
|
|
20
22
|
// Custom geo projections — usable as `scales.projection.type`.
|
|
21
|
-
export { argentinaBicontinental } from './
|
|
23
|
+
export { argentinaBicontinental } from './layout/coordinates/projections/argentina';
|
|
22
24
|
export { default as Timeline } from './layout/timeline/Timeline.svelte';
|
|
23
25
|
export { default as TimelineLayout } from './layout/timeline/TimelineLayout.svelte';
|
|
24
26
|
export { default as FacetLayout } from './layout/facet/FacetLayout.svelte';
|
|
25
27
|
export { default as LegendLayout } from './layout/legend/LegendLayout.svelte';
|
|
26
28
|
export { default as Tooltip } from './layout/tooltip/Tooltip.svelte';
|
|
27
29
|
// Markers
|
|
30
|
+
export { default as BarMarker } from './markers/BarMarker.svelte';
|
|
31
|
+
export { default as CellMarker } from './markers/CellMarker.svelte';
|
|
28
32
|
export { default as DeltaMarker } from './markers/DeltaMarker.svelte';
|
|
29
33
|
export { default as DotMarker } from './markers/DotMarker.svelte';
|
|
30
34
|
export { default as HoverMarker } from './markers/HoverMarker.svelte';
|
|
35
|
+
export { default as LineMarker } from './markers/LineMarker.svelte';
|
|
31
36
|
export { default as PeakMarker } from './markers/PeakMarker.svelte';
|
|
37
|
+
export { default as RuleMarker } from './markers/RuleMarker.svelte';
|
|
32
38
|
export { default as TextMarker } from './markers/TextMarker.svelte';
|
|
33
39
|
export { setConfiguration, getConfiguration, resetConfiguration, configToCssVars, cssVarsStyle, DEFAULT_CONFIG, } from './configuration/config.svelte';
|
|
34
40
|
export { THEMES } from './configuration/themes';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script lang="ts" generics="TData extends Record<string, unknown>">
|
|
2
|
+
import type { ComponentProps, Snippet } from 'svelte';
|
|
3
|
+
import { Plot } from 'svelteplot';
|
|
4
|
+
import { resolveProjection } from './resolveProjection';
|
|
5
|
+
import { createGeoZoom } from './zoom.svelte';
|
|
6
|
+
import { createGeoRotate, type GeoRotate } from './rotate.svelte';
|
|
7
|
+
import type { CoordinatesConfig } from '../../types/layout/coordinates';
|
|
8
|
+
|
|
9
|
+
type SveltePlotProps = ComponentProps<typeof Plot>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The Coordinates layer, rendered — resolves the active coordinate system
|
|
13
|
+
* (today, only a `d3-geo` projection; svelteplot has no other coordinate
|
|
14
|
+
* abstraction, cartesian is implicit elsewhere) and owns `<Plot>` itself,
|
|
15
|
+
* since `<Plot projection>` must be known before `<Plot>` mounts — nothing
|
|
16
|
+
* nested inside it could supply that prop after the fact. Also owns the
|
|
17
|
+
* pan/zoom/rotate gesture state and applies the resulting transform as a
|
|
18
|
+
* `<g>` wrapper around `children`. A no-op identity transform, no
|
|
19
|
+
* projection, for every plot kind but `GeoPlot`.
|
|
20
|
+
*/
|
|
21
|
+
let {
|
|
22
|
+
width,
|
|
23
|
+
height,
|
|
24
|
+
margin,
|
|
25
|
+
x,
|
|
26
|
+
y,
|
|
27
|
+
coordinates = undefined,
|
|
28
|
+
data,
|
|
29
|
+
containerEl,
|
|
30
|
+
children,
|
|
31
|
+
}: {
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
margin: SveltePlotProps['margin'];
|
|
35
|
+
x: SveltePlotProps['x'];
|
|
36
|
+
y: SveltePlotProps['y'];
|
|
37
|
+
coordinates?: CoordinatesConfig;
|
|
38
|
+
/** Fed to `resolveProjection`'s `domain: 'data'` sentinel — the same rows `BasePlotLayout` uses for hover matching. */
|
|
39
|
+
data: TData[];
|
|
40
|
+
containerEl?: HTMLDivElement;
|
|
41
|
+
children: Snippet;
|
|
42
|
+
} = $props();
|
|
43
|
+
|
|
44
|
+
const resolvedProjection = $derived(
|
|
45
|
+
coordinates?.projection ? resolveProjection(coordinates.projection, data) : undefined,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const zoomEnabled = $derived(coordinates?.zoom !== false && coordinates?.zoom != null);
|
|
49
|
+
const zoomConfig = $derived(typeof coordinates?.zoom === 'object' ? coordinates.zoom : undefined);
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Orthographic (and other azimuthal, hemisphere-style) projections don't
|
|
53
|
+
* gain anything from drag-to-*pan* — panning just slides the same globe a
|
|
54
|
+
* few pixels within the frame — so when zoom is enabled on one, drag
|
|
55
|
+
* instead rotates the globe (`createGeoRotate`) and wheel/pinch keeps
|
|
56
|
+
* scaling it (`createGeoZoom`, with its own drag disabled below so the two
|
|
57
|
+
* gestures don't fight over the same pointer events).
|
|
58
|
+
*/
|
|
59
|
+
const projectionType = $derived(
|
|
60
|
+
typeof resolvedProjection === 'string' ? resolvedProjection : resolvedProjection?.type,
|
|
61
|
+
);
|
|
62
|
+
const rotateEnabled = $derived(zoomEnabled && projectionType === 'orthographic');
|
|
63
|
+
const baseRotate = $derived.by((): GeoRotate => {
|
|
64
|
+
const configured = typeof resolvedProjection === 'object' ? resolvedProjection?.rotate : undefined;
|
|
65
|
+
return [configured?.[0] ?? 0, configured?.[1] ?? 0, configured?.[2] ?? 0];
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const geoZoom = createGeoZoom({
|
|
69
|
+
enabled: () => zoomEnabled,
|
|
70
|
+
config: () => zoomConfig,
|
|
71
|
+
node: () => containerEl ?? null,
|
|
72
|
+
disableDrag: () => rotateEnabled,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const geoRotate = createGeoRotate({
|
|
76
|
+
enabled: () => rotateEnabled,
|
|
77
|
+
baseRotate: () => baseRotate,
|
|
78
|
+
scale: () => geoZoom.transform.k,
|
|
79
|
+
node: () => containerEl ?? null,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const finalProjection = $derived.by(() => {
|
|
83
|
+
if (!rotateEnabled) return resolvedProjection;
|
|
84
|
+
return {
|
|
85
|
+
...(typeof resolvedProjection === 'string' ? { type: resolvedProjection } : resolvedProjection),
|
|
86
|
+
rotate: geoRotate.rotate,
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<Plot {width} {height} {margin} {x} {y} projection={finalProjection as SveltePlotProps['projection']}>
|
|
92
|
+
<g transform="translate({geoZoom.transform.x}, {geoZoom.transform.y}) scale({geoZoom.transform.k})">
|
|
93
|
+
{@render children()}
|
|
94
|
+
</g>
|
|
95
|
+
</Plot>
|
package/dist/layout/{plot/RuleLayout.svelte.d.ts → coordinates/CoordinatesLayout.svelte.d.ts}
RENAMED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type {
|
|
3
|
-
import type { Series } from '../../types/plots/data/common';
|
|
4
|
-
import type { Marker } from '../../types/markers/common';
|
|
5
|
-
import type { HoverPoint } from '../../types/layout/tooltip';
|
|
2
|
+
import type { CoordinatesConfig } from '../../types/layout/coordinates';
|
|
6
3
|
declare function $$render<TData extends Record<string, unknown>>(): {
|
|
7
4
|
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
margin: number | "auto" | import("svelteplot/types/plot.js").PlotMargin | undefined;
|
|
8
|
+
x: false | import("svelteplot/types/data.js").RawValue[] | Partial<import("svelteplot/types/scale.js").XScaleOptions> | undefined;
|
|
9
|
+
y: false | import("svelteplot/types/data.js").RawValue[] | Partial<import("svelteplot/types/scale.js").YScaleOptions> | undefined;
|
|
10
|
+
coordinates?: CoordinatesConfig;
|
|
11
|
+
/** Fed to `resolveProjection`'s `domain: 'data'` sentinel — the same rows `BasePlotLayout` uses for hover matching. */
|
|
12
|
+
data: TData[];
|
|
13
|
+
containerEl?: HTMLDivElement;
|
|
17
14
|
children: Snippet;
|
|
18
15
|
};
|
|
19
16
|
exports: {};
|
|
@@ -35,6 +32,6 @@ interface $$IsomorphicComponent {
|
|
|
35
32
|
<TData extends Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<TData>['props']> & {}): ReturnType<__sveltets_Render<TData>['exports']>;
|
|
36
33
|
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
37
34
|
}
|
|
38
|
-
declare const
|
|
39
|
-
type
|
|
40
|
-
export default
|
|
35
|
+
declare const CoordinatesLayout: $$IsomorphicComponent;
|
|
36
|
+
type CoordinatesLayout<TData extends Record<string, unknown>> = InstanceType<typeof CoordinatesLayout<TData>>;
|
|
37
|
+
export default CoordinatesLayout;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GeoPlot's own margin default — a small, uniform gap on every side, unlike
|
|
3
|
+
* `AUTO_MARGIN_ESTIMATE`'s asymmetric axis-tick-label estimate (extra room
|
|
4
|
+
* on the left/bottom for y tick labels and an x-axis title). A map has no
|
|
5
|
+
* axes to make room for, so borrowing that estimate just left GeoPlot with
|
|
6
|
+
* a lopsided, oversized margin — most visibly a much taller gap under the
|
|
7
|
+
* map than an `inset` marker's own default `margin` (see `insetLayout.ts`),
|
|
8
|
+
* even though both are meant to read as the same edge gap. Matching this
|
|
9
|
+
* constant to that 8px inset default keeps the two visually aligned.
|
|
10
|
+
*/
|
|
11
|
+
export declare const GEO_MARGIN_ESTIMATE: {
|
|
12
|
+
readonly top: 8;
|
|
13
|
+
readonly right: 8;
|
|
14
|
+
readonly bottom: 8;
|
|
15
|
+
readonly left: 8;
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GeoPlot's own margin default — a small, uniform gap on every side, unlike
|
|
3
|
+
* `AUTO_MARGIN_ESTIMATE`'s asymmetric axis-tick-label estimate (extra room
|
|
4
|
+
* on the left/bottom for y tick labels and an x-axis title). A map has no
|
|
5
|
+
* axes to make room for, so borrowing that estimate just left GeoPlot with
|
|
6
|
+
* a lopsided, oversized margin — most visibly a much taller gap under the
|
|
7
|
+
* map than an `inset` marker's own default `margin` (see `insetLayout.ts`),
|
|
8
|
+
* even though both are meant to read as the same edge gap. Matching this
|
|
9
|
+
* constant to that 8px inset default keeps the two visually aligned.
|
|
10
|
+
*/
|
|
11
|
+
export const GEO_MARGIN_ESTIMATE = { top: 8, right: 8, bottom: 8, left: 8 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GeoCustomProjectionFactory } from '../../../types/
|
|
1
|
+
import type { GeoCustomProjectionFactory } from '../../../types/layout/coordinates';
|
|
2
2
|
/**
|
|
3
3
|
* Argentina's territory in one unbroken frame: the mainland and the
|
|
4
4
|
* Antarctic/South Atlantic sector both visible, related to each other at
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GeoProjectionConfig } from '../../types/
|
|
1
|
+
import type { GeoProjectionConfig } from '../../types/layout/coordinates';
|
|
2
2
|
/**
|
|
3
3
|
* Resolves a `GeoScalesConfig['projection']` into what svelteplot's own
|
|
4
4
|
* `<Plot projection>` expects — kept separate from `GeoPlot`'s own
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a `GeoScalesConfig['projection']` into what svelteplot's own
|
|
3
|
+
* `<Plot projection>` expects — kept separate from `GeoPlot`'s own
|
|
4
|
+
* `Plot.svelte` so adding more projection-level behavior (like the
|
|
5
|
+
* `domain: 'data'` sentinel below) doesn't grow that component itself.
|
|
6
|
+
*/
|
|
7
|
+
export function resolveProjection(projection, data) {
|
|
8
|
+
if (!projection)
|
|
9
|
+
return 'equal-earth';
|
|
10
|
+
if (typeof projection === 'string')
|
|
11
|
+
return projection;
|
|
12
|
+
const domain = projection.domain === 'data'
|
|
13
|
+
? { type: 'FeatureCollection', features: data }
|
|
14
|
+
: projection.domain;
|
|
15
|
+
return {
|
|
16
|
+
type: projection.type,
|
|
17
|
+
rotate: projection.rotate,
|
|
18
|
+
center: projection.center,
|
|
19
|
+
parallels: projection.parallels,
|
|
20
|
+
inset: projection.inset,
|
|
21
|
+
clip: projection.clip,
|
|
22
|
+
domain,
|
|
23
|
+
};
|
|
24
|
+
}
|