@fundar/data-chart-telling 1.17.0 → 1.19.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 +59 -0
- package/README.md +2 -1
- package/dist/configuration/config.svelte.js +4 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +4 -1
- package/dist/layout/coordinates/CoordinatesLayout.svelte +3 -1
- package/dist/layout/geometry/GeometryLayout.svelte +222 -53
- package/dist/layout/geometry/ScaleFreeContext.d.ts +31 -0
- package/dist/layout/geometry/ScaleFreeContext.js +65 -0
- package/dist/layout/geometry/ScaleFreeMarks.svelte +14 -0
- package/dist/layout/geometry/ScaleFreeMarks.svelte.d.ts +7 -0
- package/dist/layout/geometry/ScaleGate.svelte.d.ts +8 -0
- package/dist/layout/geometry/ScaleGate.svelte.js +95 -0
- package/dist/layout/geometry/ScaleGateMarks.svelte +15 -0
- package/dist/layout/geometry/ScaleGateMarks.svelte.d.ts +7 -0
- 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.d.ts +1 -3
- package/dist/layout/hover/HoverSettings.js +3 -2
- package/dist/layout/hover/HoverShapes.d.ts +56 -0
- package/dist/layout/hover/HoverShapes.js +163 -0
- package/dist/layout/hover/PlotHover.svelte.d.ts +18 -0
- package/dist/layout/hover/PlotHover.svelte.js +54 -1
- package/dist/layout/legend/LegendState.svelte.d.ts +2 -0
- package/dist/layout/legend/LegendState.svelte.js +5 -0
- package/dist/layout/margins/Box.d.ts +4 -0
- package/dist/layout/margins/Box.js +14 -0
- package/dist/layout/margins/PlotMargins.svelte.js +26 -1
- package/dist/layout/plot/{Plot.svelte.d.ts → AbstractPlot.svelte.d.ts} +3 -3
- package/dist/layout/plot/Core.svelte +2 -2
- package/dist/layout/plot/PublicPlotContext.d.ts +6 -0
- package/dist/layout/plot/PublicPlotContext.js +8 -0
- package/dist/layout/styles/ValueLabels.d.ts +118 -59
- package/dist/layout/styles/ValueLabels.js +313 -146
- 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 +84 -1
- package/dist/markers/MarkerKinds.js +150 -23
- package/dist/markers/area/AreaMarker.svelte +1 -1
- 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 +29 -70
- package/dist/markers/bollinger/BollingerMarker.svelte +1 -1
- package/dist/markers/box/BoxMarker.svelte +1 -1
- package/dist/markers/dot/DotRadius.d.ts +11 -0
- package/dist/markers/dot/DotRadius.js +21 -0
- package/dist/markers/hover/HoverMarker.svelte +7 -265
- package/dist/markers/hover/HoverMarker.svelte.d.ts +4 -27
- package/dist/markers/labels/CurveLabel.svelte +56 -0
- package/dist/markers/labels/CurveLabel.svelte.d.ts +9 -0
- package/dist/markers/labels/LabelMerge.d.ts +11 -0
- package/dist/markers/labels/LabelMerge.js +87 -0
- package/dist/markers/labels/MarkerLabel.svelte +36 -0
- package/dist/markers/labels/MarkerLabel.svelte.d.ts +10 -0
- package/dist/markers/labels/MarkerLabels.d.ts +52 -0
- package/dist/markers/labels/MarkerLabels.js +97 -0
- package/dist/markers/labels/geometry/BoxGeometry.d.ts +8 -0
- package/dist/markers/labels/geometry/BoxGeometry.js +101 -0
- package/dist/markers/labels/geometry/CurveGeometry.d.ts +34 -0
- package/dist/markers/labels/geometry/CurveGeometry.js +193 -0
- package/dist/markers/labels/geometry/PointGeometry.d.ts +9 -0
- package/dist/markers/labels/geometry/PointGeometry.js +22 -0
- package/dist/markers/labels/layouts/BoxLayout.d.ts +10 -0
- package/dist/markers/labels/layouts/BoxLayout.js +49 -0
- package/dist/markers/labels/layouts/PathLayout.d.ts +11 -0
- package/dist/markers/labels/layouts/PathLayout.js +91 -0
- package/dist/markers/labels/layouts/PointLayout.d.ts +19 -0
- package/dist/markers/labels/layouts/PointLayout.js +94 -0
- package/dist/markers/regression/RegressionMarker.svelte +1 -1
- package/dist/markers/text/Covering.d.ts +13 -0
- package/dist/markers/text/Covering.js +29 -0
- package/dist/markers/text/Declutter.d.ts +24 -3
- package/dist/markers/text/Declutter.js +46 -3
- package/dist/markers/text/TextMarker.svelte +90 -17
- package/dist/markers/text/TextMarker.svelte.d.ts +1 -1
- package/dist/markers/tick/TickMarker.svelte +1 -1
- package/dist/markers/utils/MarkerChannels.d.ts +1 -1
- package/dist/markers/utils/MarkerChannels.js +3 -2
- package/dist/markers/utils/PointPixel.d.ts +37 -0
- package/dist/markers/utils/PointPixel.js +44 -0
- package/dist/markers/violin/ViolinMarker.svelte +1 -1
- package/dist/markers/waffle/WaffleMarker.svelte +1 -1
- package/dist/phases/Pipeline.d.ts +7 -7
- package/dist/phases/Pipeline.js +12 -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 +37 -0
- package/dist/phases/context/RowContext.js +97 -0
- package/dist/phases/data/DataPhase.d.ts +4 -4
- package/dist/phases/data/DataPhase.js +7 -7
- package/dist/phases/hover/HoverPhase.d.ts +6 -7
- package/dist/phases/hover/HoverPhase.js +28 -23
- package/dist/phases/mapping/MappingPhase.d.ts +4 -4
- package/dist/phases/mapping/MappingPhase.js +2 -2
- package/dist/phases/markers/MarkerStyles.d.ts +8 -0
- package/dist/phases/markers/MarkerStyles.js +24 -6
- package/dist/phases/markers/MarkersPhase.d.ts +6 -7
- package/dist/phases/markers/MarkersPhase.js +18 -12
- 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 +5 -48
- package/dist/phases/statistics/MarkerInheritance.d.ts +11 -0
- package/dist/phases/statistics/MarkerInheritance.js +25 -0
- package/dist/phases/statistics/MarkerOrientation.d.ts +26 -0
- package/dist/phases/statistics/MarkerOrientation.js +29 -0
- package/dist/phases/statistics/StatisticsPhase.js +15 -15
- 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/TransformsPhase.d.ts +3 -3
- package/dist/phases/transforms/TransformsPhase.js +7 -5
- package/dist/plots/correlation/heatmap/Plot.svelte +2 -2
- package/dist/plots/correlation/heatmap/Plot.svelte.d.ts +0 -1
- package/dist/plots/correlation/heatmap/defaults.d.ts +2 -2
- package/dist/plots/correlation/heatmap/defaults.js +35 -7
- package/dist/plots/correlation/heatmap/markers.d.ts +2 -8
- package/dist/plots/correlation/heatmap/markers.js +8 -11
- package/dist/plots/correlation/scatter/Plot.svelte +2 -2
- package/dist/plots/correlation/scatter/Plot.svelte.d.ts +0 -1
- package/dist/plots/correlation/scatter/defaults.d.ts +2 -2
- package/dist/plots/correlation/scatter/defaults.js +18 -6
- package/dist/plots/correlation/scatter/markers.d.ts +2 -11
- package/dist/plots/correlation/scatter/markers.js +24 -30
- package/dist/plots/distribution/box/BoxSummaries.d.ts +22 -8
- package/dist/plots/distribution/box/BoxSummaries.js +99 -40
- package/dist/plots/distribution/box/Plot.svelte +2 -2
- package/dist/plots/distribution/box/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/box/defaults.d.ts +2 -2
- package/dist/plots/distribution/box/defaults.js +20 -6
- package/dist/plots/distribution/box/markers.d.ts +2 -2
- package/dist/plots/distribution/box/markers.js +13 -4
- package/dist/plots/distribution/density/Plot.svelte +2 -2
- package/dist/plots/distribution/density/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/density/defaults.d.ts +2 -2
- package/dist/plots/distribution/density/defaults.js +33 -1
- package/dist/plots/distribution/density/markers.d.ts +2 -2
- package/dist/plots/distribution/density/markers.js +9 -5
- package/dist/plots/distribution/histogram/Plot.svelte +2 -2
- package/dist/plots/distribution/histogram/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/histogram/defaults.d.ts +2 -2
- package/dist/plots/distribution/histogram/defaults.js +36 -36
- package/dist/plots/distribution/histogram/markers.d.ts +2 -2
- package/dist/plots/distribution/histogram/markers.js +7 -6
- package/dist/plots/distribution/pyramid/Plot.svelte +2 -2
- package/dist/plots/distribution/pyramid/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/pyramid/defaults.d.ts +2 -2
- package/dist/plots/distribution/pyramid/defaults.js +13 -3
- package/dist/plots/distribution/pyramid/markers.d.ts +2 -10
- package/dist/plots/distribution/pyramid/markers.js +9 -18
- package/dist/plots/distribution/violin/Plot.svelte +2 -2
- package/dist/plots/distribution/violin/Plot.svelte.d.ts +0 -1
- package/dist/plots/distribution/violin/defaults.d.ts +2 -2
- package/dist/plots/distribution/violin/defaults.js +20 -7
- package/dist/plots/distribution/violin/markers.d.ts +2 -2
- package/dist/plots/distribution/violin/markers.js +30 -6
- package/dist/plots/evolution/area/Plot.svelte +2 -2
- package/dist/plots/evolution/area/Plot.svelte.d.ts +0 -1
- package/dist/plots/evolution/area/defaults.d.ts +2 -2
- package/dist/plots/evolution/area/defaults.js +5 -8
- package/dist/plots/evolution/area/markers.d.ts +2 -2
- package/dist/plots/evolution/area/markers.js +7 -5
- package/dist/plots/evolution/line/Plot.svelte +2 -2
- package/dist/plots/evolution/line/Plot.svelte.d.ts +0 -1
- package/dist/plots/evolution/line/defaults.d.ts +2 -2
- package/dist/plots/evolution/line/defaults.js +5 -7
- package/dist/plots/evolution/line/markers.d.ts +2 -2
- package/dist/plots/evolution/line/markers.js +6 -4
- package/dist/plots/evolution/slope/Plot.svelte +2 -2
- package/dist/plots/evolution/slope/Plot.svelte.d.ts +0 -1
- package/dist/plots/evolution/slope/defaults.d.ts +2 -2
- package/dist/plots/evolution/slope/defaults.js +11 -6
- package/dist/plots/evolution/slope/markers.d.ts +6 -5
- package/dist/plots/evolution/slope/markers.js +19 -12
- package/dist/plots/evolution/sparkline/Plot.svelte +2 -2
- package/dist/plots/evolution/sparkline/Plot.svelte.d.ts +0 -1
- 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 +6 -4
- package/dist/plots/generic/Plot.svelte +42 -0
- package/dist/plots/generic/Plot.svelte.d.ts +25 -0
- package/dist/plots/generic/defaults.d.ts +4 -0
- package/dist/plots/generic/defaults.js +7 -0
- package/dist/plots/map/geo/Core.svelte +3 -3
- package/dist/plots/map/geo/Plot.svelte +2 -2
- package/dist/plots/map/geo/Plot.svelte.d.ts +0 -1
- 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 +3 -3
- 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 +2 -2
- package/dist/plots/part-of-a-whole/treemap/Plot.svelte.d.ts +0 -1
- package/dist/plots/part-of-a-whole/treemap/defaults.d.ts +2 -2
- package/dist/plots/part-of-a-whole/treemap/defaults.js +38 -22
- package/dist/plots/ranking/bar/Plot.svelte +2 -2
- package/dist/plots/ranking/bar/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/bar/defaults.d.ts +2 -2
- package/dist/plots/ranking/bar/defaults.js +26 -10
- package/dist/plots/ranking/bar/markers.d.ts +3 -3
- package/dist/plots/ranking/bar/markers.js +17 -33
- package/dist/plots/ranking/bullet/Plot.svelte +2 -2
- package/dist/plots/ranking/bullet/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/bullet/defaults.d.ts +2 -2
- package/dist/plots/ranking/bullet/defaults.js +24 -4
- package/dist/plots/ranking/bullet/markers.d.ts +3 -3
- package/dist/plots/ranking/bullet/markers.js +16 -10
- package/dist/plots/ranking/cleveland/ClevelandMarkers.d.ts +4 -11
- package/dist/plots/ranking/cleveland/ClevelandMarkers.js +73 -54
- package/dist/plots/ranking/cleveland/Plot.svelte +2 -2
- package/dist/plots/ranking/cleveland/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/cleveland/defaults.d.ts +2 -2
- package/dist/plots/ranking/cleveland/defaults.js +39 -5
- package/dist/plots/ranking/dumbbell/Plot.svelte +2 -2
- package/dist/plots/ranking/dumbbell/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/dumbbell/defaults.d.ts +2 -2
- package/dist/plots/ranking/forest/Plot.svelte +2 -2
- package/dist/plots/ranking/forest/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/forest/defaults.d.ts +2 -2
- package/dist/plots/ranking/lollipop/Plot.svelte +2 -2
- package/dist/plots/ranking/lollipop/Plot.svelte.d.ts +0 -1
- package/dist/plots/ranking/lollipop/defaults.d.ts +2 -2
- package/dist/types/configuration/styling.d.ts +4 -0
- package/dist/types/layout/context.d.ts +23 -0
- package/dist/types/layout/context.js +1 -0
- package/dist/types/layout/hover.d.ts +3 -0
- package/dist/types/layout/styles/bullet.d.ts +4 -1
- package/dist/types/layout/styles/values.d.ts +59 -13
- package/dist/types/layout/tooltip.d.ts +5 -10
- package/dist/types/markers/axis/area.d.ts +5 -1
- 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 +7 -4
- package/dist/types/markers/axis/bollinger.d.ts +2 -1
- package/dist/types/markers/axis/box.d.ts +2 -1
- package/dist/types/markers/axis/cell.d.ts +4 -1
- package/dist/types/markers/axis/hover.d.ts +60 -15
- package/dist/types/markers/axis/line.d.ts +4 -1
- package/dist/types/markers/axis/rect.d.ts +4 -1
- package/dist/types/markers/axis/regression.d.ts +2 -1
- package/dist/types/markers/axis/tick.d.ts +2 -1
- package/dist/types/markers/axis/trail.d.ts +4 -1
- package/dist/types/markers/axis/violin.d.ts +2 -1
- package/dist/types/markers/axis/waffle.d.ts +5 -1
- package/dist/types/markers/basic/dot.d.ts +4 -1
- package/dist/types/markers/basic/text.d.ts +25 -21
- package/dist/types/markers/channels/commonMarkerConfig.d.ts +6 -2
- package/dist/types/markers/channels/commonMarkerConfigWithLabel.d.ts +5 -9
- package/dist/types/markers/channels/commonMarkerConfigWithOrientation.d.ts +5 -0
- package/dist/types/markers/channels/commonMarkerConfigWithOrientation.js +1 -0
- package/dist/types/markers/common.d.ts +1 -0
- package/dist/types/markers/common.js +1 -0
- package/dist/types/markers/labels/box.d.ts +57 -0
- package/dist/types/markers/labels/box.js +1 -0
- package/dist/types/markers/labels/common.d.ts +15 -0
- package/dist/types/markers/labels/common.js +1 -0
- package/dist/types/markers/labels/path.d.ts +52 -0
- package/dist/types/markers/labels/path.js +1 -0
- package/dist/types/markers/labels/point.d.ts +40 -0
- package/dist/types/markers/labels/point.js +1 -0
- package/dist/types/markers/traits.d.ts +10 -0
- 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 +2 -2
- package/dist/types/phases/hover/phase.d.ts +10 -7
- 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 -10
- 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 +1 -1
- package/dist/types/phases/statistics/phase.d.ts +8 -3
- package/dist/types/phases/styles/phase.d.ts +18 -5
- package/dist/types/phases/transforms/phase.d.ts +4 -2
- package/dist/types/plots/constants.d.ts +3 -17
- package/dist/types/plots/correlation/heatmap/props.d.ts +3 -2
- package/dist/types/plots/correlation/heatmap/state.d.ts +2 -2
- package/dist/types/plots/correlation/scatter/props.d.ts +3 -2
- package/dist/types/plots/correlation/scatter/state.d.ts +2 -2
- package/dist/types/plots/distribution/box/props.d.ts +28 -2
- package/dist/types/plots/distribution/box/state.d.ts +6 -17
- package/dist/types/plots/distribution/density/props.d.ts +2 -1
- package/dist/types/plots/distribution/density/state.d.ts +2 -2
- package/dist/types/plots/distribution/histogram/props.d.ts +16 -2
- package/dist/types/plots/distribution/histogram/state.d.ts +2 -2
- package/dist/types/plots/distribution/pyramid/props.d.ts +3 -2
- package/dist/types/plots/distribution/pyramid/state.d.ts +2 -2
- package/dist/types/plots/distribution/violin/props.d.ts +6 -2
- package/dist/types/plots/distribution/violin/state.d.ts +2 -2
- package/dist/types/plots/evolution/area/props.d.ts +3 -2
- package/dist/types/plots/evolution/area/state.d.ts +2 -2
- package/dist/types/plots/evolution/line/props.d.ts +3 -2
- 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/generic/props.d.ts +16 -0
- package/dist/types/plots/generic/props.js +1 -0
- package/dist/types/plots/generic/state.d.ts +4 -0
- package/dist/types/plots/generic/state.js +1 -0
- package/dist/types/plots/map/geo/state.d.ts +1 -1
- package/dist/types/plots/part-of-a-whole/treemap/props.d.ts +18 -6
- package/dist/types/plots/part-of-a-whole/treemap/state.d.ts +2 -2
- package/dist/types/plots/props.d.ts +3 -0
- package/dist/types/plots/ranking/bar/props.d.ts +3 -2
- 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 -2
- package/dist/types/plots/ranking/cleveland/state.d.ts +2 -2
- package/dist/types/plots/ranking/dumbbell/props.d.ts +3 -2
- package/dist/types/plots/ranking/dumbbell/state.d.ts +2 -2
- package/dist/types/plots/ranking/forest/props.d.ts +5 -2
- package/dist/types/plots/ranking/forest/state.d.ts +2 -2
- package/dist/types/plots/ranking/lollipop/props.d.ts +3 -2
- package/dist/types/plots/ranking/lollipop/state.d.ts +2 -2
- package/docs/architecture.md +9 -9
- package/docs/markers.md +36 -6
- 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 +36 -2
- package/docs/plots/ranking/bar.md +1 -0
- package/docs/plots/ranking/cleveland.md +1 -1
- package/docs/state.md +33 -0
- package/docs/styles-and-segments.md +2 -15
- package/docs/theming.md +2 -1
- package/docs/tooltip-and-hover.md +81 -3
- package/docs/value-labels.md +159 -0
- package/examples/BarValues.svelte +1 -1
- package/examples/LineDates.svelte +1 -1
- package/examples/ResponsiveLine.svelte +3 -1
- package/examples/TreemapHover.svelte +25 -0
- package/examples/ValueLabels.svelte +1 -1
- package/llms-full.txt +9 -7
- package/llms.txt +3 -1
- package/package.json +3 -1
- package/dist/markers/utils/BoxLabel.d.ts +0 -58
- package/dist/markers/utils/BoxLabel.js +0 -175
- package/dist/markers/utils/MarkerLabel.svelte +0 -33
- package/dist/markers/utils/MarkerLabel.svelte.d.ts +0 -10
- /package/dist/layout/plot/{Plot.svelte → AbstractPlot.svelte} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AxisPlotState,
|
|
1
|
+
import type { AxisPlotState, AxisPlotEnv, MappingStageOptions, PhaseStage } from '../../types/phases';
|
|
2
2
|
type AnyAxisState = AxisPlotState<any, any, any, any>;
|
|
3
3
|
/**
|
|
4
4
|
* The "mapping" phase every axis-based plot shares: every channel resolved to
|
|
@@ -8,10 +8,10 @@ type AnyAxisState = AxisPlotState<any, any, any, any>;
|
|
|
8
8
|
* its prop is set, and a size channel given a number stays that literal size.
|
|
9
9
|
* An unset `x`/`y` reads each row itself, with no `source`.
|
|
10
10
|
*/
|
|
11
|
-
export declare class MappingPhase<TState extends AnyAxisState,
|
|
11
|
+
export declare class MappingPhase<TState extends AnyAxisState, TEnv extends AxisPlotEnv> implements PhaseStage<TState, TEnv> {
|
|
12
12
|
#private;
|
|
13
13
|
readonly phase: "mapping";
|
|
14
|
-
constructor(options?: MappingStageOptions<TState,
|
|
15
|
-
run: (state: TState,
|
|
14
|
+
constructor(options?: MappingStageOptions<TState, TEnv>);
|
|
15
|
+
run: (state: TState, env: TEnv) => TState;
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -13,7 +13,7 @@ export class MappingPhase {
|
|
|
13
13
|
constructor(options = {}) {
|
|
14
14
|
this.#options = options;
|
|
15
15
|
}
|
|
16
|
-
run = (state,
|
|
16
|
+
run = (state, env) => {
|
|
17
17
|
const first = state.resolvedSeries?.[0];
|
|
18
18
|
const identity = { accessor: (d) => d };
|
|
19
19
|
const size = (value) => typeof value === 'number' ? value : MappingPhase.#channel(value);
|
|
@@ -29,7 +29,7 @@ export class MappingPhase {
|
|
|
29
29
|
value: MappingPhase.#channel(state.value)
|
|
30
30
|
};
|
|
31
31
|
const next = { ...state, channels };
|
|
32
|
-
return this.#options.extend ? this.#options.extend(next,
|
|
32
|
+
return this.#options.extend ? this.#options.extend(next, env) : next;
|
|
33
33
|
};
|
|
34
34
|
/** A channel prop resolved to a row accessor, keeping it as `source`, or left out when unset. */
|
|
35
35
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -15,4 +15,12 @@ export declare class MarkerStyles {
|
|
|
15
15
|
cfg?: PlotStylesConfig;
|
|
16
16
|
rows?: unknown[];
|
|
17
17
|
}): T[];
|
|
18
|
+
/**
|
|
19
|
+
* `marker` resolved again after its styles changed (as the hover restyles a shape): a label written in the color
|
|
20
|
+
* that read best on the shape's old one reads best on its new one.
|
|
21
|
+
*/
|
|
22
|
+
static restyle<T>(marker: T, plot?: {
|
|
23
|
+
cfg?: PlotStylesConfig;
|
|
24
|
+
rows?: unknown[];
|
|
25
|
+
}): T;
|
|
18
26
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MarkerChannels } from '../../markers/utils/MarkerChannels';
|
|
2
2
|
import { RowStyle } from '../../markers/utils/RowStyle';
|
|
3
3
|
import { CssColor } from '../../utils/color/CssColor';
|
|
4
|
+
import { MarkerLabels } from '../../markers/labels/MarkerLabels';
|
|
4
5
|
/**
|
|
5
6
|
* A plot's markers with their styles as svelteplot reads them, before any is drawn: a named line style
|
|
6
7
|
* (`strokeDasharray: 'dashed'`) is the SVG dash pattern it stands for, wherever in a marker's config it is
|
|
@@ -17,6 +18,8 @@ export class MarkerStyles {
|
|
|
17
18
|
};
|
|
18
19
|
/** The style fields that take a dash pattern. */
|
|
19
20
|
static #DASH_KEYS = new Set(['strokeDasharray', 'dotStrokeDasharray']);
|
|
21
|
+
/** The label colors this class chose for a shape's color, which a restyled shape chooses again. */
|
|
22
|
+
static #contrasts = new WeakSet();
|
|
20
23
|
/** Fields that hold rows rather than config, which are never walked. */
|
|
21
24
|
static #ROW_KEYS = new Set(['data', 'features']);
|
|
22
25
|
/**
|
|
@@ -26,21 +29,35 @@ export class MarkerStyles {
|
|
|
26
29
|
static resolveAll(markers, plot = {}) {
|
|
27
30
|
return markers.map((marker) => MarkerStyles.#contrasted(MarkerStyles.#walk(marker), plot));
|
|
28
31
|
}
|
|
29
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* `marker` resolved again after its styles changed (as the hover restyles a shape): a label written in the color
|
|
34
|
+
* that read best on the shape's old one reads best on its new one.
|
|
35
|
+
*/
|
|
36
|
+
static restyle(marker, plot = {}) {
|
|
37
|
+
const fresh = MarkerLabels.map(marker, (label) => {
|
|
38
|
+
const fill = label.styles?.fill;
|
|
39
|
+
return typeof fill === 'function' && MarkerStyles.#contrasts.has(fill)
|
|
40
|
+
? { ...label, styles: { ...label.styles, fill: undefined } }
|
|
41
|
+
: label;
|
|
42
|
+
});
|
|
43
|
+
return MarkerStyles.resolveAll([fresh], plot)[0];
|
|
44
|
+
}
|
|
45
|
+
/** Writes each label on its shape in the color that reads best on it. */
|
|
30
46
|
static #contrasted(marker, plot) {
|
|
31
47
|
const { cfg } = plot;
|
|
32
48
|
if (!cfg || !MarkerStyles.#isPlain(marker))
|
|
33
49
|
return marker;
|
|
34
|
-
const
|
|
35
|
-
|
|
50
|
+
const unset = (label) => MarkerStyles.#isPlain(label) &&
|
|
51
|
+
MarkerLabels.isOnShape(marker, label) &&
|
|
52
|
+
label.styles?.fill === undefined;
|
|
53
|
+
if (!MarkerLabels.list(marker).some(unset))
|
|
36
54
|
return marker;
|
|
37
|
-
}
|
|
38
55
|
const colorOf = MarkerStyles.#shapeColor(marker, marker.data ?? plot.rows ?? [], cfg);
|
|
39
56
|
if (!colorOf)
|
|
40
57
|
return marker;
|
|
41
58
|
const candidates = cfg.text.label.contrast;
|
|
42
59
|
const opacityOf = MarkerStyles.#opacity(marker.styles?.fillOpacity);
|
|
43
|
-
//
|
|
60
|
+
// The shape's color as seen: blended with the background by its opacity.
|
|
44
61
|
const fill = (row) => {
|
|
45
62
|
const color = colorOf(row);
|
|
46
63
|
if (!color)
|
|
@@ -48,7 +65,8 @@ export class MarkerStyles {
|
|
|
48
65
|
const seen = CssColor.composite(color, opacityOf(row), cfg.background);
|
|
49
66
|
return CssColor.contrastText(seen, candidates);
|
|
50
67
|
};
|
|
51
|
-
|
|
68
|
+
MarkerStyles.#contrasts.add(fill);
|
|
69
|
+
return MarkerLabels.map(marker, (label) => unset(label) ? { ...label, styles: { ...label.styles, fill } } : label);
|
|
52
70
|
}
|
|
53
71
|
/** The opacity each row's shape is drawn with: a number, the field of the rows a string names, a function of the row. */
|
|
54
72
|
static #opacity(style) {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AxisPlotEnv, AxisPlotState, MarkersStageOptions, PhaseStage } from '../../types/phases';
|
|
2
2
|
/**
|
|
3
3
|
* The shared "markers" phase: everything the plot draws, bottom to top - the
|
|
4
4
|
* plot kind's own marks, then what the "statistics" phase left in
|
|
5
|
-
* `state.markers` (the author's markers and the plot's statistics), then
|
|
6
|
-
*
|
|
7
|
-
* label shares ({@link ValueLabels.hooks}), and every style as svelteplot reads it ({@link MarkerStyles}).
|
|
5
|
+
* `state.markers` (the author's markers and the plot's statistics), then the
|
|
6
|
+
* `'point'` labels of all of them, and every style as svelteplot reads it ({@link MarkerStyles}).
|
|
8
7
|
*/
|
|
9
|
-
export declare class MarkersPhase<TState extends AxisPlotState<any, any, any, any>,
|
|
8
|
+
export declare class MarkersPhase<TState extends AxisPlotState<any, any, any, any>, TEnv extends AxisPlotEnv> implements PhaseStage<TState, TEnv> {
|
|
10
9
|
#private;
|
|
11
10
|
readonly phase: "markers";
|
|
12
|
-
constructor(options: MarkersStageOptions<TState,
|
|
13
|
-
run: (state: TState,
|
|
11
|
+
constructor(options: MarkersStageOptions<TState, TEnv>);
|
|
12
|
+
run: (state: TState, env: TEnv) => TState;
|
|
14
13
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { MarkerChannels } from '../../markers/utils/MarkerChannels';
|
|
2
2
|
import { MarkerStyles } from './MarkerStyles';
|
|
3
|
+
import { MarkerLabels } from '../../markers/labels/MarkerLabels';
|
|
4
|
+
import { PlotAxes } from '../data/PlotAxes';
|
|
3
5
|
/**
|
|
4
6
|
* The shared "markers" phase: everything the plot draws, bottom to top - the
|
|
5
7
|
* plot kind's own marks, then what the "statistics" phase left in
|
|
6
|
-
* `state.markers` (the author's markers and the plot's statistics), then
|
|
7
|
-
*
|
|
8
|
-
* label shares ({@link ValueLabels.hooks}), and every style as svelteplot reads it ({@link MarkerStyles}).
|
|
8
|
+
* `state.markers` (the author's markers and the plot's statistics), then the
|
|
9
|
+
* `'point'` labels of all of them, and every style as svelteplot reads it ({@link MarkerStyles}).
|
|
9
10
|
*/
|
|
10
11
|
export class MarkersPhase {
|
|
11
12
|
phase = 'markers';
|
|
@@ -13,18 +14,23 @@ export class MarkersPhase {
|
|
|
13
14
|
constructor(options) {
|
|
14
15
|
this.#options = options;
|
|
15
16
|
}
|
|
16
|
-
run = (state,
|
|
17
|
+
run = (state, env) => {
|
|
17
18
|
const options = this.#options;
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
:
|
|
19
|
+
const rows = state.processedData?.data;
|
|
20
|
+
const positioned = MarkerChannels.inheritPosition(MarkerChannels.inheritAll([...options.marks(state, env), ...(state.markers ?? [])], state.scales), state.processedData);
|
|
21
|
+
// Point labels draw last, merged across markers so they declutter together.
|
|
22
|
+
const { markers, labels: pointLabels } = MarkerLabels.extractPoints(positioned, {
|
|
23
|
+
rows,
|
|
24
|
+
valueAxis: PlotAxes.valueOf(state),
|
|
25
|
+
isHorizontal: state.axes?.isHorizontal,
|
|
26
|
+
gap: env.cfg.text?.label.gap
|
|
27
|
+
});
|
|
25
28
|
return {
|
|
26
29
|
...state,
|
|
27
|
-
markers: MarkerStyles.resolveAll(
|
|
30
|
+
markers: MarkerStyles.resolveAll([...markers, ...pointLabels], {
|
|
31
|
+
cfg: env.cfg,
|
|
32
|
+
rows
|
|
33
|
+
})
|
|
28
34
|
};
|
|
29
35
|
};
|
|
30
36
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PlotAxes } from '../data/PlotAxes';
|
|
2
2
|
import type { AxisChannelName } from '../../types/layout/mapping';
|
|
3
|
-
import type { AxisPlotState,
|
|
3
|
+
import type { AxisPlotState, AxisPlotEnv, PhaseStage, ScalesStageOptions } from '../../types/phases';
|
|
4
4
|
type AnyAxisState = AxisPlotState<any, any, any, any>;
|
|
5
5
|
/**
|
|
6
6
|
* The shared "scales" phase. Each axis the kind lays out as categories
|
|
@@ -10,10 +10,10 @@ type AnyAxisState = AxisPlotState<any, any, any, any>;
|
|
|
10
10
|
* transforms gave the rows - from zero on the axes `zero` names. The author's
|
|
11
11
|
* `scales` always win, and a kind adds its own on top (`defaults`, `fit`, `extend`).
|
|
12
12
|
*/
|
|
13
|
-
export declare class ScalesPhase<TState extends AnyAxisState,
|
|
13
|
+
export declare class ScalesPhase<TState extends AnyAxisState, TEnv extends AxisPlotEnv> implements PhaseStage<TState, TEnv> {
|
|
14
14
|
#private;
|
|
15
15
|
readonly phase: "scales";
|
|
16
|
-
constructor(options?: ScalesStageOptions<TState,
|
|
16
|
+
constructor(options?: ScalesStageOptions<TState, TEnv>);
|
|
17
17
|
/** The axes whose marks grow from zero, in this state. */
|
|
18
18
|
zeroAxes(state: {
|
|
19
19
|
axes?: PlotAxes;
|
|
@@ -24,6 +24,6 @@ export declare class ScalesPhase<TState extends AnyAxisState, TCtx extends AxisP
|
|
|
24
24
|
}): AxisChannelName[];
|
|
25
25
|
/** Whether the kind keeps its categories in the order the data gives them. */
|
|
26
26
|
get keepsDataOrder(): boolean;
|
|
27
|
-
run: (state: TState,
|
|
27
|
+
run: (state: TState, env: TEnv) => TState;
|
|
28
28
|
}
|
|
29
29
|
export {};
|
|
@@ -44,10 +44,10 @@ export class ScalesPhase {
|
|
|
44
44
|
get keepsDataOrder() {
|
|
45
45
|
return this.#options.bandOrder === 'data';
|
|
46
46
|
}
|
|
47
|
-
run = (state,
|
|
47
|
+
run = (state, env) => {
|
|
48
48
|
const options = this.#options;
|
|
49
49
|
const { axes, processedData, markers = [] } = state;
|
|
50
|
-
const defaults = options.defaults?.(state,
|
|
50
|
+
const defaults = options.defaults?.(state, env) ?? {};
|
|
51
51
|
const symmetric = new Set(this.symmetricAxes(state));
|
|
52
52
|
const zero = new Set(this.zeroAxes(state));
|
|
53
53
|
const scales = { ...state.scales };
|
|
@@ -72,7 +72,7 @@ export class ScalesPhase {
|
|
|
72
72
|
scales[axis] = { ...scales[axis], domain: [-reach, reach] };
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
const fitted = options.fit?.({ ...state, scales },
|
|
75
|
+
const fitted = options.fit?.({ ...state, scales }, env) ?? {};
|
|
76
76
|
const fittedAxes = [];
|
|
77
77
|
for (const axis of AXES) {
|
|
78
78
|
if (!fitted[axis])
|
|
@@ -111,7 +111,7 @@ export class ScalesPhase {
|
|
|
111
111
|
: { ...author, domain: [lo, hi], nice: author?.nice ?? true };
|
|
112
112
|
}
|
|
113
113
|
const next = { ...state, scales, ...(fittedAxes.length ? { fittedAxes } : {}) };
|
|
114
|
-
return options.extend ? options.extend(next,
|
|
114
|
+
return options.extend ? options.extend(next, env) : next;
|
|
115
115
|
};
|
|
116
116
|
/** A category axis as a band scale: the kind's options under the author's, in the order the kind asks for. */
|
|
117
117
|
#band(author, own, state, axis) {
|
|
@@ -30,11 +30,11 @@ type SharedScalesState = FacetStageState & {
|
|
|
30
30
|
* can't happen there. Without options, a kind still shares its domains: it just
|
|
31
31
|
* has no bands and nothing that starts from zero.
|
|
32
32
|
*/
|
|
33
|
-
export declare class SharedScalesPhase<TState extends SharedScalesState,
|
|
33
|
+
export declare class SharedScalesPhase<TState extends SharedScalesState, TEnv> implements PhaseStage<TState, TEnv> {
|
|
34
34
|
#private;
|
|
35
35
|
readonly phase: "sharedScales";
|
|
36
36
|
constructor(options: SharedScalesOptions | undefined, scales?: ScalesPhase<any, any>);
|
|
37
|
-
run: (state: TState,
|
|
37
|
+
run: (state: TState, env: TEnv) => TState;
|
|
38
38
|
/**
|
|
39
39
|
* One axis' domain over some slices: sorted values on a band axis, `[min, max]`
|
|
40
40
|
* otherwise, or `undefined`. A numeric extent is niced here, once, so every
|
|
@@ -34,7 +34,7 @@ export class SharedScalesPhase {
|
|
|
34
34
|
this.#scales = scales;
|
|
35
35
|
this.#kindScales = new Pipeline([scales]);
|
|
36
36
|
}
|
|
37
|
-
run = (state,
|
|
37
|
+
run = (state, env) => {
|
|
38
38
|
const facet = state.facet;
|
|
39
39
|
const panels = facet ? (state.panels ?? []) : [];
|
|
40
40
|
// A symmetric axis has no domain but the one the kind's "scales" phase gives it.
|
|
@@ -54,7 +54,7 @@ export class SharedScalesPhase {
|
|
|
54
54
|
const domainOver = (channel, members) => {
|
|
55
55
|
if (fromPhase.has(channel)) {
|
|
56
56
|
const scoped = members ? FacetPanels.narrowToPanels(state, members) : state;
|
|
57
|
-
const scales = this.#kindScales.run(scoped,
|
|
57
|
+
const scales = this.#kindScales.run(scoped, env).scales;
|
|
58
58
|
const domain = scales?.[channel]?.domain;
|
|
59
59
|
return domain === undefined ? undefined : { domain };
|
|
60
60
|
}
|
|
@@ -35,14 +35,5 @@ export declare class MarkerGrouping {
|
|
|
35
35
|
color?: unknown;
|
|
36
36
|
defaultColor?: string;
|
|
37
37
|
}): TMarker[];
|
|
38
|
-
/**
|
|
39
|
-
* Gives a scoped hover marker its series color through its own `dot` and
|
|
40
|
-
* `text` styles, the way `withSeriesColor` does for other markers. A style the
|
|
41
|
-
* marker sets itself keeps its own color.
|
|
42
|
-
*/
|
|
43
|
-
static withHoverSeriesColor<T extends {
|
|
44
|
-
dot?: object;
|
|
45
|
-
text?: object;
|
|
46
|
-
}>(marker: T, color: string | undefined): T;
|
|
47
38
|
}
|
|
48
39
|
export {};
|
|
@@ -1,33 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const GROUPING_KINDS = new Set([
|
|
3
|
-
'area',
|
|
4
|
-
'density',
|
|
5
|
-
'line',
|
|
6
|
-
'hull',
|
|
7
|
-
'trail',
|
|
8
|
-
'delaunayLink',
|
|
9
|
-
'delaunayMesh',
|
|
10
|
-
'voronoi',
|
|
11
|
-
'voronoiMesh'
|
|
12
|
-
]);
|
|
13
|
-
/** Marker kinds whose per-row `color` resolves through the plot's own color scale. */
|
|
14
|
-
const COLOR_KINDS = new Set([
|
|
15
|
-
'area',
|
|
16
|
-
'bar',
|
|
17
|
-
'cell',
|
|
18
|
-
'density',
|
|
19
|
-
'delaunayLink',
|
|
20
|
-
'delaunayMesh',
|
|
21
|
-
'dot',
|
|
22
|
-
'hull',
|
|
23
|
-
'line',
|
|
24
|
-
'rect',
|
|
25
|
-
'tick',
|
|
26
|
-
'trail',
|
|
27
|
-
'voronoi',
|
|
28
|
-
'voronoiMesh',
|
|
29
|
-
'waffle'
|
|
30
|
-
]);
|
|
1
|
+
import { MarkerKinds } from '../../markers/MarkerKinds';
|
|
31
2
|
/** Kinds that draw only a line, so their flat color is `stroke` alone. */
|
|
32
3
|
const LINE_KINDS = new Set(['line', 'regression', 'bollinger', 'delta']);
|
|
33
4
|
/** Flat color style keys - when a marker sets one, it keeps that color instead of inheriting one. */
|
|
@@ -86,28 +57,14 @@ export class MarkerGrouping {
|
|
|
86
57
|
if (grouping === undefined)
|
|
87
58
|
return MarkerGrouping.withSeriesColor(m, plot.defaultColor);
|
|
88
59
|
const updates = {};
|
|
89
|
-
if (
|
|
60
|
+
if (MarkerKinds.inherits(m.type, 'grouping') && m.grouping === undefined)
|
|
90
61
|
updates.grouping = grouping;
|
|
91
|
-
if (
|
|
62
|
+
if (MarkerKinds.inherits(m.type, 'color') &&
|
|
63
|
+
m.color === undefined &&
|
|
64
|
+
!MarkerGrouping.#hasFlatColor(m)) {
|
|
92
65
|
updates.color = plot.color ?? plot.grouping;
|
|
93
66
|
}
|
|
94
67
|
return Object.keys(updates).length ? { ...m, ...updates } : marker;
|
|
95
68
|
});
|
|
96
69
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Gives a scoped hover marker its series color through its own `dot` and
|
|
99
|
-
* `text` styles, the way `withSeriesColor` does for other markers. A style the
|
|
100
|
-
* marker sets itself keeps its own color.
|
|
101
|
-
*/
|
|
102
|
-
static withHoverSeriesColor(marker, color) {
|
|
103
|
-
if (!color)
|
|
104
|
-
return marker;
|
|
105
|
-
const dot = (marker.dot ?? {});
|
|
106
|
-
const text = (marker.text ?? {});
|
|
107
|
-
return {
|
|
108
|
-
...marker,
|
|
109
|
-
dot: { ...dot, dotFill: dot.dotFill ?? color, dotStroke: dot.dotStroke ?? color },
|
|
110
|
-
text: { ...text, fill: text.fill ?? color }
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
70
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { InheritedChannel } from '../../types/markers/traits';
|
|
2
|
+
/** How a plot's position and value channels reach the markers its author adds. */
|
|
3
|
+
export declare class MarkerInheritance {
|
|
4
|
+
/**
|
|
5
|
+
* `marker` with the plot's `x`/`y` on each axis it sets no position for (`x`, `x1` or `x2`...), and the
|
|
6
|
+
* plot's other channels it sets none of, as far as its kind inherits them.
|
|
7
|
+
*/
|
|
8
|
+
static inherit<T extends {
|
|
9
|
+
type: string;
|
|
10
|
+
}>(marker: T, plot: Partial<Record<InheritedChannel, unknown>>): T;
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MarkerKinds } from '../../markers/MarkerKinds';
|
|
2
|
+
/** The value channels a marker takes as they are; `grouping` and `color` are `MarkerGrouping`'s. */
|
|
3
|
+
const VALUES = ['opacity', 'symbol', 'r', 'length'];
|
|
4
|
+
/** How a plot's position and value channels reach the markers its author adds. */
|
|
5
|
+
export class MarkerInheritance {
|
|
6
|
+
/**
|
|
7
|
+
* `marker` with the plot's `x`/`y` on each axis it sets no position for (`x`, `x1` or `x2`...), and the
|
|
8
|
+
* plot's other channels it sets none of, as far as its kind inherits them.
|
|
9
|
+
*/
|
|
10
|
+
static inherit(marker, plot) {
|
|
11
|
+
const own = marker;
|
|
12
|
+
const takes = (channel) => plot[channel] !== undefined && MarkerKinds.inherits(own.type, channel);
|
|
13
|
+
const taken = {};
|
|
14
|
+
for (const axis of ['x', 'y']) {
|
|
15
|
+
const unset = [axis, `${axis}1`, `${axis}2`].every((key) => own[key] === undefined);
|
|
16
|
+
if (unset && takes(axis))
|
|
17
|
+
taken[axis] = plot[axis];
|
|
18
|
+
}
|
|
19
|
+
for (const channel of VALUES) {
|
|
20
|
+
if (own[channel] === undefined && takes(channel))
|
|
21
|
+
taken[channel] = plot[channel];
|
|
22
|
+
}
|
|
23
|
+
return Object.keys(taken).length ? { ...own, ...taken } : marker;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type Marker = {
|
|
2
|
+
type: string;
|
|
3
|
+
isHorizontal?: boolean;
|
|
4
|
+
data?: unknown[];
|
|
5
|
+
} & Record<string, unknown>;
|
|
6
|
+
type AxisScales = {
|
|
7
|
+
x?: {
|
|
8
|
+
type?: string;
|
|
9
|
+
};
|
|
10
|
+
y?: {
|
|
11
|
+
type?: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/** Which way an oriented marker runs when its plot has no position channels to say it. */
|
|
15
|
+
export declare class MarkerOrientation {
|
|
16
|
+
/** `marker` with `isHorizontal` taken from its own channels, unless it sets one or can't tell. */
|
|
17
|
+
static orient<T extends {
|
|
18
|
+
type: string;
|
|
19
|
+
}>(marker: T, rows: unknown[], scales?: AxisScales): T;
|
|
20
|
+
/**
|
|
21
|
+
* A band (`x1`/`x2` or `y1`/`y2`) runs across its own axis; two channels run as a plot's
|
|
22
|
+
* would; a single channel is the measured value.
|
|
23
|
+
*/
|
|
24
|
+
static of(marker: Marker, rows: unknown[], scales?: AxisScales): boolean | undefined;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MarkerKinds } from '../../markers/MarkerKinds';
|
|
2
|
+
import { PlotAxes } from '../data/PlotAxes';
|
|
3
|
+
/** Which way an oriented marker runs when its plot has no position channels to say it. */
|
|
4
|
+
export class MarkerOrientation {
|
|
5
|
+
/** `marker` with `isHorizontal` taken from its own channels, unless it sets one or can't tell. */
|
|
6
|
+
static orient(marker, rows, scales) {
|
|
7
|
+
const own = marker;
|
|
8
|
+
if (own.isHorizontal !== undefined || !MarkerKinds.of(own.type)?.oriented)
|
|
9
|
+
return marker;
|
|
10
|
+
const isHorizontal = MarkerOrientation.of(own, rows, scales);
|
|
11
|
+
return isHorizontal === undefined ? marker : { ...own, isHorizontal };
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A band (`x1`/`x2` or `y1`/`y2`) runs across its own axis; two channels run as a plot's
|
|
15
|
+
* would; a single channel is the measured value.
|
|
16
|
+
*/
|
|
17
|
+
static of(marker, rows, scales) {
|
|
18
|
+
const set = (...keys) => keys.some((key) => marker[key] !== undefined);
|
|
19
|
+
const [xBand, yBand] = [set('x1', 'x2'), set('y1', 'y2')];
|
|
20
|
+
if (xBand !== yBand)
|
|
21
|
+
return xBand;
|
|
22
|
+
const [x, y] = [set('x'), set('y')];
|
|
23
|
+
if (x && y) {
|
|
24
|
+
const data = marker.data ?? rows;
|
|
25
|
+
return PlotAxes.build({ series: [{ x: marker.x, y: marker.y, data }], scales }).isHorizontal;
|
|
26
|
+
}
|
|
27
|
+
return x !== y ? x : undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AuthorMarkers } from './AuthorMarkers';
|
|
2
2
|
import { Statistics } from './Statistics';
|
|
3
|
+
import { MarkerInheritance } from './MarkerInheritance';
|
|
4
|
+
import { MarkerOrientation } from './MarkerOrientation';
|
|
3
5
|
import { PANEL_KEY, FacetPanels } from '../facet/FacetPanels';
|
|
4
6
|
import { PlotAxes } from '../data/PlotAxes';
|
|
5
|
-
/** Marker kinds that draw from a channel pair, so they take the plot's `x`/`y` when the author leaves one out. */
|
|
6
|
-
const POSITIONED_KINDS = new Set(['line', 'area', 'dot']);
|
|
7
7
|
/**
|
|
8
8
|
* The "statistics" phase every axis-based plot shares: seeds `state.markers`
|
|
9
9
|
* with the plot-level `statistics` resolved against every series, followed by
|
|
@@ -38,23 +38,23 @@ export class StatisticsPhase {
|
|
|
38
38
|
#resolve(state) {
|
|
39
39
|
const options = this.#options;
|
|
40
40
|
const { resolvedSeries = [], flat = [], colorForSeries, statistics, authorMarkers = [] } = state;
|
|
41
|
-
const { inheritGrouping = true
|
|
41
|
+
const { inheritGrouping = true } = options;
|
|
42
42
|
const defaultColor = options.defaultColor
|
|
43
43
|
? options.defaultColor(state)
|
|
44
44
|
: resolvedSeries[0] && colorForSeries?.(resolvedSeries[0].name);
|
|
45
45
|
const onProcessed = authorMarkers.map((marker) => AuthorMarkers.withProcessedRows(marker, state.processedData));
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
const unpositioned = !state.axes?.x && !state.axes?.y;
|
|
47
|
+
const positioned = onProcessed.map((marker) => {
|
|
48
|
+
const inherited = MarkerInheritance.inherit(marker, {
|
|
49
|
+
x: resolvedSeries[0]?.x ?? state.x,
|
|
50
|
+
y: resolvedSeries[0]?.y ?? state.y,
|
|
51
|
+
opacity: state.opacity,
|
|
52
|
+
symbol: state.symbol,
|
|
53
|
+
r: state.r,
|
|
54
|
+
length: state.length
|
|
55
|
+
});
|
|
56
|
+
return unpositioned ? MarkerOrientation.orient(inherited, flat, state.scales) : inherited;
|
|
57
|
+
});
|
|
58
58
|
// A series setting no value of its own (a histogram's) measures its processed rows: its bins.
|
|
59
59
|
const valueAxis = PlotAxes.valueOf(state);
|
|
60
60
|
const measured = state.processedData && resolvedSeries.some((s) => s[valueAxis] === undefined)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { AxisPlotState,
|
|
1
|
+
import type { AxisPlotState, AxisPlotEnv, PhaseStage } from '../../types/phases';
|
|
2
2
|
import type { StylesStageOptions } from '../../types/phases/styles/phase';
|
|
3
3
|
/**
|
|
4
4
|
* The shared "styles" phase: resolves the plot's `styles` against the plot
|
|
5
5
|
* kind's own defaults - its value labels (`valueLabels`), with how far they
|
|
6
6
|
* are expected to reach out, which its margins start from.
|
|
7
7
|
*/
|
|
8
|
-
export declare class StylesPhase<TState extends AxisPlotState<any, any, any, any>,
|
|
8
|
+
export declare class StylesPhase<TState extends AxisPlotState<any, any, any, any>, TEnv extends AxisPlotEnv> implements PhaseStage<TState, TEnv> {
|
|
9
9
|
#private;
|
|
10
10
|
readonly phase: "styles";
|
|
11
11
|
constructor(options?: StylesStageOptions<TState>);
|
|
12
|
-
run: (state: TState,
|
|
12
|
+
run: (state: TState, env: TEnv) => TState;
|
|
13
13
|
}
|
|
@@ -10,8 +10,8 @@ export class StylesPhase {
|
|
|
10
10
|
constructor(options = {}) {
|
|
11
11
|
this.#options = options;
|
|
12
12
|
}
|
|
13
|
-
run = (state,
|
|
13
|
+
run = (state, env) => ({
|
|
14
14
|
...state,
|
|
15
|
-
valueLabels: ValueLabels.build(state.values,
|
|
15
|
+
valueLabels: ValueLabels.build(state.values, env.cfg, this.#options.values ?? {}, state)
|
|
16
16
|
});
|
|
17
17
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AxisPlotEnv, AxisPlotState, PhaseStage } from '../../types/phases';
|
|
2
2
|
type AnyAxisState = AxisPlotState<any, any, any, any>;
|
|
3
3
|
/**
|
|
4
4
|
* The "tooltip" phase every axis-based plot shares: how a hovered row reads,
|
|
5
5
|
* as `tooltipFormat` - the same default on every plot, {@link TooltipState.default} -
|
|
6
6
|
* and the order its rows read in, as `tooltipSort`: highest value first, by
|
|
7
|
-
* each row's
|
|
7
|
+
* the value each row's context gives it (a stacked row's own, not its running total). The value reads as the tooltip's
|
|
8
8
|
* `decimals`, `prefix`, `suffix` and `signDisplay` ask. It
|
|
9
9
|
* runs after the scales, which say which axis holds categories.
|
|
10
10
|
*/
|
|
11
|
-
export declare class TooltipPhase<TState extends AnyAxisState> implements PhaseStage<TState,
|
|
11
|
+
export declare class TooltipPhase<TState extends AnyAxisState> implements PhaseStage<TState, AxisPlotEnv> {
|
|
12
12
|
readonly phase: "tooltip";
|
|
13
|
-
run: (state: TState,
|
|
13
|
+
run: (state: TState, env: AxisPlotEnv) => TState;
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { TooltipState } from '../../layout/tooltip/TooltipState.svelte';
|
|
2
|
-
import {
|
|
2
|
+
import { RowContext } from '../context/RowContext';
|
|
3
3
|
import { NumberFormat } from '../../utils/NumberFormat';
|
|
4
4
|
/**
|
|
5
5
|
* The "tooltip" phase every axis-based plot shares: how a hovered row reads,
|
|
6
6
|
* as `tooltipFormat` - the same default on every plot, {@link TooltipState.default} -
|
|
7
7
|
* and the order its rows read in, as `tooltipSort`: highest value first, by
|
|
8
|
-
* each row's
|
|
8
|
+
* the value each row's context gives it (a stacked row's own, not its running total). The value reads as the tooltip's
|
|
9
9
|
* `decimals`, `prefix`, `suffix` and `signDisplay` ask. It
|
|
10
10
|
* runs after the scales, which say which axis holds categories.
|
|
11
11
|
*/
|
|
12
12
|
export class TooltipPhase {
|
|
13
13
|
phase = 'tooltip';
|
|
14
|
-
run = (state,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
run = (state, env) => {
|
|
15
|
+
const contextOf = RowContext.reader(state);
|
|
16
|
+
return {
|
|
17
|
+
...state,
|
|
18
|
+
tooltipFormat: TooltipState.default(state, NumberFormat.maybe(NumberFormat.displayOf(state.tooltip), env.cfg)),
|
|
19
|
+
tooltipSort: TooltipState.descending((row) => contextOf(row).value)
|
|
20
|
+
};
|
|
21
|
+
};
|
|
19
22
|
}
|
|
@@ -18,10 +18,10 @@ export declare const GAP_KIND = "__gapKind";
|
|
|
18
18
|
* `styles.gaps` fills is read at its interpolated value, so it takes its place
|
|
19
19
|
* in a stack the way a real value would, and keeps its gap kind.
|
|
20
20
|
*/
|
|
21
|
-
export declare class TransformsPhase<TState extends TransformsStageState,
|
|
21
|
+
export declare class TransformsPhase<TState extends TransformsStageState, TEnv = unknown> implements PhaseStage<TState, TEnv> {
|
|
22
22
|
#private;
|
|
23
23
|
readonly phase: "transforms";
|
|
24
24
|
/** `connect`: whether a series' visual segments bridge into each other, as the kind's "data" phase splits them. */
|
|
25
|
-
constructor(options?: TransformsStageOptions<TState,
|
|
26
|
-
run: (state: TState,
|
|
25
|
+
constructor(options?: TransformsStageOptions<TState, TEnv>, connect?: boolean);
|
|
26
|
+
run: (state: TState, env: TEnv) => TState;
|
|
27
27
|
}
|