@fundar/data-chart-telling 0.0.24 → 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 +13 -1
- package/dist/configuration/themes/index.d.ts +76 -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 +94 -49
- 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 +82 -33
- package/dist/plots/utils/declutter.js +182 -40
- 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 +24 -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
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
<script lang="ts" generics="TData extends Record<string, unknown>">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
import { RuleX, RuleY } from 'svelteplot';
|
|
4
|
-
import HoverMarker from '../../markers/HoverMarker.svelte';
|
|
5
|
-
import type { AxisValue } from '../../types/plots/axis';
|
|
6
|
-
import type { Series } from '../../types/plots/data/common';
|
|
7
|
-
import type { Marker } from '../../types/markers/common';
|
|
8
|
-
import type { HoverPoint } from '../../types/layout/tooltip';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Standalone rule markers (`ruleX`/`ruleY`/un-scoped `component`) plus the
|
|
12
|
-
* unscoped hover crosshair+dot+label — the plot kinds with an x/y axis pair
|
|
13
|
-
* only (line/bar/heatmap/pyramid); `GeoPlot` has no rule/crosshair concept
|
|
14
|
-
* of its own. Wraps `children` (the plot kind's actual marks) so both draw
|
|
15
|
-
* in the same order as before this was split out of `BasePlotLayout`: marks
|
|
16
|
-
* first, then rules/hover marker on top of them.
|
|
17
|
-
*/
|
|
18
|
-
let {
|
|
19
|
-
markers = [],
|
|
20
|
-
seriesData = [],
|
|
21
|
-
matchedPoints,
|
|
22
|
-
ruleX,
|
|
23
|
-
ruleY,
|
|
24
|
-
impliesRuleX,
|
|
25
|
-
impliesRuleY,
|
|
26
|
-
showHoverLabels = true,
|
|
27
|
-
children,
|
|
28
|
-
}: {
|
|
29
|
-
markers?: Marker[];
|
|
30
|
-
/** All resolved series, forwarded to unscoped component markers (e.g. DeltaMarker). */
|
|
31
|
-
seriesData?: Series<TData>[];
|
|
32
|
-
matchedPoints: HoverPoint<TData>[];
|
|
33
|
-
ruleX: AxisValue | null;
|
|
34
|
-
ruleY: AxisValue | null;
|
|
35
|
-
impliesRuleX: boolean;
|
|
36
|
-
impliesRuleY: boolean;
|
|
37
|
-
showHoverLabels?: boolean;
|
|
38
|
-
children: Snippet;
|
|
39
|
-
} = $props();
|
|
40
|
-
|
|
41
|
-
const topLevelMarkers = $derived(
|
|
42
|
-
markers.filter(
|
|
43
|
-
(marker) =>
|
|
44
|
-
marker.type === 'ruleX' ||
|
|
45
|
-
marker.type === 'ruleY' ||
|
|
46
|
-
(marker.type === 'component' && !marker.series),
|
|
47
|
-
),
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
/** The unscoped (no `series`) hover marker, if any. */
|
|
51
|
-
const unscopedHoverMarker = $derived(
|
|
52
|
-
markers.find((m) => m.type === 'hover' && !m.series) as
|
|
53
|
-
| Extract<Marker, { type: 'hover' }>
|
|
54
|
-
| undefined,
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Gate ruleX display: shows when the strategy implies it (default) or the
|
|
59
|
-
* marker explicitly requests it (`ruleX: true`), and is never suppressed
|
|
60
|
-
* unless the marker explicitly disables it (`ruleX: false`).
|
|
61
|
-
*/
|
|
62
|
-
const showRuleX = $derived(
|
|
63
|
-
unscopedHoverMarker != null &&
|
|
64
|
-
unscopedHoverMarker.ruleX !== false &&
|
|
65
|
-
(impliesRuleX || unscopedHoverMarker.ruleX === true),
|
|
66
|
-
);
|
|
67
|
-
const showRuleY = $derived(
|
|
68
|
-
unscopedHoverMarker != null &&
|
|
69
|
-
unscopedHoverMarker.ruleY !== false &&
|
|
70
|
-
(impliesRuleY || unscopedHoverMarker.ruleY === true),
|
|
71
|
-
);
|
|
72
|
-
</script>
|
|
73
|
-
|
|
74
|
-
{@render children()}
|
|
75
|
-
|
|
76
|
-
{#each topLevelMarkers as marker, i (marker.type === 'ruleX' ? `${marker.type}-${marker.x}` : marker.type === 'ruleY' ? `${marker.type}-${marker.y}` : `${marker.type}-${i}`)}
|
|
77
|
-
{#if marker.type === 'ruleX'}
|
|
78
|
-
<RuleX
|
|
79
|
-
data={[{ xValue: marker.x }]}
|
|
80
|
-
x={(d) => d.xValue}
|
|
81
|
-
stroke={marker.style?.stroke ?? 'currentColor'}
|
|
82
|
-
strokeWidth={marker.style?.strokeWidth ?? 1}
|
|
83
|
-
strokeOpacity={marker.style?.strokeOpacity ?? 1}
|
|
84
|
-
strokeDasharray={marker.style?.strokeDasharray}
|
|
85
|
-
/>
|
|
86
|
-
{:else if marker.type === 'ruleY'}
|
|
87
|
-
<RuleY
|
|
88
|
-
data={[{ yValue: marker.y }]}
|
|
89
|
-
y={(d) => d.yValue}
|
|
90
|
-
stroke={marker.style?.stroke ?? 'currentColor'}
|
|
91
|
-
strokeWidth={marker.style?.strokeWidth ?? 1}
|
|
92
|
-
strokeOpacity={marker.style?.strokeOpacity ?? 1}
|
|
93
|
-
strokeDasharray={marker.style?.strokeDasharray}
|
|
94
|
-
/>
|
|
95
|
-
{:else if marker.type === 'component'}
|
|
96
|
-
<marker.component {...marker.props} data={marker.data ?? seriesData} />
|
|
97
|
-
{/if}
|
|
98
|
-
{/each}
|
|
99
|
-
|
|
100
|
-
{#if unscopedHoverMarker}
|
|
101
|
-
<HoverMarker
|
|
102
|
-
data={matchedPoints}
|
|
103
|
-
ruleX={showRuleX ? ruleX : null}
|
|
104
|
-
ruleY={showRuleY ? ruleY : null}
|
|
105
|
-
showLabels={unscopedHoverMarker.showLabels ?? showHoverLabels}
|
|
106
|
-
format={unscopedHoverMarker.format}
|
|
107
|
-
ruleStyle={unscopedHoverMarker.ruleStyle}
|
|
108
|
-
dotStyle={unscopedHoverMarker.dotStyle}
|
|
109
|
-
fontStyle={unscopedHoverMarker.fontStyle}
|
|
110
|
-
/>
|
|
111
|
-
{/if}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
<script lang="ts" generics="TData extends Record<string, unknown>">
|
|
2
|
-
import { BarX, BarY } from 'svelteplot';
|
|
3
|
-
import { resolveAccessor } from '../utils/accessors';
|
|
4
|
-
import type { Series } from '../../types/plots/data/common';
|
|
5
|
-
import type { BarSegmentStyle } from '../../types/plots/segments/common';
|
|
6
|
-
import type { VisualGroup } from '../../types/plots/segments/config';
|
|
7
|
-
import type { BarLayout } from './layout.svelte';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Renders one series' bars — the `'stacked'` branch (cumulative baseline
|
|
11
|
-
* from {@link BarLayout.stackedBaseline}) or the `'grouped'`/`'overlap'`
|
|
12
|
-
* branch (per-segment insets from {@link BarLayout.seriesStep}/`seriesGap`).
|
|
13
|
-
*/
|
|
14
|
-
let {
|
|
15
|
-
group,
|
|
16
|
-
seriesIndex,
|
|
17
|
-
barLayout,
|
|
18
|
-
isHorizontal,
|
|
19
|
-
BarMark,
|
|
20
|
-
defaultColor,
|
|
21
|
-
disabledFill,
|
|
22
|
-
}: {
|
|
23
|
-
group: VisualGroup<Series<TData>, BarSegmentStyle>;
|
|
24
|
-
seriesIndex: number;
|
|
25
|
-
barLayout: BarLayout<TData>;
|
|
26
|
-
isHorizontal: boolean;
|
|
27
|
-
BarMark: typeof BarX | typeof BarY;
|
|
28
|
-
defaultColor: string;
|
|
29
|
-
disabledFill?: { fill?: string; fillOpacity?: number };
|
|
30
|
-
} = $props();
|
|
31
|
-
|
|
32
|
-
const xFn = $derived(resolveAccessor(group.series.x));
|
|
33
|
-
const yFn = $derived(resolveAccessor(group.series.y));
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
{#if barLayout.layout === 'stacked'}
|
|
37
|
-
{@const stackedBaselineFn = (d: TData) => barLayout.stackedBaseline(xFn(d), seriesIndex)}
|
|
38
|
-
{@const stackedTopFn = (d: TData) => barLayout.stackedBaseline(xFn(d), seriesIndex) + Number(yFn(d))}
|
|
39
|
-
<BarMark
|
|
40
|
-
data={group.series.data}
|
|
41
|
-
{...isHorizontal
|
|
42
|
-
? { y: xFn, x1: stackedBaselineFn, x2: stackedTopFn }
|
|
43
|
-
: { x: xFn, y1: stackedBaselineFn, y2: stackedTopFn }}
|
|
44
|
-
fill={disabledFill?.fill ?? defaultColor}
|
|
45
|
-
fillOpacity={disabledFill?.fillOpacity ?? 1}
|
|
46
|
-
/>
|
|
47
|
-
{:else}
|
|
48
|
-
{#each group.visualSegments as seg, i (`${group.series.name}-${i}`)}
|
|
49
|
-
<BarMark
|
|
50
|
-
data={seg.data}
|
|
51
|
-
{...isHorizontal
|
|
52
|
-
? { y: xFn, x1: barLayout.valueBaseline, x2: yFn }
|
|
53
|
-
: { x: xFn, y1: barLayout.valueBaseline, y2: yFn }}
|
|
54
|
-
fill={disabledFill?.fill ?? seg.style.fill ?? defaultColor}
|
|
55
|
-
fillOpacity={disabledFill?.fillOpacity ?? seg.style.fillOpacity ?? 1}
|
|
56
|
-
{...barLayout.layout === 'grouped'
|
|
57
|
-
? isHorizontal
|
|
58
|
-
? {
|
|
59
|
-
insetTop: seriesIndex * barLayout.seriesStep + barLayout.seriesGap / 2,
|
|
60
|
-
insetBottom: (barLayout.seriesCount - 1 - seriesIndex) * barLayout.seriesStep + barLayout.seriesGap / 2,
|
|
61
|
-
}
|
|
62
|
-
: {
|
|
63
|
-
insetLeft: seriesIndex * barLayout.seriesStep + barLayout.seriesGap / 2,
|
|
64
|
-
insetRight: (barLayout.seriesCount - 1 - seriesIndex) * barLayout.seriesStep + barLayout.seriesGap / 2,
|
|
65
|
-
}
|
|
66
|
-
: {}}
|
|
67
|
-
/>
|
|
68
|
-
{/each}
|
|
69
|
-
{/if}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AxisValue } from './axis';
|
|
2
|
-
import type { StrokeStyle, FontStyle, DotStyle } from './styling';
|
|
3
|
-
export type DeltaTarget = {
|
|
4
|
-
type: 'series';
|
|
5
|
-
series: string;
|
|
6
|
-
} | {
|
|
7
|
-
type: 'axis';
|
|
8
|
-
value?: number;
|
|
9
|
-
};
|
|
10
|
-
export type DeltaConfig = {
|
|
11
|
-
axis: 'x' | 'y';
|
|
12
|
-
at: AxisValue;
|
|
13
|
-
from: DeltaTarget;
|
|
14
|
-
to?: DeltaTarget;
|
|
15
|
-
formatDiff?: (diff: number) => string;
|
|
16
|
-
strokeStyle?: StrokeStyle;
|
|
17
|
-
fontStyle?: FontStyle;
|
|
18
|
-
dotStyle?: DotStyle;
|
|
19
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { ValueAnchor } from '../constants';
|
|
2
|
-
import type { FontStyle, StrokeStyle } from '../styling';
|
|
3
|
-
/**
|
|
4
|
-
* Controls if and how value labels are rendered on a plot. The high-level
|
|
5
|
-
* `anchor` sets sensible defaults for placement; `fontStyle` (`dx`, `dy`,
|
|
6
|
-
* `textAnchor`, `lineAnchor`, `lineHeight`, `rotate`, `class`, `textClass`,
|
|
7
|
-
* `fill`, …) overrides those defaults field-by-field when provided — mirrors
|
|
8
|
-
* {@link DeltaConfig}'s `fontStyle`/`strokeStyle` split, so label text and
|
|
9
|
-
* connector-line styling never mix into one flat bag of props.
|
|
10
|
-
*/
|
|
11
|
-
export type ValuesStyle = {
|
|
12
|
-
show?: boolean;
|
|
13
|
-
anchor?: ValueAnchor;
|
|
14
|
-
/** Called with the numeric value and the series name. Return a string to render. */
|
|
15
|
-
format?: (value: number, seriesName: string) => string;
|
|
16
|
-
/** Text styling for the label itself. */
|
|
17
|
-
fontStyle?: FontStyle;
|
|
18
|
-
/**
|
|
19
|
-
* Style for the leader line drawn from a label displaced to clear an
|
|
20
|
-
* overlap with another series' label, back to its real data point.
|
|
21
|
-
* Labels only ever move when they'd otherwise collide — this is a no-op
|
|
22
|
-
* style until that happens. Falls back to a neutral grey, thin, solid
|
|
23
|
-
* stroke — deliberately not the series' own colour or stroke width, since
|
|
24
|
-
* matching the data line reads as more data rather than as a leader,
|
|
25
|
-
* right where several lines are already converging. Unset fields keep
|
|
26
|
-
* that fallback.
|
|
27
|
-
*/
|
|
28
|
-
strokeStyle?: StrokeStyle;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Color overrides for plots that derive their palette from data.
|
|
32
|
-
* Each plot uses only the fields relevant to its kind; unused fields are
|
|
33
|
-
* silently ignored.
|
|
34
|
-
*
|
|
35
|
-
* - `min` / `max` — sequential colour ramp endpoints (heatmap).
|
|
36
|
-
* - `left` / `right` — diverging bar sides (pyramid).
|
|
37
|
-
*/
|
|
38
|
-
export type ColorsStyle = {
|
|
39
|
-
min?: string;
|
|
40
|
-
max?: string;
|
|
41
|
-
left?: string;
|
|
42
|
-
right?: string;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Top-level rendering style overrides shared by the non-geo plot kinds.
|
|
46
|
-
* Passed as the `styles` prop. Each plot reads only the fields it cares
|
|
47
|
-
* about.
|
|
48
|
-
*/
|
|
49
|
-
export type BasePlotStyles = {
|
|
50
|
-
values?: ValuesStyle;
|
|
51
|
-
colors?: ColorsStyle;
|
|
52
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { ColorsStyle } from './common';
|
|
2
|
-
import type { GeoFeature } from '../data/geo';
|
|
3
|
-
export type GeoTileLayerConfig = {
|
|
4
|
-
/** XYZ tile URL template, e.g. `'https://tile.openstreetmap.org/{z}/{x}/{y}.png'`. */
|
|
5
|
-
url: string;
|
|
6
|
-
attribution?: string;
|
|
7
|
-
opacity?: number;
|
|
8
|
-
minZoom?: number;
|
|
9
|
-
maxZoom?: number;
|
|
10
|
-
/** Tile edge length in pixels. Defaults to `256`. */
|
|
11
|
-
tileSize?: number;
|
|
12
|
-
};
|
|
13
|
-
export type GeoZoomConfig = {
|
|
14
|
-
min?: number;
|
|
15
|
-
max?: number;
|
|
16
|
-
initial?: {
|
|
17
|
-
x?: number;
|
|
18
|
-
y?: number;
|
|
19
|
-
k?: number;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* `styles` prop for GeoPlot — the geo analog of `BasePlotStyles`. Unlike the
|
|
24
|
-
* other plot kinds, GeoPlot's styling needs (base map, choropleth ramp, tile
|
|
25
|
-
* background, zoom, click handling) are unlike anything x/y plots need, so
|
|
26
|
-
* this is its own type rather than a reuse of `BasePlotStyles`.
|
|
27
|
-
*/
|
|
28
|
-
export type GeoStyles<TProps extends Record<string, unknown> = Record<string, unknown>> = {
|
|
29
|
-
/** Base map fill, used when a feature isn't styled by `segments` or the choropleth ramp. */
|
|
30
|
-
fill?: string;
|
|
31
|
-
fillOpacity?: number;
|
|
32
|
-
stroke?: string;
|
|
33
|
-
strokeWidth?: number;
|
|
34
|
-
/** Continuous choropleth ramp endpoints — used when `value` is provided on data. Mirrors heatmap's `styles.colors`. */
|
|
35
|
-
colors?: ColorsStyle;
|
|
36
|
-
/** Raster XYZ tile basemap under the vector geometry. Mercator-family projections only. */
|
|
37
|
-
tileLayer?: GeoTileLayerConfig;
|
|
38
|
-
/** `true`/config enables drag-pan + scroll-zoom. Omitted/`false` = static map. */
|
|
39
|
-
zoom?: boolean | GeoZoomConfig;
|
|
40
|
-
/** Fired when a base-map feature is clicked. */
|
|
41
|
-
onFeatureClick?: (feature: GeoFeature<TProps>, event: Event) => void;
|
|
42
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|