@fundar/data-chart-telling 1.16.0 → 1.18.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/CHANGELOG.md +56 -0
- package/dist/configuration/ConfigVars.svelte +14 -0
- package/dist/configuration/ConfigVars.svelte.d.ts +3 -0
- package/dist/configuration/config.svelte.d.ts +5 -0
- package/dist/configuration/config.svelte.js +20 -6
- package/dist/configuration/themes/dark.js +1 -1
- package/dist/configuration/themes/editorial.js +1 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.js +4 -1
- package/dist/layout/base/BasePlotLayout.svelte +1 -1
- package/dist/layout/figure/Figure.svelte +5 -12
- package/dist/layout/figure/FigureChrome.svelte +2 -10
- package/dist/layout/geometry/GeometryLayout.svelte +219 -44
- package/dist/layout/hover/HoverDefaults.d.ts +52 -0
- package/dist/layout/hover/HoverDefaults.js +96 -0
- package/dist/layout/hover/HoverLayers.d.ts +35 -0
- package/dist/layout/hover/HoverLayers.js +122 -0
- package/dist/layout/hover/HoverSettings.js +4 -1
- package/dist/layout/hover/HoverShapes.d.ts +44 -0
- package/dist/layout/hover/HoverShapes.js +103 -0
- package/dist/layout/hover/PlotHover.svelte.d.ts +18 -0
- package/dist/layout/hover/PlotHover.svelte.js +54 -1
- package/dist/layout/legend/DisabledStyle.d.ts +1 -1
- package/dist/layout/legend/DisabledStyle.js +1 -1
- package/dist/layout/legend/DiscreteBadgeItem.svelte +1 -1
- package/dist/layout/legend/DiscreteSection.svelte +1 -1
- package/dist/layout/legend/LegendState.svelte.d.ts +14 -2
- package/dist/layout/legend/LegendState.svelte.js +23 -4
- package/dist/layout/legend/LegendText.d.ts +4 -1
- package/dist/layout/legend/LegendText.js +7 -1
- package/dist/layout/margins/PlotMargins.svelte.d.ts +2 -2
- package/dist/layout/margins/PlotMargins.svelte.js +2 -2
- package/dist/layout/plot/Core.svelte +2 -2
- package/dist/layout/plot/Plot.svelte +4 -2
- package/dist/layout/plot/Plot.svelte.d.ts +2 -1
- package/dist/layout/plot/PublicPlotContext.d.ts +6 -0
- package/dist/layout/plot/PublicPlotContext.js +8 -0
- package/dist/layout/scales/ScalesLayout.svelte +1 -1
- package/dist/layout/styles/ValueLabels.d.ts +43 -4
- package/dist/layout/styles/ValueLabels.js +87 -19
- package/dist/layout/timeline/Timeline.svelte +5 -1
- package/dist/layout/tooltip/TooltipState.svelte.d.ts +8 -9
- package/dist/layout/tooltip/TooltipState.svelte.js +28 -29
- package/dist/markers/MarkerKinds.d.ts +5 -0
- package/dist/markers/MarkerKinds.js +1 -0
- package/dist/markers/area/AreaMarker.svelte +3 -0
- package/dist/markers/arrow/ArrowMarker.svelte +9 -5
- package/dist/markers/band/BandMarker.svelte +74 -0
- package/dist/markers/band/BandMarker.svelte.d.ts +7 -0
- package/dist/markers/band/Bands.d.ts +16 -0
- package/dist/markers/band/Bands.js +48 -0
- package/dist/markers/bar/BarMarker.svelte +50 -96
- package/dist/markers/bollinger/BollingerMarker.svelte +3 -0
- package/dist/markers/box/BoxMarker.svelte +3 -1
- package/dist/markers/cell/CellMarker.svelte +11 -7
- package/dist/markers/contour/ContourMarker.svelte +3 -0
- package/dist/markers/delaunay/DelaunayLinkMarker.svelte +9 -5
- package/dist/markers/delaunay/DelaunayMeshMarker.svelte +3 -0
- package/dist/markers/density/DensityMarker.svelte +3 -0
- package/dist/markers/difference/DifferenceMarker.svelte +3 -0
- package/dist/markers/dot/DotMarker.svelte +11 -6
- package/dist/markers/geo/GraticuleMarker.svelte +3 -0
- package/dist/markers/geo/SphereMarker.svelte +3 -0
- package/dist/markers/hover/HoverMarker.svelte +7 -249
- package/dist/markers/hover/HoverMarker.svelte.d.ts +4 -27
- package/dist/markers/hull/HullMarker.svelte +3 -0
- package/dist/markers/image/ImageMarker.svelte +3 -0
- package/dist/markers/line/LineMarker.svelte +3 -0
- package/dist/markers/link/LinkMarker.svelte +3 -0
- package/dist/markers/raster/RasterMarker.svelte +3 -0
- package/dist/markers/rect/RectMarker.svelte +25 -17
- package/dist/markers/regression/RegressionMarker.svelte +3 -0
- package/dist/markers/rule/RuleMarker.svelte +15 -5
- package/dist/markers/text/TextFit.d.ts +44 -0
- package/dist/markers/text/TextFit.js +86 -0
- package/dist/markers/text/TextMarker.svelte +186 -90
- package/dist/markers/text/TextMarker.svelte.d.ts +2 -0
- package/dist/markers/tick/TickMarker.svelte +9 -3
- package/dist/markers/trail/TrailMarker.svelte +3 -0
- package/dist/markers/utils/BoxLabel.d.ts +58 -0
- package/dist/markers/utils/BoxLabel.js +175 -0
- package/dist/markers/utils/MarkerEvents.d.ts +23 -0
- package/dist/markers/utils/MarkerEvents.js +44 -0
- package/dist/markers/utils/MarkerLabel.svelte +33 -0
- package/dist/markers/utils/MarkerLabel.svelte.d.ts +10 -0
- package/dist/markers/utils/PointPixel.d.ts +37 -0
- package/dist/markers/utils/PointPixel.js +44 -0
- package/dist/markers/utils/RowStroke.d.ts +9 -21
- package/dist/markers/utils/RowStroke.js +10 -21
- package/dist/markers/utils/RowStyle.d.ts +26 -0
- package/dist/markers/utils/RowStyle.js +55 -0
- package/dist/markers/vector/VectorMarker.svelte +3 -0
- package/dist/markers/voronoi/VoronoiMarker.svelte +9 -5
- package/dist/markers/voronoi/VoronoiMeshMarker.svelte +3 -0
- package/dist/markers/waffle/WaffleMarker.svelte +9 -5
- package/dist/phases/Pipeline.d.ts +10 -8
- package/dist/phases/Pipeline.js +13 -9
- package/dist/phases/context/ContextPhase.d.ts +22 -0
- package/dist/phases/context/ContextPhase.js +23 -0
- package/dist/phases/context/RowContext.d.ts +35 -0
- package/dist/phases/context/RowContext.js +95 -0
- package/dist/phases/data/DataPhase.d.ts +4 -4
- package/dist/phases/data/DataPhase.js +53 -12
- package/dist/phases/hover/HoverPhase.d.ts +6 -7
- package/dist/phases/hover/HoverPhase.js +28 -15
- package/dist/phases/mapping/MappingPhase.d.ts +4 -4
- package/dist/phases/mapping/MappingPhase.js +4 -3
- package/dist/phases/markers/MarkerStyles.d.ts +26 -0
- package/dist/phases/markers/MarkerStyles.js +126 -0
- package/dist/phases/markers/MarkersPhase.d.ts +5 -5
- package/dist/phases/markers/MarkersPhase.js +8 -6
- package/dist/phases/scales/ScalesPhase.d.ts +4 -4
- package/dist/phases/scales/ScalesPhase.js +4 -4
- package/dist/phases/sharedScales/SharedScalesPhase.d.ts +2 -2
- package/dist/phases/sharedScales/SharedScalesPhase.js +2 -2
- package/dist/phases/statistics/MarkerGrouping.d.ts +0 -9
- package/dist/phases/statistics/MarkerGrouping.js +0 -16
- package/dist/phases/statistics/StatisticsPhase.js +1 -1
- package/dist/phases/styles/StylesPhase.d.ts +3 -3
- package/dist/phases/styles/StylesPhase.js +2 -2
- package/dist/phases/tooltip/TooltipPhase.d.ts +4 -4
- package/dist/phases/tooltip/TooltipPhase.js +10 -7
- package/dist/phases/transforms/Transforms.js +3 -1
- package/dist/phases/transforms/TransformsPhase.d.ts +3 -3
- package/dist/phases/transforms/TransformsPhase.js +60 -6
- package/dist/phases/transforms/methods/TreemapTransform.d.ts +28 -0
- package/dist/phases/transforms/methods/TreemapTransform.js +119 -0
- package/dist/plots/correlation/heatmap/defaults.d.ts +2 -2
- package/dist/plots/correlation/heatmap/defaults.js +23 -8
- package/dist/plots/correlation/heatmap/markers.d.ts +2 -10
- package/dist/plots/correlation/heatmap/markers.js +11 -37
- package/dist/plots/correlation/scatter/defaults.d.ts +2 -2
- package/dist/plots/correlation/scatter/defaults.js +9 -3
- package/dist/plots/correlation/scatter/markers.d.ts +3 -3
- package/dist/plots/correlation/scatter/markers.js +6 -5
- package/dist/plots/distribution/box/BoxSummaries.d.ts +17 -8
- package/dist/plots/distribution/box/BoxSummaries.js +90 -40
- package/dist/plots/distribution/box/defaults.d.ts +2 -2
- package/dist/plots/distribution/box/defaults.js +9 -6
- package/dist/plots/distribution/box/markers.d.ts +2 -2
- package/dist/plots/distribution/box/markers.js +3 -3
- package/dist/plots/distribution/density/defaults.d.ts +2 -2
- package/dist/plots/distribution/density/defaults.js +17 -1
- package/dist/plots/distribution/density/markers.d.ts +2 -2
- package/dist/plots/distribution/density/markers.js +4 -4
- package/dist/plots/distribution/histogram/defaults.d.ts +2 -2
- package/dist/plots/distribution/histogram/defaults.js +22 -27
- package/dist/plots/distribution/histogram/markers.d.ts +3 -12
- package/dist/plots/distribution/histogram/markers.js +21 -62
- package/dist/plots/distribution/pyramid/defaults.d.ts +2 -2
- package/dist/plots/distribution/pyramid/defaults.js +7 -4
- package/dist/plots/distribution/pyramid/markers.d.ts +2 -12
- package/dist/plots/distribution/pyramid/markers.js +16 -66
- package/dist/plots/distribution/violin/defaults.d.ts +2 -2
- package/dist/plots/distribution/violin/defaults.js +9 -7
- package/dist/plots/distribution/violin/markers.d.ts +2 -2
- package/dist/plots/distribution/violin/markers.js +4 -4
- package/dist/plots/evolution/area/defaults.d.ts +2 -2
- package/dist/plots/evolution/area/defaults.js +1 -1
- package/dist/plots/evolution/area/markers.d.ts +2 -2
- package/dist/plots/evolution/area/markers.js +4 -4
- package/dist/plots/evolution/line/defaults.d.ts +2 -2
- package/dist/plots/evolution/line/defaults.js +1 -1
- package/dist/plots/evolution/line/markers.d.ts +2 -2
- package/dist/plots/evolution/line/markers.js +3 -3
- package/dist/plots/evolution/slope/defaults.d.ts +2 -2
- package/dist/plots/evolution/slope/defaults.js +8 -4
- package/dist/plots/evolution/slope/markers.d.ts +2 -2
- package/dist/plots/evolution/slope/markers.js +3 -3
- package/dist/plots/evolution/sparkline/defaults.d.ts +2 -2
- package/dist/plots/evolution/sparkline/defaults.js +5 -2
- package/dist/plots/evolution/sparkline/markers.d.ts +2 -2
- package/dist/plots/evolution/sparkline/markers.js +3 -3
- package/dist/plots/map/geo/Core.svelte +3 -3
- package/dist/plots/map/geo/defaults.d.ts +2 -2
- package/dist/plots/map/geo/phases/data.d.ts +1 -1
- package/dist/plots/map/geo/phases/data.js +1 -1
- package/dist/plots/map/geo/phases/hover.d.ts +2 -2
- package/dist/plots/map/geo/phases/hover.js +3 -3
- package/dist/plots/map/geo/phases/markers.d.ts +2 -2
- package/dist/plots/map/geo/phases/markers.js +5 -4
- package/dist/plots/map/geo/phases/scales.d.ts +2 -2
- package/dist/plots/map/geo/phases/scales.js +2 -2
- package/dist/plots/part-of-a-whole/treemap/Plot.svelte +47 -0
- package/dist/plots/part-of-a-whole/treemap/Plot.svelte.d.ts +26 -0
- package/dist/plots/part-of-a-whole/treemap/defaults.d.ts +10 -0
- package/dist/plots/part-of-a-whole/treemap/defaults.js +183 -0
- package/dist/plots/ranking/bar/defaults.d.ts +2 -2
- package/dist/plots/ranking/bar/defaults.js +15 -9
- package/dist/plots/ranking/bar/markers.d.ts +4 -14
- package/dist/plots/ranking/bar/markers.js +45 -86
- package/dist/plots/ranking/bullet/defaults.d.ts +2 -2
- package/dist/plots/ranking/bullet/defaults.js +4 -4
- package/dist/plots/ranking/bullet/markers.d.ts +3 -3
- package/dist/plots/ranking/bullet/markers.js +11 -12
- package/dist/plots/ranking/cleveland/ClevelandMarkers.d.ts +3 -3
- package/dist/plots/ranking/cleveland/ClevelandMarkers.js +28 -23
- package/dist/plots/ranking/cleveland/defaults.d.ts +2 -2
- package/dist/plots/ranking/cleveland/defaults.js +7 -4
- package/dist/plots/ranking/dumbbell/defaults.d.ts +2 -2
- package/dist/plots/ranking/forest/defaults.d.ts +2 -2
- package/dist/plots/ranking/lollipop/defaults.d.ts +2 -2
- package/dist/types/configuration/styling.d.ts +31 -2
- package/dist/types/layout/context.d.ts +21 -0
- package/dist/types/layout/context.js +1 -0
- package/dist/types/layout/hover.d.ts +3 -0
- package/dist/types/layout/legend.d.ts +8 -1
- package/dist/types/layout/mapping.d.ts +12 -3
- package/dist/types/layout/scales.d.ts +6 -0
- package/dist/types/layout/styles/values.d.ts +8 -2
- package/dist/types/layout/tooltip.d.ts +11 -4
- package/dist/types/markers/axis/arrow.d.ts +2 -8
- package/dist/types/markers/axis/axisBasedMarkersConfig.d.ts +2 -1
- package/dist/types/markers/axis/band.d.ts +24 -0
- package/dist/types/markers/axis/band.js +1 -0
- package/dist/types/markers/axis/bar.d.ts +6 -10
- package/dist/types/markers/axis/cell.d.ts +5 -5
- package/dist/types/markers/axis/delaunayLink.d.ts +2 -2
- package/dist/types/markers/axis/hover.d.ts +60 -15
- package/dist/types/markers/axis/rect.d.ts +4 -8
- package/dist/types/markers/axis/rule.d.ts +2 -16
- package/dist/types/markers/axis/tick.d.ts +2 -2
- package/dist/types/markers/axis/voronoi.d.ts +2 -2
- package/dist/types/markers/axis/waffle.d.ts +4 -3
- package/dist/types/markers/basic/dot.d.ts +2 -2
- package/dist/types/markers/basic/text.d.ts +56 -14
- package/dist/types/markers/channels/commonMarkerConfig.d.ts +8 -1
- package/dist/types/markers/channels/commonMarkerConfigWithArea.d.ts +1 -2
- package/dist/types/markers/channels/commonMarkerConfigWithLabel.d.ts +10 -0
- package/dist/types/markers/channels/commonMarkerConfigWithLabel.js +1 -0
- package/dist/types/markers/channels/commonMarkerEvents.d.ts +17 -0
- package/dist/types/markers/channels/commonMarkerEvents.js +13 -0
- package/dist/types/markers/common.d.ts +1 -0
- package/dist/types/markers/common.js +1 -0
- package/dist/types/markers/geo/contour.d.ts +2 -1
- package/dist/types/markers/geo/graticule.d.ts +2 -1
- package/dist/types/markers/geo/link.d.ts +2 -1
- package/dist/types/markers/geo/sphere.d.ts +2 -1
- package/dist/types/markers/geo/vector.d.ts +2 -1
- package/dist/types/phases/context/phase.d.ts +7 -0
- package/dist/types/phases/context/phase.js +1 -0
- package/dist/types/phases/data/phase.d.ts +7 -2
- package/dist/types/phases/hover/phase.d.ts +10 -5
- package/dist/types/phases/index.d.ts +2 -1
- package/dist/types/phases/kind.d.ts +11 -8
- package/dist/types/phases/mapping/phase.d.ts +2 -2
- package/dist/types/phases/markers/phase.d.ts +3 -3
- package/dist/types/phases/scales/phase.d.ts +4 -4
- package/dist/types/phases/stage.d.ts +3 -3
- package/dist/types/phases/state.d.ts +8 -1
- package/dist/types/phases/statistics/phase.d.ts +2 -1
- package/dist/types/phases/styles/phase.d.ts +3 -2
- package/dist/types/phases/transforms/phase.d.ts +13 -2
- package/dist/types/plots/constants.d.ts +17 -19
- package/dist/types/plots/correlation/heatmap/props.d.ts +3 -3
- package/dist/types/plots/correlation/heatmap/state.d.ts +2 -2
- package/dist/types/plots/correlation/scatter/props.d.ts +3 -3
- package/dist/types/plots/correlation/scatter/state.d.ts +2 -2
- package/dist/types/plots/data/common.d.ts +19 -6
- package/dist/types/plots/data/geo.d.ts +1 -1
- package/dist/types/plots/distribution/box/props.d.ts +25 -3
- package/dist/types/plots/distribution/box/state.d.ts +6 -17
- package/dist/types/plots/distribution/density/props.d.ts +3 -11
- package/dist/types/plots/distribution/density/state.d.ts +2 -2
- package/dist/types/plots/distribution/histogram/props.d.ts +16 -11
- package/dist/types/plots/distribution/histogram/state.d.ts +2 -2
- package/dist/types/plots/distribution/pyramid/props.d.ts +3 -3
- package/dist/types/plots/distribution/pyramid/state.d.ts +2 -2
- package/dist/types/plots/distribution/violin/props.d.ts +4 -3
- package/dist/types/plots/distribution/violin/state.d.ts +2 -2
- package/dist/types/plots/evolution/area/props.d.ts +3 -3
- package/dist/types/plots/evolution/area/state.d.ts +2 -2
- package/dist/types/plots/evolution/line/props.d.ts +3 -3
- package/dist/types/plots/evolution/line/state.d.ts +2 -2
- package/dist/types/plots/evolution/slope/state.d.ts +2 -2
- package/dist/types/plots/evolution/sparkline/state.d.ts +2 -2
- package/dist/types/plots/map/geo/state.d.ts +1 -1
- package/dist/types/plots/part-of-a-whole/treemap/props.d.ts +29 -0
- package/dist/types/plots/part-of-a-whole/treemap/props.js +1 -0
- package/dist/types/plots/part-of-a-whole/treemap/state.d.ts +6 -0
- package/dist/types/plots/part-of-a-whole/treemap/state.js +1 -0
- package/dist/types/plots/props.d.ts +10 -4
- package/dist/types/plots/ranking/bar/props.d.ts +3 -3
- package/dist/types/plots/ranking/bar/state.d.ts +2 -2
- package/dist/types/plots/ranking/bullet/state.d.ts +2 -2
- package/dist/types/plots/ranking/cleveland/props.d.ts +3 -3
- package/dist/types/plots/ranking/cleveland/state.d.ts +2 -2
- package/dist/types/plots/ranking/dumbbell/props.d.ts +3 -3
- package/dist/types/plots/ranking/dumbbell/state.d.ts +2 -2
- package/dist/types/plots/ranking/forest/props.d.ts +3 -3
- package/dist/types/plots/ranking/forest/state.d.ts +2 -2
- package/dist/types/plots/ranking/lollipop/props.d.ts +3 -3
- package/dist/types/plots/ranking/lollipop/state.d.ts +2 -2
- package/dist/types/plots/styling.d.ts +24 -0
- package/dist/types/transforms/index.d.ts +3 -1
- package/dist/types/transforms/treemap.d.ts +32 -0
- package/dist/types/transforms/treemap.js +5 -0
- package/dist/utils/color/ColorTones.d.ts +19 -0
- package/dist/utils/color/ColorTones.js +64 -0
- package/dist/utils/color/CssColor.d.ts +14 -5
- package/dist/utils/color/CssColor.js +69 -27
- package/dist/utils/color/index.d.ts +4 -0
- package/dist/utils/color/index.js +4 -0
- package/dist/utils/grouping.d.ts +18 -1
- package/dist/utils/grouping.js +31 -0
- package/docs/concepts.md +3 -2
- package/docs/legend.md +8 -5
- package/docs/markers.md +110 -28
- package/docs/plots/evolution/line.md +1 -1
- package/docs/plots/evolution/slope.md +1 -1
- package/docs/plots/part-of-a-whole/treemap.md +103 -0
- package/docs/plots/ranking/bar.md +2 -1
- package/docs/plots/ranking/cleveland.md +1 -1
- package/docs/plots.md +21 -20
- package/docs/scales.md +3 -0
- package/docs/state.md +34 -1
- package/docs/styles-and-segments.md +20 -19
- package/docs/theming.md +6 -12
- package/docs/tooltip-and-hover.md +81 -3
- package/docs/transforms-and-statistics.md +17 -16
- package/examples/LineDates.svelte +1 -1
- package/examples/ResponsiveLine.svelte +3 -1
- package/examples/Treemap.svelte +13 -0
- package/examples/TreemapHover.svelte +25 -0
- package/examples/ValueLabels.svelte +1 -1
- package/examples/datasets/economic-activity.ts +40 -0
- package/examples/datasets/index.ts +1 -0
- package/llms-full.txt +11 -9
- package/llms.txt +4 -1
- package/package.json +3 -1
|
@@ -8,11 +8,11 @@ import { ViolinProfiles } from '../../../markers/violin/ViolinProfiles';
|
|
|
8
8
|
* by side. The markers the "statistics" phase already put in `state.markers`
|
|
9
9
|
* come after, so they render on top.
|
|
10
10
|
*/
|
|
11
|
-
export function buildMarks(state,
|
|
11
|
+
export function buildMarks(state, env) {
|
|
12
12
|
const processed = state.processedData;
|
|
13
13
|
if (!processed)
|
|
14
14
|
return [];
|
|
15
|
-
const { cfg } =
|
|
15
|
+
const { cfg } = env;
|
|
16
16
|
const styles = state.styles;
|
|
17
17
|
const { channels } = processed;
|
|
18
18
|
const groups = state.processedGroups ?? [];
|
|
@@ -29,10 +29,10 @@ export function buildMarks(state, ctx) {
|
|
|
29
29
|
: typeof styles?.box === 'number'
|
|
30
30
|
? styles.box
|
|
31
31
|
: cfg.violin.boxWidth;
|
|
32
|
-
const ink =
|
|
32
|
+
const ink = 'currentColor';
|
|
33
33
|
const violins = groups.flatMap((group, index) => {
|
|
34
34
|
const name = group.series.name;
|
|
35
|
-
const disabled =
|
|
35
|
+
const disabled = env.interaction?.fillFor(name);
|
|
36
36
|
return group.visualSegments.map((seg) => ({
|
|
37
37
|
type: 'violin',
|
|
38
38
|
series: name,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AxisPlotDefaults } from '../../../types/phases';
|
|
2
|
-
import type { AreaPlotState,
|
|
2
|
+
import type { AreaPlotState, AreaPlotEnv } from '../../../types/plots/evolution/area/state';
|
|
3
3
|
/** AreaPlot on the shared pipeline: areas from a zero baseline, author markers taking the plot's `x`/`y`, and its own markers. Its plot defaults to: hover along x, cumulative timeline tweening `y` per series. */
|
|
4
|
-
export declare function buildAreaDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<AreaPlotState<TData>,
|
|
4
|
+
export declare function buildAreaDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<AreaPlotState<TData>, AreaPlotEnv>;
|
|
@@ -12,7 +12,7 @@ export function buildAreaDefaults() {
|
|
|
12
12
|
styles: {
|
|
13
13
|
values: {
|
|
14
14
|
anchor: 'start',
|
|
15
|
-
format: (v,
|
|
15
|
+
format: (v, number, context) => `${context.series} - ${number(v)}`,
|
|
16
16
|
reach: (labels, state) => labels.reachAtSeriesEnds(state)
|
|
17
17
|
}
|
|
18
18
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AreaPlotState,
|
|
1
|
+
import type { AreaPlotState, AreaPlotEnv } from '../../../types/plots/evolution/area/state';
|
|
2
2
|
import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
|
|
3
3
|
/**
|
|
4
4
|
* AreaPlot's "markers" phase: one `area` per visual segment of each series,
|
|
@@ -11,4 +11,4 @@ import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
|
|
|
11
11
|
* another series' value label, dims its own areas' fill to
|
|
12
12
|
* `legend.disabledOpacity`, in place, so a stack keeps its full extent.
|
|
13
13
|
*/
|
|
14
|
-
export declare function buildMarks<TData extends Record<string, unknown>>(state: AreaPlotState<TData>,
|
|
14
|
+
export declare function buildMarks<TData extends Record<string, unknown>>(state: AreaPlotState<TData>, env: AreaPlotEnv): AxisBasedMarkersConfig[];
|
|
@@ -10,17 +10,17 @@ import { Transforms } from '../../../phases/transforms/Transforms';
|
|
|
10
10
|
* another series' value label, dims its own areas' fill to
|
|
11
11
|
* `legend.disabledOpacity`, in place, so a stack keeps its full extent.
|
|
12
12
|
*/
|
|
13
|
-
export function buildMarks(state,
|
|
13
|
+
export function buildMarks(state, env) {
|
|
14
14
|
const { resolvedSeries = [] } = state;
|
|
15
15
|
const { channels, options, transforms } = state.processedData;
|
|
16
|
-
const { cfg } =
|
|
16
|
+
const { cfg } = env;
|
|
17
17
|
// A fill opacity per series name, for the dim: a legend-off series fades to
|
|
18
18
|
// the legend's disabled opacity, every other one keeps the area default.
|
|
19
19
|
const fillOpacityOf = (name) => {
|
|
20
|
-
const off =
|
|
20
|
+
const off = env.interaction?.dimmed(name);
|
|
21
21
|
return off ? (off.opacity ?? cfg.legend.disabledOpacity) : cfg.area.fillOpacity;
|
|
22
22
|
};
|
|
23
|
-
const dimmed = resolvedSeries.some((s) =>
|
|
23
|
+
const dimmed = resolvedSeries.some((s) => env.interaction?.dimmed(s.name));
|
|
24
24
|
const opacityScale = {
|
|
25
25
|
range: Object.fromEntries(resolvedSeries.map((s) => [s.name, fillOpacityOf(s.name)]))
|
|
26
26
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AxisPlotDefaults } from '../../../types/phases';
|
|
2
|
-
import type { LinePlotState,
|
|
2
|
+
import type { LinePlotState, LinePlotEnv } from '../../../types/plots/evolution/line/state';
|
|
3
3
|
/** LinePlot on the shared pipeline: continuous segments colored by their stroke, and its own markers. Its plot defaults to: hover along x, cumulative timeline tweening `y` per series. */
|
|
4
|
-
export declare function buildLineDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<LinePlotState<TData>,
|
|
4
|
+
export declare function buildLineDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<LinePlotState<TData>, LinePlotEnv>;
|
|
@@ -23,7 +23,7 @@ export function buildLineDefaults() {
|
|
|
23
23
|
styles: {
|
|
24
24
|
values: {
|
|
25
25
|
anchor: 'start',
|
|
26
|
-
format: (v,
|
|
26
|
+
format: (v, number, context) => `${context.series} - ${number(v)}`,
|
|
27
27
|
reach: (labels, state) => labels.reachAtSeriesEnds(state)
|
|
28
28
|
}
|
|
29
29
|
},
|
|
@@ -4,7 +4,7 @@ import type { LineSegmentStyle } from '../../../types/plots/segments/common';
|
|
|
4
4
|
import type { VisualGroup } from '../../../types/plots/segments/config';
|
|
5
5
|
import type { StrokeStyle, DotStyle } from '../../../types/plots/styling';
|
|
6
6
|
import type { LineMarkerConfig, DotMarkerConfig } from '../../../types/markers/common';
|
|
7
|
-
import type { LinePlotState,
|
|
7
|
+
import type { LinePlotState, LinePlotEnv } from '../../../types/plots/evolution/line/state';
|
|
8
8
|
import type { CurveName } from '../../../types/layout/styles/curve';
|
|
9
9
|
import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
|
|
10
10
|
/**
|
|
@@ -49,4 +49,4 @@ export declare function buildGapMarkers<TData extends Record<string, unknown>>(a
|
|
|
49
49
|
* whatever the "statistics" phase already put in `state.markers` - and its
|
|
50
50
|
* value labels on top of everything.
|
|
51
51
|
*/
|
|
52
|
-
export declare function buildMarks<TData extends Record<string, unknown>>(state: LinePlotState<TData>,
|
|
52
|
+
export declare function buildMarks<TData extends Record<string, unknown>>(state: LinePlotState<TData>, env: LinePlotEnv): AxisBasedMarkersConfig[];
|
|
@@ -178,10 +178,10 @@ export function buildGapMarkers(args) {
|
|
|
178
178
|
* whatever the "statistics" phase already put in `state.markers` - and its
|
|
179
179
|
* value labels on top of everything.
|
|
180
180
|
*/
|
|
181
|
-
export function buildMarks(state,
|
|
181
|
+
export function buildMarks(state, env) {
|
|
182
182
|
const { colorForSeries, gaps } = state;
|
|
183
|
-
const disabledStrokeFor = (name) =>
|
|
184
|
-
const disabledDotsFor = (name) =>
|
|
183
|
+
const disabledStrokeFor = (name) => env.interaction?.strokeFor(name);
|
|
184
|
+
const disabledDotsFor = (name) => env.interaction?.dotsFor(name);
|
|
185
185
|
const groups = state.processedGroups ?? [];
|
|
186
186
|
const lineMarkers = buildLineMarkers({
|
|
187
187
|
groupedSeries: groups,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AxisPlotDefaults } from '../../../types/phases';
|
|
2
|
-
import type { SlopePlotState,
|
|
2
|
+
import type { SlopePlotState, SlopePlotEnv } from '../../../types/plots/evolution/slope/state';
|
|
3
3
|
/**
|
|
4
4
|
* SlopePlot on the shared pipeline: a LinePlot over a category axis of a few
|
|
5
5
|
* positions - two, for a slope - with a dot on every point and its first and
|
|
6
6
|
* last labelled, each before or after it.
|
|
7
7
|
*/
|
|
8
|
-
export declare function buildSlopeDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<SlopePlotState<TData>,
|
|
8
|
+
export declare function buildSlopeDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<SlopePlotState<TData>, SlopePlotEnv>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { buildMarks, buildValueLabels } from './markers';
|
|
2
|
+
import { PlotAxes } from '../../../phases/data/PlotAxes';
|
|
3
|
+
import { HoverDefaults } from '../../../layout/hover/HoverDefaults';
|
|
2
4
|
import { ValueLabels } from '../../../layout/styles/ValueLabels';
|
|
3
5
|
import { buildLineDefaults } from '../line/defaults';
|
|
4
6
|
/**
|
|
@@ -15,17 +17,19 @@ export function buildSlopeDefaults() {
|
|
|
15
17
|
scales: {
|
|
16
18
|
bandOrder: 'data',
|
|
17
19
|
// The labels give the values, so the value axis stays out of their way.
|
|
18
|
-
defaults: (_state,
|
|
19
|
-
category: { type: 'point', padding:
|
|
20
|
+
defaults: (_state, env) => ({
|
|
21
|
+
category: { type: 'point', padding: env.cfg.slope.padding },
|
|
20
22
|
value: { axisDisplay: 'none' }
|
|
21
23
|
})
|
|
22
24
|
},
|
|
23
25
|
styles: {
|
|
24
26
|
values: {
|
|
25
27
|
anchor: 'start',
|
|
26
|
-
format: (v,
|
|
28
|
+
format: (v, number, context) => `${context.series} - ${number(v)}`
|
|
27
29
|
}
|
|
28
30
|
},
|
|
29
|
-
markers: { marks: buildMarks, valueLabels: buildValueLabels }
|
|
31
|
+
markers: { marks: buildMarks, valueLabels: buildValueLabels },
|
|
32
|
+
// Only two positions: a rule along the value axis at the hovered point says more than one across them.
|
|
33
|
+
hover: { ...line.hover, marker: (state) => HoverDefaults.valueRule(PlotAxes.valueOf(state)) }
|
|
30
34
|
};
|
|
31
35
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ValueLabels } from '../../../layout/styles/ValueLabels';
|
|
2
2
|
import type { EdgeBox } from '../../../types/layout/box';
|
|
3
3
|
import type { AxisBasedMarkersConfig, TextMarkerConfig } from '../../../types/markers/common';
|
|
4
|
-
import type { SlopePlotState,
|
|
4
|
+
import type { SlopePlotState, SlopePlotEnv } from '../../../types/plots/evolution/slope/state';
|
|
5
5
|
/**
|
|
6
6
|
* SlopePlot's "markers" phase: each series' line, with a dot on every point
|
|
7
7
|
* (a slope has few), over the rows the "transforms" phase left.
|
|
8
8
|
*/
|
|
9
|
-
export declare function buildMarks<TData extends Record<string, unknown>>(state: SlopePlotState<TData>,
|
|
9
|
+
export declare function buildMarks<TData extends Record<string, unknown>>(state: SlopePlotState<TData>, env: SlopePlotEnv): AxisBasedMarkersConfig[];
|
|
10
10
|
/**
|
|
11
11
|
* SlopePlot's value labels: the series' first points labelled before them and
|
|
12
12
|
* its last ones after, each end spread apart where its labels would overlap.
|
|
@@ -11,7 +11,7 @@ const keyOf = (value) => (value instanceof Date ? value.getTime() : value);
|
|
|
11
11
|
* SlopePlot's "markers" phase: each series' line, with a dot on every point
|
|
12
12
|
* (a slope has few), over the rows the "transforms" phase left.
|
|
13
13
|
*/
|
|
14
|
-
export function buildMarks(state,
|
|
14
|
+
export function buildMarks(state, env) {
|
|
15
15
|
const { slope } = getConfiguration();
|
|
16
16
|
const groups = (state.processedGroups ?? []).map((group) => ({
|
|
17
17
|
...group,
|
|
@@ -27,8 +27,8 @@ export function buildMarks(state, ctx) {
|
|
|
27
27
|
return buildLineMarkers({
|
|
28
28
|
groupedSeries: groups,
|
|
29
29
|
colorFor: state.colorForSeries,
|
|
30
|
-
disabledStrokeFor: (name) =>
|
|
31
|
-
disabledDotsFor: (name) =>
|
|
30
|
+
disabledStrokeFor: (name) => env.interaction?.strokeFor(name),
|
|
31
|
+
disabledDotsFor: (name) => env.interaction?.dotsFor(name),
|
|
32
32
|
curve: state.styles?.curve
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AxisPlotDefaults } from '../../../types/phases';
|
|
2
|
-
import type { SparklinePlotState,
|
|
2
|
+
import type { SparklinePlotState, SparklinePlotEnv } from '../../../types/plots/evolution/sparkline/state';
|
|
3
3
|
/**
|
|
4
4
|
* SparklinePlot on the shared pipeline: a LinePlot with its axes left out, a
|
|
5
5
|
* thin line, and a dot and value on the last point of each series.
|
|
6
6
|
*/
|
|
7
|
-
export declare function buildSparklineDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<SparklinePlotState<TData>,
|
|
7
|
+
export declare function buildSparklineDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<SparklinePlotState<TData>, SparklinePlotEnv>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { buildMarks } from './markers';
|
|
2
|
+
import { HoverDefaults } from '../../../layout/hover/HoverDefaults';
|
|
2
3
|
import { ValueLabels } from '../../../layout/styles/ValueLabels';
|
|
3
4
|
import { buildLineDefaults } from '../line/defaults';
|
|
4
5
|
/**
|
|
@@ -15,9 +16,11 @@ export function buildSparklineDefaults() {
|
|
|
15
16
|
values: {
|
|
16
17
|
...line.styles?.values,
|
|
17
18
|
show: true,
|
|
18
|
-
format: (value,
|
|
19
|
+
format: (value, number) => number(value)
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
|
-
markers: { marks: buildMarks, valueLabels: line.markers.valueLabels }
|
|
22
|
+
markers: { marks: buildMarks, valueLabels: line.markers.valueLabels },
|
|
23
|
+
// Small and bare: a dot on the hovered point, and nothing else.
|
|
24
|
+
hover: { ...line.hover, marker: () => ({ back: [], front: [HoverDefaults.dot()] }) }
|
|
22
25
|
};
|
|
23
26
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AxisBasedMarkersConfig } from '../../../types/markers/common';
|
|
2
|
-
import type { SparklinePlotState,
|
|
2
|
+
import type { SparklinePlotState, SparklinePlotEnv } from '../../../types/plots/evolution/sparkline/state';
|
|
3
3
|
/**
|
|
4
4
|
* SparklinePlot's "markers" phase: each series' line, thin, and a dot on its
|
|
5
5
|
* last point with a value.
|
|
6
6
|
*/
|
|
7
|
-
export declare function buildMarks<TData extends Record<string, unknown>>(state: SparklinePlotState<TData>,
|
|
7
|
+
export declare function buildMarks<TData extends Record<string, unknown>>(state: SparklinePlotState<TData>, env: SparklinePlotEnv): AxisBasedMarkersConfig[];
|
|
@@ -6,10 +6,10 @@ import { isGapValue } from '../../utils/gaps';
|
|
|
6
6
|
* SparklinePlot's "markers" phase: each series' line, thin, and a dot on its
|
|
7
7
|
* last point with a value.
|
|
8
8
|
*/
|
|
9
|
-
export function buildMarks(state,
|
|
9
|
+
export function buildMarks(state, env) {
|
|
10
10
|
const { sparkline } = getConfiguration();
|
|
11
11
|
const groups = state.processedGroups ?? [];
|
|
12
|
-
const disabledDotsFor = (name) =>
|
|
12
|
+
const disabledDotsFor = (name) => env.interaction?.dotsFor(name);
|
|
13
13
|
const lines = buildLineMarkers({
|
|
14
14
|
groupedSeries: groups.map((group) => ({
|
|
15
15
|
...group,
|
|
@@ -22,7 +22,7 @@ export function buildMarks(state, ctx) {
|
|
|
22
22
|
}))
|
|
23
23
|
})),
|
|
24
24
|
colorFor: state.colorForSeries,
|
|
25
|
-
disabledStrokeFor: (name) =>
|
|
25
|
+
disabledStrokeFor: (name) => env.interaction?.strokeFor(name),
|
|
26
26
|
disabledDotsFor,
|
|
27
27
|
curve: state.styles?.curve
|
|
28
28
|
});
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import BasePlotLayout from '../../../layout/base/BasePlotLayout.svelte';
|
|
8
8
|
import type { GeoPlotCoreProps } from '../../../types/plots/map/geo/props';
|
|
9
9
|
import type { CoordinatesConfig } from '../../../types/layout/coordinates';
|
|
10
|
-
import type { GeoPlotState,
|
|
10
|
+
import type { GeoPlotState, GeoPlotEnv } from '../../../types/plots/map/geo/state';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* A map from GeoJSON or TopoJSON. `segments` styles features by id,
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
y: { domain: [90, -90] }
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
const
|
|
79
|
+
const env = $derived<GeoPlotEnv<TProps>>({
|
|
80
80
|
cfg,
|
|
81
81
|
range,
|
|
82
82
|
fill: styles.fill,
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
height,
|
|
104
104
|
margins
|
|
105
105
|
},
|
|
106
|
-
|
|
106
|
+
env
|
|
107
107
|
) as GeoPlotState<TProps>
|
|
108
108
|
);
|
|
109
109
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GeoPlotState,
|
|
1
|
+
import type { GeoPlotState, GeoPlotEnv } from '../../../types/plots/map/geo/state';
|
|
2
2
|
import { Pipeline } from '../../../phases/Pipeline';
|
|
3
3
|
/** GeoPlot's own pipeline (data, scales, markers, tooltip, hover), run over the state its core seeds, hovering one feature at a time. */
|
|
4
|
-
export declare function buildGeoDefaults<TProps extends Record<string, unknown>>(): Pipeline<GeoPlotState<TProps>,
|
|
4
|
+
export declare function buildGeoDefaults<TProps extends Record<string, unknown>>(): Pipeline<GeoPlotState<TProps>, GeoPlotEnv<TProps>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GeoPlotState } from '../../../../types/plots/map/geo/state';
|
|
2
2
|
/**
|
|
3
3
|
* GeoPlot's "data" phase: every feature tagged with its resolved id/centroid,
|
|
4
|
-
* then reduced by `excludeParts`. Reads no
|
|
4
|
+
* then reduced by `excludeParts`. Reads no env.
|
|
5
5
|
*/
|
|
6
6
|
export declare function buildData<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>): GeoPlotState<TProps>;
|
|
@@ -3,7 +3,7 @@ import { GeoGeometry } from '../GeoGeometry';
|
|
|
3
3
|
import { GeoFeatures } from '../GeoFeatures.svelte';
|
|
4
4
|
/**
|
|
5
5
|
* GeoPlot's "data" phase: every feature tagged with its resolved id/centroid,
|
|
6
|
-
* then reduced by `excludeParts`. Reads no
|
|
6
|
+
* then reduced by `excludeParts`. Reads no env.
|
|
7
7
|
*/
|
|
8
8
|
export function buildData(state) {
|
|
9
9
|
const { rawFeatures, featureId, excludeParts } = state;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GeoPlotState,
|
|
1
|
+
import type { GeoPlotState, GeoPlotEnv } from '../../../../types/plots/map/geo/state';
|
|
2
2
|
/** Whether a pointer event is over an `inset` marker's panel, which has its own hover. */
|
|
3
3
|
export declare function isOverInset(e: PointerEvent): boolean;
|
|
4
4
|
/**
|
|
@@ -6,4 +6,4 @@ export declare function isOverInset(e: PointerEvent): boolean;
|
|
|
6
6
|
* feature under the cursor and read as its id. A feature outside the active
|
|
7
7
|
* legend range stays drawn, dimmed, but is never a candidate.
|
|
8
8
|
*/
|
|
9
|
-
export declare function buildHover<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>,
|
|
9
|
+
export declare function buildHover<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>, env: GeoPlotEnv<TProps>): GeoPlotState<TProps>;
|
|
@@ -10,9 +10,9 @@ export function isOverInset(e) {
|
|
|
10
10
|
* feature under the cursor and read as its id. A feature outside the active
|
|
11
11
|
* legend range stays drawn, dimmed, but is never a candidate.
|
|
12
12
|
*/
|
|
13
|
-
export function buildHover(state,
|
|
13
|
+
export function buildHover(state, env) {
|
|
14
14
|
const { color, tooltip, authoredMarkers } = state;
|
|
15
|
-
const { range } =
|
|
15
|
+
const { range } = env;
|
|
16
16
|
const features = state.features;
|
|
17
17
|
const label = (f) => f.__id;
|
|
18
18
|
const points = features
|
|
@@ -28,7 +28,7 @@ export function buildHover(state, ctx) {
|
|
|
28
28
|
defaultStrategy: 'punctual',
|
|
29
29
|
// Match the feature under the cursor, not the nearest centroid.
|
|
30
30
|
pointMatching: 'contains',
|
|
31
|
-
number: NumberFormat.of(NumberFormat.displayOf(tooltip),
|
|
31
|
+
number: NumberFormat.of(NumberFormat.displayOf(tooltip), env.cfg)
|
|
32
32
|
}),
|
|
33
33
|
// A map has no axes for a crosshair: 'punctual' only means an exact match.
|
|
34
34
|
strategy: 'punctual',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GeoPlotState,
|
|
1
|
+
import type { GeoPlotState, GeoPlotEnv } from '../../../../types/plots/map/geo/state';
|
|
2
2
|
/**
|
|
3
3
|
* GeoPlot's "markers" phase: per-feature style resolution/grouping, the base
|
|
4
4
|
* `'geo'` marker(s), and the full draw order - any authored marker with
|
|
@@ -6,4 +6,4 @@ import type { GeoPlotState, GeoPlotCtx } from '../../../../types/plots/map/geo/s
|
|
|
6
6
|
* with any `hover` marker moved last. The base marker(s) match the pointer
|
|
7
7
|
* themselves, over the features inside the legend's range.
|
|
8
8
|
*/
|
|
9
|
-
export declare function buildMarkers<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>,
|
|
9
|
+
export declare function buildMarkers<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>, env: GeoPlotEnv<TProps>): GeoPlotState<TProps>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MarkerStyles } from '../../../../phases/markers/MarkerStyles';
|
|
1
2
|
import { LegendState } from '../../../../layout/legend/LegendState.svelte';
|
|
2
3
|
import { GeoSegments } from '../GeoSegments';
|
|
3
4
|
import { MarkerChannels } from '../../../../markers/utils/MarkerChannels';
|
|
@@ -18,9 +19,9 @@ function isBehindMarker(marker) {
|
|
|
18
19
|
* with any `hover` marker moved last. The base marker(s) match the pointer
|
|
19
20
|
* themselves, over the features inside the legend's range.
|
|
20
21
|
*/
|
|
21
|
-
export function buildMarkers(state,
|
|
22
|
+
export function buildMarkers(state, env) {
|
|
22
23
|
const { features, segments, authoredMarkers, color, grouping, resolveColor, resolveOpacity } = state;
|
|
23
|
-
const { range, fill, fillOpacity, stroke, strokeWidth, cfg, onFeatureClick } =
|
|
24
|
+
const { range, fill, fillOpacity, stroke, strokeWidth, cfg, onFeatureClick } = env;
|
|
24
25
|
const OPACITY_STEPS = 32;
|
|
25
26
|
function rangeFilteredStyle(base, f) {
|
|
26
27
|
if (range == null || !color)
|
|
@@ -58,7 +59,7 @@ export function buildMarkers(state, ctx) {
|
|
|
58
59
|
data: group.data,
|
|
59
60
|
fill: (d) => group.style.fill ?? resolveBaseFill(d),
|
|
60
61
|
fillOpacity: group.style.fillOpacity ?? group.opacity ?? fillOpacity ?? 1,
|
|
61
|
-
stroke: group.style.stroke ?? stroke ??
|
|
62
|
+
stroke: group.style.stroke ?? stroke ?? 'currentColor',
|
|
62
63
|
strokeWidth: group.style.strokeWidth ?? strokeWidth ?? 0.5,
|
|
63
64
|
hover: hoverable,
|
|
64
65
|
onclick: onFeatureClick ? (e, d) => onFeatureClick(d, e) : undefined
|
|
@@ -66,6 +67,6 @@ export function buildMarkers(state, ctx) {
|
|
|
66
67
|
const behindMarkers = authoredMarkers.filter(isBehindMarker);
|
|
67
68
|
const frontMarkers = authoredMarkers.filter((m) => !isBehindMarker(m) && m.type !== 'geo-hover');
|
|
68
69
|
const hoverMarker = authoredMarkers.find((m) => m.type === 'geo-hover');
|
|
69
|
-
const markers = MarkerChannels.inheritAll([...behindMarkers, ...featureMarkers, ...frontMarkers, ...(hoverMarker ? [hoverMarker] : [])], state.scales);
|
|
70
|
+
const markers = MarkerStyles.resolveAll(MarkerChannels.inheritAll([...behindMarkers, ...featureMarkers, ...frontMarkers, ...(hoverMarker ? [hoverMarker] : [])], state.scales), { cfg: env.cfg });
|
|
70
71
|
return { ...state, markers, styleGroups };
|
|
71
72
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GeoPlotState,
|
|
1
|
+
import type { GeoPlotState, GeoPlotEnv } from '../../../../types/plots/map/geo/state';
|
|
2
2
|
/**
|
|
3
3
|
* GeoPlot's "scales" phase: each feature's own resolved color (mirrors
|
|
4
4
|
* HeatmapPlot's own), with a per-feature override for whichever segment
|
|
@@ -7,4 +7,4 @@ import type { GeoPlotState, GeoPlotCtx } from '../../../../types/plots/map/geo/s
|
|
|
7
7
|
* the features that share its own key, so e.g. two grouping buckets each
|
|
8
8
|
* get a ramp scaled to their own value range, not the whole dataset's.
|
|
9
9
|
*/
|
|
10
|
-
export declare function buildScales<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>,
|
|
10
|
+
export declare function buildScales<TProps extends Record<string, unknown>>(state: GeoPlotState<TProps>, env: GeoPlotEnv<TProps>): GeoPlotState<TProps>;
|
|
@@ -10,9 +10,9 @@ import { GeoSegments } from '../GeoSegments';
|
|
|
10
10
|
* the features that share its own key, so e.g. two grouping buckets each
|
|
11
11
|
* get a ramp scaled to their own value range, not the whole dataset's.
|
|
12
12
|
*/
|
|
13
|
-
export function buildScales(state,
|
|
13
|
+
export function buildScales(state, env) {
|
|
14
14
|
const { scales, features, color, grouping, opacity, segments } = state;
|
|
15
|
-
const { range, cfg } =
|
|
15
|
+
const { range, cfg } = env;
|
|
16
16
|
const colorValues = color
|
|
17
17
|
? features.map((f) => color(f)).filter((v) => v != null)
|
|
18
18
|
: [];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts" generics="TData extends Record<string, unknown>">
|
|
2
|
+
import Plot from '../../../layout/plot/Plot.svelte';
|
|
3
|
+
import { buildTreemapDefaults } from './defaults';
|
|
4
|
+
import type {
|
|
5
|
+
TreemapPlotProps,
|
|
6
|
+
TreemapPlotCoreProps
|
|
7
|
+
} from '../../../types/plots/part-of-a-whole/treemap/props';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A part-to-whole of rectangles: each row is a tile whose area is its `value`, nested by `grouping` - a field,
|
|
11
|
+
* or the fields of several levels joined by dots (`'sector.branch'`), outermost first, whose last names the
|
|
12
|
+
* tile. The outermost level colors the tiles and is what the legend lists; each tile is labelled with its name
|
|
13
|
+
* and its share of the whole, cut short or left out where it does not fit (`styles.values`). Optional chrome
|
|
14
|
+
* (`title`, `subtitle`, `caption`, `header`, `footer`, `legend`) frames it; `timeline` and `facet` slice its
|
|
15
|
+
* `data` rows.
|
|
16
|
+
*/
|
|
17
|
+
let {
|
|
18
|
+
title,
|
|
19
|
+
subtitle,
|
|
20
|
+
caption,
|
|
21
|
+
header,
|
|
22
|
+
footer,
|
|
23
|
+
legend,
|
|
24
|
+
order,
|
|
25
|
+
timeline,
|
|
26
|
+
facet,
|
|
27
|
+
tooltip,
|
|
28
|
+
margins = $bindable(),
|
|
29
|
+
...core
|
|
30
|
+
}: TreemapPlotProps<TData> = $props();
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<Plot
|
|
34
|
+
core={core as TreemapPlotCoreProps<TData>}
|
|
35
|
+
defaults={buildTreemapDefaults}
|
|
36
|
+
bind:margins
|
|
37
|
+
{title}
|
|
38
|
+
{subtitle}
|
|
39
|
+
{caption}
|
|
40
|
+
{header}
|
|
41
|
+
{footer}
|
|
42
|
+
{legend}
|
|
43
|
+
{order}
|
|
44
|
+
{timeline}
|
|
45
|
+
{facet}
|
|
46
|
+
{tooltip}
|
|
47
|
+
/>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Plot from '../../../layout/plot/Plot.svelte';
|
|
2
|
+
import type { TreemapPlotProps } from '../../../types/plots/part-of-a-whole/treemap/props';
|
|
3
|
+
declare function $$render<TData extends Record<string, unknown>>(): {
|
|
4
|
+
props: TreemapPlotProps<TData>;
|
|
5
|
+
exports: {};
|
|
6
|
+
bindings: "margins";
|
|
7
|
+
slots: {};
|
|
8
|
+
events: {};
|
|
9
|
+
};
|
|
10
|
+
declare class __sveltets_Render<TData extends Record<string, unknown>> {
|
|
11
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
12
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
13
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
14
|
+
bindings(): "margins";
|
|
15
|
+
exports(): {};
|
|
16
|
+
}
|
|
17
|
+
interface $$IsomorphicComponent {
|
|
18
|
+
new <TData extends Record<string, unknown>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TData>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TData>['props']>, ReturnType<__sveltets_Render<TData>['events']>, ReturnType<__sveltets_Render<TData>['slots']>> & {
|
|
19
|
+
$$bindings?: ReturnType<__sveltets_Render<TData>['bindings']>;
|
|
20
|
+
} & ReturnType<__sveltets_Render<TData>['exports']>;
|
|
21
|
+
<TData extends Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<TData>['props']> & {}): ReturnType<__sveltets_Render<TData>['exports']>;
|
|
22
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
23
|
+
}
|
|
24
|
+
declare const Plot: $$IsomorphicComponent;
|
|
25
|
+
type Plot<TData extends Record<string, unknown>> = InstanceType<typeof Plot<TData>>;
|
|
26
|
+
export default Plot;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AxisPlotDefaults } from '../../../types/phases';
|
|
2
|
+
import type { TreemapPlotState, TreemapPlotEnv } from '../../../types/plots/part-of-a-whole/treemap/state';
|
|
3
|
+
/**
|
|
4
|
+
* TreemapPlot on the shared pipeline: its rows are the tiles of the `treemap` transform, laid out in a unit square
|
|
5
|
+
* the plot's two continuous axes span (hidden). Its series are the outermost level of its `grouping`, which colors
|
|
6
|
+
* the tiles and fills the legend. The tiles are `rect` markers, labelled by their own `label`. Hovering a tile is
|
|
7
|
+
* hovering its row: an invisible `rect` over each one drives the plot's hover, and its tooltip names the tile and
|
|
8
|
+
* gives its share.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildTreemapDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<TreemapPlotState<TData>, TreemapPlotEnv>;
|