@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
|
@@ -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
|