semiotic 3.0.0-beta.2 → 3.0.0-beta.4
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/CLAUDE.md +93 -753
- package/README.md +92 -7
- package/ai/dist/componentRegistry.js +26 -0
- package/ai/dist/{ai/mcp-server.js → mcp-server.js} +1 -1
- package/ai/dist/{ai/renderHOCToSVG.js → renderHOCToSVG.js} +2 -2
- package/dist/ChartContainer.d.ts +60 -0
- package/dist/DetailsPanel.d.ts +37 -0
- package/dist/LinkedCharts.d.ts +2 -0
- package/dist/Tooltip/Tooltip.d.ts +2 -2
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/ordinal/BarChart.d.ts +1 -0
- package/dist/charts/ordinal/BoxPlot.d.ts +1 -0
- package/dist/charts/ordinal/DonutChart.d.ts +1 -0
- package/dist/charts/ordinal/DotPlot.d.ts +1 -0
- package/dist/charts/ordinal/GroupedBarChart.d.ts +1 -0
- package/dist/charts/ordinal/Histogram.d.ts +1 -0
- package/dist/charts/ordinal/PieChart.d.ts +1 -0
- package/dist/charts/ordinal/RidgelinePlot.d.ts +1 -0
- package/dist/charts/ordinal/StackedBarChart.d.ts +1 -0
- package/dist/charts/ordinal/SwarmPlot.d.ts +1 -0
- package/dist/charts/ordinal/ViolinPlot.d.ts +1 -0
- package/dist/charts/realtime/RealtimeHeatmap.d.ts +11 -0
- package/dist/charts/realtime/RealtimeHistogram.d.ts +15 -1
- package/dist/charts/realtime/RealtimeLineChart.d.ts +6 -0
- package/dist/charts/realtime/RealtimeSwarmChart.d.ts +6 -0
- package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +6 -0
- package/dist/charts/shared/annotationRules.d.ts +3 -0
- package/dist/charts/shared/colorUtils.d.ts +17 -11
- package/dist/charts/shared/hooks.d.ts +96 -1
- package/dist/charts/shared/loess.d.ts +13 -0
- package/dist/charts/shared/networkUtils.d.ts +31 -0
- package/dist/charts/shared/tooltipUtils.d.ts +16 -0
- package/dist/charts/shared/types.d.ts +17 -2
- package/dist/charts/shared/validateChartData.d.ts +2 -3
- package/dist/charts/shared/validateProps.d.ts +18 -0
- package/dist/charts/xy/AreaChart.d.ts +4 -0
- package/dist/charts/xy/BubbleChart.d.ts +6 -0
- package/dist/charts/xy/Heatmap.d.ts +4 -0
- package/dist/charts/xy/LineChart.d.ts +6 -0
- package/dist/charts/xy/Scatterplot.d.ts +4 -0
- package/dist/charts/xy/StackedAreaChart.d.ts +4 -0
- package/dist/data/fromVegaLite.d.ts +48 -0
- package/dist/export/chartConfig.d.ts +29 -0
- package/dist/export/selectionSerializer.d.ts +20 -0
- package/dist/geometry/sankeyLinks.d.ts +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime/types.d.ts +20 -6
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +14 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.d.ts +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-network.d.ts +9 -19
- package/dist/semiotic-ordinal.d.ts +12 -14
- package/dist/semiotic-xy.d.ts +12 -18
- package/dist/semiotic.d.ts +16 -13
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/store/ObservationStore.d.ts +61 -0
- package/dist/store/SelectionStore.d.ts +9 -1
- package/dist/store/ThemeStore.d.ts +6 -1
- package/dist/store/TooltipStore.d.ts +3 -1
- package/dist/store/createStore.d.ts +4 -1
- package/dist/store/useObservation.d.ts +18 -0
- package/dist/stream/MarginalGraphics.d.ts +1 -1
- package/dist/stream/NetworkPipelineStore.d.ts +44 -0
- package/dist/stream/OrdinalCanvasHitTester.d.ts +1 -0
- package/dist/stream/OrdinalSVGOverlay.d.ts +6 -2
- package/dist/stream/ParticlePool.d.ts +2 -1
- package/dist/stream/PipelineStore.d.ts +11 -0
- package/dist/stream/SVGOverlay.d.ts +21 -2
- package/dist/stream/SceneGraph.d.ts +1 -1
- package/dist/stream/networkTypes.d.ts +58 -1
- package/dist/stream/ordinalTypes.d.ts +13 -0
- package/dist/stream/types.d.ts +14 -0
- package/dist/types/annotationTypes.d.ts +10 -0
- package/dist/types/networkTypes.d.ts +1 -2
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +30 -42
- package/ai/dist/ai/componentRegistry.js +0 -45
- package/ai/dist/src/components/Annotation.js +0 -358
- package/ai/dist/src/components/AnnotationLayer/AnnotationLayer.js +0 -369
- package/ai/dist/src/components/Axis/Axis.js +0 -374
- package/ai/dist/src/components/Axis/axisTitle.js +0 -14
- package/ai/dist/src/components/Axis/index.js +0 -7
- package/ai/dist/src/components/Axis/summaryGraphic.js +0 -37
- package/ai/dist/src/components/Brush.js +0 -84
- package/ai/dist/src/components/ChartErrorBoundary.js +0 -91
- package/ai/dist/src/components/DividedLine.js +0 -65
- package/ai/dist/src/components/Legend.js +0 -140
- package/ai/dist/src/components/LinkedCharts.js +0 -95
- package/ai/dist/src/components/ThemeProvider.js +0 -79
- package/ai/dist/src/components/Tooltip/Tooltip.js +0 -309
- package/ai/dist/src/components/TooltipPositioner/index.js +0 -132
- package/ai/dist/src/components/annotationLayerBehavior/annotationHandling.js +0 -73
- package/ai/dist/src/components/annotationLayerBehavior/d3labeler.js +0 -254
- package/ai/dist/src/components/annotationRules/baseRules.js +0 -150
- package/ai/dist/src/components/annotationRules/networkframeRules.js +0 -196
- package/ai/dist/src/components/annotationRules/xyframeRules.js +0 -297
- package/ai/dist/src/components/batchWork.js +0 -35
- package/ai/dist/src/components/charts/index.js +0 -109
- package/ai/dist/src/components/charts/network/ChordDiagram.js +0 -142
- package/ai/dist/src/components/charts/network/CirclePack.js +0 -108
- package/ai/dist/src/components/charts/network/ForceDirectedGraph.js +0 -121
- package/ai/dist/src/components/charts/network/SankeyDiagram.js +0 -155
- package/ai/dist/src/components/charts/network/TreeDiagram.js +0 -110
- package/ai/dist/src/components/charts/network/Treemap.js +0 -106
- package/ai/dist/src/components/charts/ordinal/BarChart.js +0 -156
- package/ai/dist/src/components/charts/ordinal/BoxPlot.js +0 -139
- package/ai/dist/src/components/charts/ordinal/DonutChart.js +0 -130
- package/ai/dist/src/components/charts/ordinal/DotPlot.js +0 -126
- package/ai/dist/src/components/charts/ordinal/GroupedBarChart.js +0 -129
- package/ai/dist/src/components/charts/ordinal/Histogram.js +0 -132
- package/ai/dist/src/components/charts/ordinal/PieChart.js +0 -128
- package/ai/dist/src/components/charts/ordinal/RidgelinePlot.js +0 -130
- package/ai/dist/src/components/charts/ordinal/StackedBarChart.js +0 -130
- package/ai/dist/src/components/charts/ordinal/SwarmPlot.js +0 -147
- package/ai/dist/src/components/charts/ordinal/ViolinPlot.js +0 -138
- package/ai/dist/src/components/charts/realtime/RealtimeHeatmap.js +0 -79
- package/ai/dist/src/components/charts/realtime/RealtimeHistogram.js +0 -114
- package/ai/dist/src/components/charts/realtime/RealtimeLineChart.js +0 -93
- package/ai/dist/src/components/charts/realtime/RealtimeSwarmChart.js +0 -105
- package/ai/dist/src/components/charts/realtime/RealtimeWaterfallChart.js +0 -106
- package/ai/dist/src/components/charts/shared/ChartError.js +0 -72
- package/ai/dist/src/components/charts/shared/colorUtils.js +0 -138
- package/ai/dist/src/components/charts/shared/formatUtils.js +0 -213
- package/ai/dist/src/components/charts/shared/hooks.js +0 -49
- package/ai/dist/src/components/charts/shared/legendUtils.js +0 -57
- package/ai/dist/src/components/charts/shared/selectionUtils.js +0 -67
- package/ai/dist/src/components/charts/shared/tooltipUtils.js +0 -79
- package/ai/dist/src/components/charts/shared/types.js +0 -2
- package/ai/dist/src/components/charts/shared/validateChartData.js +0 -82
- package/ai/dist/src/components/charts/shared/validateProps.js +0 -736
- package/ai/dist/src/components/charts/xy/AreaChart.js +0 -230
- package/ai/dist/src/components/charts/xy/BubbleChart.js +0 -251
- package/ai/dist/src/components/charts/xy/Heatmap.js +0 -235
- package/ai/dist/src/components/charts/xy/LineChart.js +0 -307
- package/ai/dist/src/components/charts/xy/MinimapChart.js +0 -298
- package/ai/dist/src/components/charts/xy/Scatterplot.js +0 -172
- package/ai/dist/src/components/charts/xy/ScatterplotMatrix.js +0 -426
- package/ai/dist/src/components/charts/xy/StackedAreaChart.js +0 -231
- package/ai/dist/src/components/constants/coordinateNames.js +0 -11
- package/ai/dist/src/components/constants/frame_props.js +0 -251
- package/ai/dist/src/components/data/dataFunctions.js +0 -487
- package/ai/dist/src/components/data/multiAccessorUtils.js +0 -14
- package/ai/dist/src/components/data/transforms.js +0 -143
- package/ai/dist/src/components/data/unflowedFunctions.js +0 -5
- package/ai/dist/src/components/export/exportChart.js +0 -121
- package/ai/dist/src/components/generic_utilities/functions.js +0 -5
- package/ai/dist/src/components/geometry/areaDrawing.js +0 -312
- package/ai/dist/src/components/geometry/contourLayout.js +0 -73
- package/ai/dist/src/components/geometry/hexbinLayout.js +0 -163
- package/ai/dist/src/components/geometry/lineDrawing.js +0 -356
- package/ai/dist/src/components/geometry/sankeyLinks.js +0 -331
- package/ai/dist/src/components/geometry/summaryLayouts.js +0 -136
- package/ai/dist/src/components/index.js +0 -18
- package/ai/dist/src/components/processing/InteractionItems.js +0 -223
- package/ai/dist/src/components/processing/hierarchyUtils.js +0 -104
- package/ai/dist/src/components/processing/layouts/chordLayout.js +0 -58
- package/ai/dist/src/components/processing/layouts/forceLayout.js +0 -142
- package/ai/dist/src/components/processing/layouts/hierarchyLayout.js +0 -31
- package/ai/dist/src/components/processing/layouts/index.js +0 -32
- package/ai/dist/src/components/processing/layouts/sankeyLayout.js +0 -96
- package/ai/dist/src/components/processing/layouts/simpleLayouts.js +0 -34
- package/ai/dist/src/components/processing/layouts/types.js +0 -2
- package/ai/dist/src/components/processing/networkDefaults.js +0 -39
- package/ai/dist/src/components/realtime/BinAccumulator.js +0 -36
- package/ai/dist/src/components/realtime/IncrementalExtent.js +0 -55
- package/ai/dist/src/components/realtime/RingBuffer.js +0 -104
- package/ai/dist/src/components/realtime/renderers/barRenderer.js +0 -133
- package/ai/dist/src/components/realtime/renderers/candlestickRenderer.js +0 -7
- package/ai/dist/src/components/realtime/renderers/lineRenderer.js +0 -164
- package/ai/dist/src/components/realtime/renderers/swarmRenderer.js +0 -91
- package/ai/dist/src/components/realtime/renderers/types.js +0 -2
- package/ai/dist/src/components/realtime/renderers/waterfallRenderer.js +0 -163
- package/ai/dist/src/components/realtime/types.js +0 -2
- package/ai/dist/src/components/semiotic-ai.js +0 -89
- package/ai/dist/src/components/semiotic-data.js +0 -12
- package/ai/dist/src/components/semiotic-network.js +0 -38
- package/ai/dist/src/components/semiotic-ordinal.js +0 -28
- package/ai/dist/src/components/semiotic-realtime.js +0 -30
- package/ai/dist/src/components/semiotic-server.js +0 -8
- package/ai/dist/src/components/semiotic-xy.js +0 -35
- package/ai/dist/src/components/semiotic.js +0 -109
- package/ai/dist/src/components/server/renderToStaticSVG.js +0 -594
- package/ai/dist/src/components/store/SelectionStore.js +0 -91
- package/ai/dist/src/components/store/ThemeStore.js +0 -78
- package/ai/dist/src/components/store/TooltipStore.js +0 -13
- package/ai/dist/src/components/store/createStore.js +0 -81
- package/ai/dist/src/components/store/useSelection.js +0 -133
- package/ai/dist/src/components/stream/CanvasHitTester.js +0 -164
- package/ai/dist/src/components/stream/DataSourceAdapter.js +0 -99
- package/ai/dist/src/components/stream/MarginalGraphics.js +0 -266
- package/ai/dist/src/components/stream/NetworkCanvasHitTester.js +0 -228
- package/ai/dist/src/components/stream/NetworkPipelineStore.js +0 -498
- package/ai/dist/src/components/stream/NetworkSVGOverlay.js +0 -70
- package/ai/dist/src/components/stream/NetworkSceneGraph.js +0 -38
- package/ai/dist/src/components/stream/OrdinalCanvasHitTester.js +0 -146
- package/ai/dist/src/components/stream/OrdinalPipelineStore.js +0 -786
- package/ai/dist/src/components/stream/OrdinalSVGOverlay.js +0 -130
- package/ai/dist/src/components/stream/ParticlePool.js +0 -174
- package/ai/dist/src/components/stream/PipelineStore.js +0 -1243
- package/ai/dist/src/components/stream/SVGOverlay.js +0 -129
- package/ai/dist/src/components/stream/SceneGraph.js +0 -132
- package/ai/dist/src/components/stream/StreamNetworkFrame.js +0 -561
- package/ai/dist/src/components/stream/StreamOrdinalFrame.js +0 -492
- package/ai/dist/src/components/stream/StreamXYFrame.js +0 -590
- package/ai/dist/src/components/stream/accessorUtils.js +0 -20
- package/ai/dist/src/components/stream/index.js +0 -32
- package/ai/dist/src/components/stream/layouts/chordLayoutPlugin.js +0 -352
- package/ai/dist/src/components/stream/layouts/forceLayoutPlugin.js +0 -230
- package/ai/dist/src/components/stream/layouts/hierarchyLayoutPlugin.js +0 -568
- package/ai/dist/src/components/stream/layouts/index.js +0 -28
- package/ai/dist/src/components/stream/layouts/sankeyLayoutPlugin.js +0 -245
- package/ai/dist/src/components/stream/networkTypes.js +0 -17
- package/ai/dist/src/components/stream/ordinalSceneBuilders/barScene.js +0 -126
- package/ai/dist/src/components/stream/ordinalSceneBuilders/connectorScene.js +0 -62
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pieScene.js +0 -33
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pointScene.js +0 -63
- package/ai/dist/src/components/stream/ordinalSceneBuilders/statisticalScene.js +0 -278
- package/ai/dist/src/components/stream/ordinalSceneBuilders/timelineScene.js +0 -30
- package/ai/dist/src/components/stream/ordinalSceneBuilders/types.js +0 -2
- package/ai/dist/src/components/stream/ordinalTypes.js +0 -2
- package/ai/dist/src/components/stream/renderers/areaCanvasRenderer.js +0 -48
- package/ai/dist/src/components/stream/renderers/barCanvasRenderer.js +0 -70
- package/ai/dist/src/components/stream/renderers/boxplotCanvasRenderer.js +0 -75
- package/ai/dist/src/components/stream/renderers/candlestickCanvasRenderer.js +0 -28
- package/ai/dist/src/components/stream/renderers/connectorCanvasRenderer.js +0 -47
- package/ai/dist/src/components/stream/renderers/heatmapCanvasRenderer.js +0 -31
- package/ai/dist/src/components/stream/renderers/lineCanvasRenderer.js +0 -140
- package/ai/dist/src/components/stream/renderers/networkArcRenderer.js +0 -38
- package/ai/dist/src/components/stream/renderers/networkCircleRenderer.js +0 -37
- package/ai/dist/src/components/stream/renderers/networkEdgeRenderer.js +0 -102
- package/ai/dist/src/components/stream/renderers/networkParticleRenderer.js +0 -63
- package/ai/dist/src/components/stream/renderers/networkRectRenderer.js +0 -35
- package/ai/dist/src/components/stream/renderers/pointCanvasRenderer.js +0 -38
- package/ai/dist/src/components/stream/renderers/swarmCanvasRenderer.js +0 -10
- package/ai/dist/src/components/stream/renderers/types.js +0 -2
- package/ai/dist/src/components/stream/renderers/violinCanvasRenderer.js +0 -47
- package/ai/dist/src/components/stream/renderers/waterfallCanvasRenderer.js +0 -38
- package/ai/dist/src/components/stream/renderers/wedgeCanvasRenderer.js +0 -33
- package/ai/dist/src/components/stream/types.js +0 -2
- package/ai/dist/src/components/types/annotationTypes.js +0 -2
- package/ai/dist/src/components/types/canvasTypes.js +0 -2
- package/ai/dist/src/components/types/generalTypes.js +0 -2
- package/ai/dist/src/components/types/interactionTypes.js +0 -2
- package/ai/dist/src/components/types/legendTypes.js +0 -2
- package/ai/dist/src/components/types/networkTypes.js +0 -2
- package/ai/dist/src/components/types/ordinalTypes.js +0 -2
- package/ai/dist/src/components/types/xyTypes.js +0 -2
- package/ai/dist/src/components/useBoundingRect.js +0 -24
- package/ai/dist/src/components/visualizationLayerBehavior/axis.js +0 -301
- package/ai/dist/src/components/visualizationLayerBehavior/general.js +0 -435
- package/ai/dist/src/setupTests.js +0 -4
- package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -25
- package/dist/Axis/Axis.d.ts +0 -7
- package/dist/Axis/axisTitle.d.ts +0 -10
- package/dist/Axis/index.d.ts +0 -2
- package/dist/Axis/summaryGraphic.d.ts +0 -17
- package/dist/Brush.d.ts +0 -12
- package/dist/DividedLine.d.ts +0 -16
- package/dist/TooltipPositioner/index.d.ts +0 -7
- package/dist/annotationLayerBehavior/annotationHandling.d.ts +0 -19
- package/dist/annotationLayerBehavior/d3labeler.d.ts +0 -9
- package/dist/annotationRules/baseRules.d.ts +0 -25
- package/dist/annotationRules/networkframeRules.d.ts +0 -48
- package/dist/annotationRules/xyframeRules.d.ts +0 -117
- package/dist/batchWork.d.ts +0 -6
- package/dist/constants/coordinateNames.d.ts +0 -8
- package/dist/constants/frame_props.d.ts +0 -13
- package/dist/data/dataFunctions.d.ts +0 -45
- package/dist/data/multiAccessorUtils.d.ts +0 -1
- package/dist/data/unflowedFunctions.d.ts +0 -1
- package/dist/generic_utilities/functions.d.ts +0 -1
- package/dist/geometry/areaDrawing.d.ts +0 -21
- package/dist/geometry/contourLayout.d.ts +0 -6
- package/dist/geometry/hexbinLayout.d.ts +0 -7
- package/dist/geometry/lineDrawing.d.ts +0 -71
- package/dist/geometry/summaryLayouts.d.ts +0 -45
- package/dist/index.d.ts +0 -1
- package/dist/network.js +0 -7495
- package/dist/network.js.map +0 -1
- package/dist/network.module.js +0 -7458
- package/dist/network.module.js.map +0 -1
- package/dist/ordinal.js +0 -6497
- package/dist/ordinal.js.map +0 -1
- package/dist/ordinal.module.js +0 -6465
- package/dist/ordinal.module.js.map +0 -1
- package/dist/processing/InteractionItems.d.ts +0 -13
- package/dist/processing/hierarchyUtils.d.ts +0 -16
- package/dist/processing/layouts/chordLayout.d.ts +0 -2
- package/dist/processing/layouts/forceLayout.d.ts +0 -3
- package/dist/processing/layouts/hierarchyLayout.d.ts +0 -10
- package/dist/processing/layouts/index.d.ts +0 -8
- package/dist/processing/layouts/sankeyLayout.d.ts +0 -8
- package/dist/processing/layouts/simpleLayouts.d.ts +0 -7
- package/dist/processing/layouts/types.d.ts +0 -17
- package/dist/processing/networkDefaults.d.ts +0 -36
- package/dist/realtime/renderers/barRenderer.d.ts +0 -2
- package/dist/realtime/renderers/candlestickRenderer.d.ts +0 -2
- package/dist/realtime/renderers/lineRenderer.d.ts +0 -2
- package/dist/realtime/renderers/swarmRenderer.d.ts +0 -2
- package/dist/realtime.js +0 -7072
- package/dist/realtime.js.map +0 -1
- package/dist/realtime.module.js +0 -7043
- package/dist/realtime.module.js.map +0 -1
- package/dist/semiotic-ai.js +0 -13323
- package/dist/semiotic-ai.js.map +0 -1
- package/dist/semiotic-ai.module.js +0 -13264
- package/dist/semiotic-ai.module.js.map +0 -1
- package/dist/semiotic-data.js +0 -141
- package/dist/semiotic-data.js.map +0 -1
- package/dist/semiotic-data.module.js +0 -136
- package/dist/semiotic-data.module.js.map +0 -1
- package/dist/semiotic.js +0 -16351
- package/dist/semiotic.js.map +0 -1
- package/dist/semiotic.module.js +0 -16265
- package/dist/semiotic.module.js.map +0 -1
- package/dist/server.js +0 -5191
- package/dist/server.js.map +0 -1
- package/dist/server.module.js +0 -5166
- package/dist/server.module.js.map +0 -1
- package/dist/stream/NetworkSceneGraph.d.ts +0 -14
- package/dist/stream/index.d.ts +0 -16
- package/dist/types/canvasTypes.d.ts +0 -9
- package/dist/types/xyTypes.d.ts +0 -24
- package/dist/useBoundingRect.d.ts +0 -2
- package/dist/visualizationLayerBehavior/axis.d.ts +0 -36
- package/dist/visualizationLayerBehavior/general.d.ts +0 -80
- package/dist/xy.js +0 -6993
- package/dist/xy.js.map +0 -1
- package/dist/xy.module.js +0 -6957
- package/dist/xy.module.js.map +0 -1
|
@@ -1,786 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OrdinalPipelineStore = void 0;
|
|
4
|
-
const d3_scale_1 = require("d3-scale");
|
|
5
|
-
const RingBuffer_1 = require("../realtime/RingBuffer");
|
|
6
|
-
const IncrementalExtent_1 = require("../realtime/IncrementalExtent");
|
|
7
|
-
const accessorUtils_1 = require("./accessorUtils");
|
|
8
|
-
const barScene_1 = require("./ordinalSceneBuilders/barScene");
|
|
9
|
-
const pointScene_1 = require("./ordinalSceneBuilders/pointScene");
|
|
10
|
-
const pieScene_1 = require("./ordinalSceneBuilders/pieScene");
|
|
11
|
-
const statisticalScene_1 = require("./ordinalSceneBuilders/statisticalScene");
|
|
12
|
-
const timelineScene_1 = require("./ordinalSceneBuilders/timelineScene");
|
|
13
|
-
const connectorScene_1 = require("./ordinalSceneBuilders/connectorScene");
|
|
14
|
-
const SCENE_BUILDERS = {
|
|
15
|
-
bar: barScene_1.buildBarScene,
|
|
16
|
-
clusterbar: barScene_1.buildClusterBarScene,
|
|
17
|
-
point: pointScene_1.buildPointScene,
|
|
18
|
-
swarm: pointScene_1.buildSwarmScene,
|
|
19
|
-
pie: pieScene_1.buildPieScene,
|
|
20
|
-
donut: pieScene_1.buildPieScene,
|
|
21
|
-
boxplot: statisticalScene_1.buildBoxplotScene,
|
|
22
|
-
violin: statisticalScene_1.buildViolinScene,
|
|
23
|
-
histogram: statisticalScene_1.buildHistogramScene,
|
|
24
|
-
ridgeline: statisticalScene_1.buildRidgelineScene,
|
|
25
|
-
timeline: timelineScene_1.buildTimelineScene,
|
|
26
|
-
};
|
|
27
|
-
// ── OrdinalPipelineStore ───────────────────────────────────────────────
|
|
28
|
-
class OrdinalPipelineStore {
|
|
29
|
-
constructor(config) {
|
|
30
|
-
this.rExtent = new IncrementalExtent_1.IncrementalExtent();
|
|
31
|
-
/** Per-accessor extents for multiAxis mode */
|
|
32
|
-
this.rExtents = [];
|
|
33
|
-
/** All resolved rAccessors (length > 1 when multiAxis) */
|
|
34
|
-
this.rAccessors = [];
|
|
35
|
-
/** Discovered categories in insertion order */
|
|
36
|
-
this.categories = new Set();
|
|
37
|
-
/** Lazy color map built from colorScheme for resolvePieceStyle */
|
|
38
|
-
this._colorSchemeMap = null;
|
|
39
|
-
this._colorSchemeIndex = 0;
|
|
40
|
-
// ── Pulse tracking ──────────────────────────────────────────────────
|
|
41
|
-
this.timestampBuffer = null;
|
|
42
|
-
// ── Transition animation ────────────────────────────────────────────
|
|
43
|
-
this.activeTransition = null;
|
|
44
|
-
this.prevPositionMap = new Map();
|
|
45
|
-
// ── Staleness tracking ──────────────────────────────────────────────
|
|
46
|
-
this.lastIngestTime = 0;
|
|
47
|
-
this.scales = null;
|
|
48
|
-
/** Per-accessor scales for multiAxis */
|
|
49
|
-
this.multiScales = [];
|
|
50
|
-
this.scene = [];
|
|
51
|
-
this.columns = {};
|
|
52
|
-
this.version = 0;
|
|
53
|
-
this.config = config;
|
|
54
|
-
this.buffer = new RingBuffer_1.RingBuffer(config.windowSize);
|
|
55
|
-
// Resolve accessors
|
|
56
|
-
this.getO = (0, accessorUtils_1.resolveStringAccessor)(config.oAccessor || config.categoryAccessor, "category");
|
|
57
|
-
const isStreaming = config.runtimeMode === "streaming";
|
|
58
|
-
// Resolve rAccessor — may be an array for multiAxis
|
|
59
|
-
const rawR = config.rAccessor;
|
|
60
|
-
if (Array.isArray(rawR)) {
|
|
61
|
-
this.rAccessors = rawR.map(acc => (0, accessorUtils_1.resolveAccessor)(acc, "value"));
|
|
62
|
-
this.getR = this.rAccessors[0];
|
|
63
|
-
this.rExtents = rawR.map(() => new IncrementalExtent_1.IncrementalExtent());
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
if (isStreaming && (config.timeAccessor || config.valueAccessor)) {
|
|
67
|
-
this.getR = (0, accessorUtils_1.resolveAccessor)(config.valueAccessor || rawR, "value");
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
this.getR = (0, accessorUtils_1.resolveAccessor)(rawR, "value");
|
|
71
|
-
}
|
|
72
|
-
this.rAccessors = [this.getR];
|
|
73
|
-
this.rExtents = [this.rExtent];
|
|
74
|
-
}
|
|
75
|
-
this.getStack = (0, accessorUtils_1.resolveStringAccessor)(config.stackBy);
|
|
76
|
-
this.getGroup = (0, accessorUtils_1.resolveStringAccessor)(config.groupBy);
|
|
77
|
-
this.getColor = (0, accessorUtils_1.resolveStringAccessor)(config.colorAccessor);
|
|
78
|
-
this.getConnector = (0, accessorUtils_1.resolveStringAccessor)(config.connectorAccessor);
|
|
79
|
-
if (config.pulse) {
|
|
80
|
-
this.timestampBuffer = new RingBuffer_1.RingBuffer(config.windowSize);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
// ── Data ingestion ───────────────────────────────────────────────────
|
|
84
|
-
ingest(changeset) {
|
|
85
|
-
const now = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
86
|
-
this.lastIngestTime = now;
|
|
87
|
-
if (changeset.bounded) {
|
|
88
|
-
this.buffer.clear();
|
|
89
|
-
this.rExtent.clear();
|
|
90
|
-
this.categories.clear();
|
|
91
|
-
if (this.timestampBuffer)
|
|
92
|
-
this.timestampBuffer.clear();
|
|
93
|
-
const targetSize = changeset.totalSize || changeset.inserts.length;
|
|
94
|
-
if (targetSize > this.buffer.capacity) {
|
|
95
|
-
this.buffer.resize(targetSize);
|
|
96
|
-
if (this.timestampBuffer && targetSize > this.timestampBuffer.capacity) {
|
|
97
|
-
this.timestampBuffer.resize(targetSize);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
for (const d of changeset.inserts) {
|
|
101
|
-
this.buffer.push(d);
|
|
102
|
-
if (this.timestampBuffer)
|
|
103
|
-
this.timestampBuffer.push(now);
|
|
104
|
-
this.categories.add(this.getO(d));
|
|
105
|
-
this.pushValueExtent(d);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
// Streaming append
|
|
110
|
-
for (const d of changeset.inserts) {
|
|
111
|
-
const evicted = this.buffer.push(d);
|
|
112
|
-
if (this.timestampBuffer)
|
|
113
|
-
this.timestampBuffer.push(now);
|
|
114
|
-
this.categories.add(this.getO(d));
|
|
115
|
-
this.pushValueExtent(d);
|
|
116
|
-
if (evicted != null) {
|
|
117
|
-
this.evictValueExtent(evicted);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
pushValueExtent(d) {
|
|
124
|
-
if (this.config.chartType === "timeline") {
|
|
125
|
-
const range = this.getRawRange(d);
|
|
126
|
-
if (range) {
|
|
127
|
-
this.rExtent.push(range[0]);
|
|
128
|
-
this.rExtent.push(range[1]);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
else if (this.rAccessors.length > 1) {
|
|
132
|
-
// MultiAxis: track extents per accessor
|
|
133
|
-
for (let i = 0; i < this.rAccessors.length; i++) {
|
|
134
|
-
this.rExtents[i].push(this.rAccessors[i](d));
|
|
135
|
-
}
|
|
136
|
-
// Also push to primary extent for single-scale fallback
|
|
137
|
-
this.rExtent.push(this.getR(d));
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
this.rExtent.push(this.getR(d));
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
evictValueExtent(d) {
|
|
144
|
-
if (this.config.chartType === "timeline") {
|
|
145
|
-
const range = this.getRawRange(d);
|
|
146
|
-
if (range) {
|
|
147
|
-
this.rExtent.evict(range[0]);
|
|
148
|
-
this.rExtent.evict(range[1]);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
else if (this.rAccessors.length > 1) {
|
|
152
|
-
for (let i = 0; i < this.rAccessors.length; i++) {
|
|
153
|
-
this.rExtents[i].evict(this.rAccessors[i](d));
|
|
154
|
-
}
|
|
155
|
-
this.rExtent.evict(this.getR(d));
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
this.rExtent.evict(this.getR(d));
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
/** For timeline type: resolve rAccessor as a [start, end] pair */
|
|
162
|
-
getRawRange(d) {
|
|
163
|
-
const acc = this.config.rAccessor;
|
|
164
|
-
if (!acc)
|
|
165
|
-
return null;
|
|
166
|
-
const result = typeof acc === "function" ? acc(d) : d[acc];
|
|
167
|
-
if (Array.isArray(result) && result.length >= 2) {
|
|
168
|
-
return [+result[0], +result[1]];
|
|
169
|
-
}
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
|
-
// ── Scene computation ────────────────────────────────────────────────
|
|
173
|
-
computeScene(layout) {
|
|
174
|
-
const { config, buffer } = this;
|
|
175
|
-
if (buffer.size === 0) {
|
|
176
|
-
this.scales = null;
|
|
177
|
-
this.scene = [];
|
|
178
|
-
this.columns = {};
|
|
179
|
-
this.version++;
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
// Recalculate dirty extents
|
|
183
|
-
if (this.rExtent.dirty) {
|
|
184
|
-
this.rExtent.recalculate(buffer, this.getR);
|
|
185
|
-
}
|
|
186
|
-
const data = buffer.toArray();
|
|
187
|
-
const projection = config.projection || "vertical";
|
|
188
|
-
// 1. Resolve category extent
|
|
189
|
-
const oExtent = config.oExtent || this.resolveCategories(data);
|
|
190
|
-
// 2. Compute value extent
|
|
191
|
-
const rDomain = this.computeValueDomain(data, oExtent);
|
|
192
|
-
// 3. Build scales
|
|
193
|
-
const isVertical = projection === "vertical";
|
|
194
|
-
const isHorizontal = projection === "horizontal";
|
|
195
|
-
const isRadial = projection === "radial";
|
|
196
|
-
const padding = config.barPadding != null ? config.barPadding / (isVertical ? layout.width : layout.height) : 0.1;
|
|
197
|
-
let oScale;
|
|
198
|
-
let rScale;
|
|
199
|
-
if (isRadial) {
|
|
200
|
-
// Radial: oScale maps to [0, 2π], rScale maps outward
|
|
201
|
-
oScale = (0, d3_scale_1.scaleBand)().domain(oExtent).range([0, 1]).padding(0);
|
|
202
|
-
const maxR = Math.min(layout.width, layout.height) / 2;
|
|
203
|
-
const innerR = config.innerRadius || 0;
|
|
204
|
-
rScale = (0, d3_scale_1.scaleLinear)().domain(rDomain).range([innerR, maxR]);
|
|
205
|
-
}
|
|
206
|
-
else if (isHorizontal) {
|
|
207
|
-
oScale = (0, d3_scale_1.scaleBand)().domain(oExtent).range([0, layout.height]).padding(padding);
|
|
208
|
-
rScale = (0, d3_scale_1.scaleLinear)().domain(rDomain).range([0, layout.width]);
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
// vertical (default)
|
|
212
|
-
oScale = (0, d3_scale_1.scaleBand)().domain(oExtent).range([0, layout.width]).padding(padding);
|
|
213
|
-
rScale = (0, d3_scale_1.scaleLinear)().domain(rDomain).range([layout.height, 0]);
|
|
214
|
-
}
|
|
215
|
-
this.scales = { o: oScale, r: rScale, projection };
|
|
216
|
-
// 3b. Build per-accessor scales for multiAxis mode
|
|
217
|
-
if (this.rAccessors.length > 1 && config.multiAxis) {
|
|
218
|
-
this.multiScales = this.rAccessors.map((acc, i) => {
|
|
219
|
-
const ext = this.rExtents[i];
|
|
220
|
-
if (ext.dirty)
|
|
221
|
-
ext.recalculate(buffer, acc);
|
|
222
|
-
let [min, max] = ext.extent;
|
|
223
|
-
if (min === Infinity) {
|
|
224
|
-
min = 0;
|
|
225
|
-
max = 1;
|
|
226
|
-
}
|
|
227
|
-
const pad = config.extentPadding || 0.05;
|
|
228
|
-
const range = max - min;
|
|
229
|
-
const padAmt = range > 0 ? range * pad : 1;
|
|
230
|
-
min -= padAmt;
|
|
231
|
-
max += padAmt;
|
|
232
|
-
if (min > 0)
|
|
233
|
-
min = 0;
|
|
234
|
-
if (isHorizontal)
|
|
235
|
-
return (0, d3_scale_1.scaleLinear)().domain([min, max]).range([0, layout.width]);
|
|
236
|
-
return (0, d3_scale_1.scaleLinear)().domain([min, max]).range([layout.height, 0]);
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
this.multiScales = [];
|
|
241
|
-
}
|
|
242
|
-
// 3c. Expand data for multi-accessor: each datum becomes N pieces with rIndex
|
|
243
|
-
let expandedData = data;
|
|
244
|
-
if (this.rAccessors.length > 1) {
|
|
245
|
-
expandedData = data.flatMap(d => this.rAccessors.map((acc, rIndex) => ({
|
|
246
|
-
...d,
|
|
247
|
-
__rIndex: rIndex,
|
|
248
|
-
__rValue: acc(d),
|
|
249
|
-
__rName: this.resolveRAccessorName(rIndex)
|
|
250
|
-
})));
|
|
251
|
-
}
|
|
252
|
-
// 4. Build projected columns
|
|
253
|
-
this.columns = this.buildColumns(expandedData, oExtent, oScale, projection, layout);
|
|
254
|
-
// Snapshot positions for transition animation
|
|
255
|
-
if (this.config.transition && this.scene.length > 0) {
|
|
256
|
-
this.snapshotPositions();
|
|
257
|
-
}
|
|
258
|
-
// 5. Build scene graph
|
|
259
|
-
this.scene = this.buildSceneNodes(expandedData, layout);
|
|
260
|
-
// Apply decay/pulse to discrete scene nodes
|
|
261
|
-
if (this.config.decay) {
|
|
262
|
-
this.applyDecay(this.scene, data);
|
|
263
|
-
}
|
|
264
|
-
if (this.config.pulse) {
|
|
265
|
-
this.applyPulse(this.scene, data);
|
|
266
|
-
}
|
|
267
|
-
// Start transition animation
|
|
268
|
-
if (this.config.transition && this.prevPositionMap.size > 0) {
|
|
269
|
-
this.startTransition();
|
|
270
|
-
}
|
|
271
|
-
this.version++;
|
|
272
|
-
}
|
|
273
|
-
resolveRAccessorName(index) {
|
|
274
|
-
const acc = Array.isArray(this.config.rAccessor) ? this.config.rAccessor[index] : this.config.rAccessor;
|
|
275
|
-
return typeof acc === "string" ? acc : `value${index}`;
|
|
276
|
-
}
|
|
277
|
-
// ── Category resolution ──────────────────────────────────────────────
|
|
278
|
-
resolveCategories(data) {
|
|
279
|
-
const cats = Array.from(this.categories);
|
|
280
|
-
const sort = this.config.oSort;
|
|
281
|
-
// In streaming mode, preserve insertion order by default to avoid
|
|
282
|
-
// jarring category shuffling as values fluctuate in the sliding window
|
|
283
|
-
if (this.config.runtimeMode === "streaming" && sort === undefined) {
|
|
284
|
-
return cats;
|
|
285
|
-
}
|
|
286
|
-
if (sort === false)
|
|
287
|
-
return cats;
|
|
288
|
-
if (typeof sort === "function") {
|
|
289
|
-
return cats.sort(sort);
|
|
290
|
-
}
|
|
291
|
-
// Default: sort by total value descending (unless explicitly "asc")
|
|
292
|
-
const sums = new Map();
|
|
293
|
-
for (const d of data) {
|
|
294
|
-
const cat = this.getO(d);
|
|
295
|
-
sums.set(cat, (sums.get(cat) || 0) + Math.abs(this.getR(d)));
|
|
296
|
-
}
|
|
297
|
-
if (sort === "asc") {
|
|
298
|
-
return cats.sort((a, b) => (sums.get(a) || 0) - (sums.get(b) || 0));
|
|
299
|
-
}
|
|
300
|
-
// Default, true, "desc", or undefined → descending
|
|
301
|
-
return cats.sort((a, b) => (sums.get(b) || 0) - (sums.get(a) || 0));
|
|
302
|
-
}
|
|
303
|
-
// ── Value domain computation ─────────────────────────────────────────
|
|
304
|
-
computeValueDomain(data, oExtent) {
|
|
305
|
-
const chartType = this.config.chartType;
|
|
306
|
-
const pad = this.config.extentPadding || 0.05;
|
|
307
|
-
// For radial pie/donut, the value axis represents proportions
|
|
308
|
-
// But for radial point (radar), use actual data values
|
|
309
|
-
if (this.config.projection === "radial" && (chartType === "pie" || chartType === "donut")) {
|
|
310
|
-
return [0, 1];
|
|
311
|
-
}
|
|
312
|
-
let min = 0;
|
|
313
|
-
let max = 0;
|
|
314
|
-
if (chartType === "bar" && this.getStack) {
|
|
315
|
-
// Stacked bars: compute per-category stacked sums
|
|
316
|
-
const posSums = new Map();
|
|
317
|
-
const negSums = new Map();
|
|
318
|
-
for (const d of data) {
|
|
319
|
-
const cat = this.getO(d);
|
|
320
|
-
const val = this.getR(d);
|
|
321
|
-
if (val >= 0) {
|
|
322
|
-
posSums.set(cat, (posSums.get(cat) || 0) + val);
|
|
323
|
-
}
|
|
324
|
-
else {
|
|
325
|
-
negSums.set(cat, (negSums.get(cat) || 0) + val);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
for (const s of posSums.values())
|
|
329
|
-
if (s > max)
|
|
330
|
-
max = s;
|
|
331
|
-
for (const s of negSums.values())
|
|
332
|
-
if (s < min)
|
|
333
|
-
min = s;
|
|
334
|
-
}
|
|
335
|
-
else if (chartType === "bar") {
|
|
336
|
-
// Non-stacked bars: pieces within each category are summed,
|
|
337
|
-
// so the domain must cover the per-category total
|
|
338
|
-
const catSums = new Map();
|
|
339
|
-
for (const d of data) {
|
|
340
|
-
const cat = this.getO(d);
|
|
341
|
-
const val = this.getR(d);
|
|
342
|
-
catSums.set(cat, (catSums.get(cat) || 0) + val);
|
|
343
|
-
}
|
|
344
|
-
for (const s of catSums.values()) {
|
|
345
|
-
if (s > max)
|
|
346
|
-
max = s;
|
|
347
|
-
if (s < min)
|
|
348
|
-
min = s;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
else if (chartType === "clusterbar") {
|
|
352
|
-
// Cluster bars: individual values (side-by-side)
|
|
353
|
-
for (const d of data) {
|
|
354
|
-
const val = this.getR(d);
|
|
355
|
-
if (val > max)
|
|
356
|
-
max = val;
|
|
357
|
-
if (val < min)
|
|
358
|
-
min = val;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
else {
|
|
362
|
-
// Points, swarm, summary types: raw data extent
|
|
363
|
-
const dataMin = this.rExtent.extent[0];
|
|
364
|
-
const dataMax = this.rExtent.extent[1];
|
|
365
|
-
if (dataMin !== Infinity)
|
|
366
|
-
min = dataMin;
|
|
367
|
-
if (dataMax !== -Infinity)
|
|
368
|
-
max = dataMax;
|
|
369
|
-
}
|
|
370
|
-
// Apply user-specified extents
|
|
371
|
-
if (this.config.rExtent) {
|
|
372
|
-
if (this.config.rExtent[0] != null)
|
|
373
|
-
min = this.config.rExtent[0];
|
|
374
|
-
if (this.config.rExtent[1] != null)
|
|
375
|
-
max = this.config.rExtent[1];
|
|
376
|
-
}
|
|
377
|
-
// Apply padding
|
|
378
|
-
const range = max - min;
|
|
379
|
-
const padAmount = range > 0 ? range * pad : 1;
|
|
380
|
-
if (!this.config.rExtent?.[0])
|
|
381
|
-
min -= padAmount;
|
|
382
|
-
if (!this.config.rExtent?.[1])
|
|
383
|
-
max += padAmount;
|
|
384
|
-
// Bars should include zero
|
|
385
|
-
if (chartType === "bar" || chartType === "clusterbar") {
|
|
386
|
-
if (min > 0)
|
|
387
|
-
min = 0;
|
|
388
|
-
if (max < 0)
|
|
389
|
-
max = 0;
|
|
390
|
-
}
|
|
391
|
-
return [min, max];
|
|
392
|
-
}
|
|
393
|
-
// ── Column projection ────────────────────────────────────────────────
|
|
394
|
-
buildColumns(data, oExtent, oScale, projection, layout) {
|
|
395
|
-
const columns = {};
|
|
396
|
-
// Group data by category
|
|
397
|
-
const grouped = new Map();
|
|
398
|
-
for (const d of data) {
|
|
399
|
-
const cat = this.getO(d);
|
|
400
|
-
if (!grouped.has(cat))
|
|
401
|
-
grouped.set(cat, []);
|
|
402
|
-
grouped.get(cat).push(d);
|
|
403
|
-
}
|
|
404
|
-
// Compute total for radial proportions
|
|
405
|
-
let total = 0;
|
|
406
|
-
if (projection === "radial") {
|
|
407
|
-
for (const d of data) {
|
|
408
|
-
total += Math.abs(this.getR(d));
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
// Dynamic column widths: compute proportional widths instead of uniform bands
|
|
412
|
-
const dcw = this.config.dynamicColumnWidth;
|
|
413
|
-
let dynamicWidths = null;
|
|
414
|
-
if (dcw && projection !== "radial") {
|
|
415
|
-
dynamicWidths = new Map();
|
|
416
|
-
let totalWidth = 0;
|
|
417
|
-
for (const cat of oExtent) {
|
|
418
|
-
const pieceData = grouped.get(cat) || [];
|
|
419
|
-
let colValue;
|
|
420
|
-
if (typeof dcw === "string") {
|
|
421
|
-
colValue = pieceData.reduce((s, d) => s + (Number(d[dcw]) || 0), 0);
|
|
422
|
-
}
|
|
423
|
-
else {
|
|
424
|
-
colValue = dcw(pieceData);
|
|
425
|
-
}
|
|
426
|
-
dynamicWidths.set(cat, colValue);
|
|
427
|
-
totalWidth += colValue;
|
|
428
|
-
}
|
|
429
|
-
// Normalize to available space
|
|
430
|
-
const availableSpace = projection === "horizontal" ? layout.height : layout.width;
|
|
431
|
-
const paddingTotal = oScale.padding() * oScale.step() * oExtent.length;
|
|
432
|
-
const usableSpace = availableSpace - paddingTotal;
|
|
433
|
-
if (totalWidth > 0) {
|
|
434
|
-
for (const [cat, val] of dynamicWidths) {
|
|
435
|
-
dynamicWidths.set(cat, (val / totalWidth) * usableSpace);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
let cumulativePct = 0;
|
|
440
|
-
let cumulativeX = 0;
|
|
441
|
-
for (const cat of oExtent) {
|
|
442
|
-
const pieceData = grouped.get(cat) || [];
|
|
443
|
-
const catSum = pieceData.reduce((s, d) => s + Math.abs(this.getR(d)), 0);
|
|
444
|
-
const pct = total > 0 ? catSum / total : 0;
|
|
445
|
-
let bandStart;
|
|
446
|
-
let bandwidth;
|
|
447
|
-
if (dynamicWidths) {
|
|
448
|
-
bandStart = cumulativeX;
|
|
449
|
-
bandwidth = dynamicWidths.get(cat) || oScale.bandwidth();
|
|
450
|
-
cumulativeX += bandwidth + (oScale.padding() * oScale.step());
|
|
451
|
-
}
|
|
452
|
-
else {
|
|
453
|
-
bandStart = oScale(cat) ?? 0;
|
|
454
|
-
bandwidth = oScale.bandwidth();
|
|
455
|
-
}
|
|
456
|
-
columns[cat] = {
|
|
457
|
-
name: cat,
|
|
458
|
-
x: bandStart,
|
|
459
|
-
y: 0,
|
|
460
|
-
width: bandwidth,
|
|
461
|
-
middle: bandStart + bandwidth / 2,
|
|
462
|
-
padding: oScale.padding() * oScale.step(),
|
|
463
|
-
pieceData,
|
|
464
|
-
pct,
|
|
465
|
-
pctStart: cumulativePct
|
|
466
|
-
};
|
|
467
|
-
cumulativePct += pct;
|
|
468
|
-
}
|
|
469
|
-
return columns;
|
|
470
|
-
}
|
|
471
|
-
// ── Scene graph building ─────────────────────────────────────────────
|
|
472
|
-
getSceneContext() {
|
|
473
|
-
return {
|
|
474
|
-
scales: this.scales,
|
|
475
|
-
columns: this.columns,
|
|
476
|
-
config: this.config,
|
|
477
|
-
getR: this.getR,
|
|
478
|
-
getStack: this.getStack,
|
|
479
|
-
getGroup: this.getGroup,
|
|
480
|
-
getColor: this.getColor,
|
|
481
|
-
getConnector: this.getConnector,
|
|
482
|
-
getO: this.getO,
|
|
483
|
-
multiScales: this.multiScales,
|
|
484
|
-
rAccessors: this.rAccessors,
|
|
485
|
-
resolvePieceStyle: (d, category) => this.resolvePieceStyle(d, category),
|
|
486
|
-
resolveSummaryStyle: (d, category) => this.resolveSummaryStyle(d, category),
|
|
487
|
-
getRawRange: (d) => this.getRawRange(d)
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
buildSceneNodes(data, layout) {
|
|
491
|
-
if (!this.scales)
|
|
492
|
-
return [];
|
|
493
|
-
const ctx = this.getSceneContext();
|
|
494
|
-
const builder = SCENE_BUILDERS[this.config.chartType];
|
|
495
|
-
let nodes = builder ? builder(ctx, layout) : [];
|
|
496
|
-
// Build connectors if configured
|
|
497
|
-
if (this.getConnector && this.scales) {
|
|
498
|
-
const connectorNodes = (0, connectorScene_1.buildConnectors)(ctx, nodes, layout);
|
|
499
|
-
// Connectors render behind pieces
|
|
500
|
-
nodes = [...connectorNodes, ...nodes];
|
|
501
|
-
}
|
|
502
|
-
return nodes;
|
|
503
|
-
}
|
|
504
|
-
// ── Style resolution ─────────────────────────────────────────────────
|
|
505
|
-
resolvePieceStyle(d, category) {
|
|
506
|
-
if (typeof this.config.pieceStyle === "function") {
|
|
507
|
-
return this.config.pieceStyle(d, category);
|
|
508
|
-
}
|
|
509
|
-
if (this.config.pieceStyle && typeof this.config.pieceStyle === "object") {
|
|
510
|
-
return this.config.pieceStyle;
|
|
511
|
-
}
|
|
512
|
-
if (this.config.barColors && category) {
|
|
513
|
-
return { fill: this.config.barColors[category] || "#007bff" };
|
|
514
|
-
}
|
|
515
|
-
// Use colorScheme (or default palette) to generate colors by category
|
|
516
|
-
if (category) {
|
|
517
|
-
return { fill: this.getColorFromScheme(category) };
|
|
518
|
-
}
|
|
519
|
-
return { fill: "#007bff" };
|
|
520
|
-
}
|
|
521
|
-
getColorFromScheme(key) {
|
|
522
|
-
if (!this._colorSchemeMap)
|
|
523
|
-
this._colorSchemeMap = new Map();
|
|
524
|
-
const existing = this._colorSchemeMap.get(key);
|
|
525
|
-
if (existing)
|
|
526
|
-
return existing;
|
|
527
|
-
const palette = Array.isArray(this.config.colorScheme)
|
|
528
|
-
? this.config.colorScheme
|
|
529
|
-
: ["#4e79a7", "#f28e2b", "#e15759", "#76b7b2", "#59a14f", "#edc948", "#b07aa1", "#ff9da7", "#9c755f", "#bab0ac"];
|
|
530
|
-
const color = palette[this._colorSchemeIndex % palette.length];
|
|
531
|
-
this._colorSchemeIndex++;
|
|
532
|
-
this._colorSchemeMap.set(key, color);
|
|
533
|
-
return color;
|
|
534
|
-
}
|
|
535
|
-
resolveSummaryStyle(d, category) {
|
|
536
|
-
if (typeof this.config.summaryStyle === "function") {
|
|
537
|
-
return this.config.summaryStyle(d, category);
|
|
538
|
-
}
|
|
539
|
-
if (this.config.summaryStyle && typeof this.config.summaryStyle === "object") {
|
|
540
|
-
return this.config.summaryStyle;
|
|
541
|
-
}
|
|
542
|
-
return { fill: "#007bff", fillOpacity: 0.6, stroke: "#007bff", strokeWidth: 1 };
|
|
543
|
-
}
|
|
544
|
-
// ── Decay ────────────────────────────────────────────────────────────
|
|
545
|
-
computeDecayOpacity(bufferIndex, bufferSize) {
|
|
546
|
-
const decay = this.config.decay;
|
|
547
|
-
if (!decay || bufferSize <= 1)
|
|
548
|
-
return 1;
|
|
549
|
-
const minOpacity = decay.minOpacity ?? 0.1;
|
|
550
|
-
const age = bufferSize - 1 - bufferIndex;
|
|
551
|
-
switch (decay.type) {
|
|
552
|
-
case "linear": {
|
|
553
|
-
const t = 1 - age / (bufferSize - 1);
|
|
554
|
-
return minOpacity + t * (1 - minOpacity);
|
|
555
|
-
}
|
|
556
|
-
case "exponential": {
|
|
557
|
-
const halfLife = decay.halfLife ?? bufferSize / 2;
|
|
558
|
-
const t = Math.pow(0.5, age / halfLife);
|
|
559
|
-
return minOpacity + t * (1 - minOpacity);
|
|
560
|
-
}
|
|
561
|
-
case "step": {
|
|
562
|
-
const threshold = decay.stepThreshold ?? bufferSize * 0.5;
|
|
563
|
-
return age < threshold ? 1 : minOpacity;
|
|
564
|
-
}
|
|
565
|
-
default:
|
|
566
|
-
return 1;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
applyDecay(nodes, data) {
|
|
570
|
-
if (!this.config.decay)
|
|
571
|
-
return;
|
|
572
|
-
const bufferSize = data.length;
|
|
573
|
-
if (bufferSize <= 1)
|
|
574
|
-
return;
|
|
575
|
-
const indexMap = new Map();
|
|
576
|
-
for (let i = 0; i < data.length; i++) {
|
|
577
|
-
indexMap.set(data[i], i);
|
|
578
|
-
}
|
|
579
|
-
for (const node of nodes) {
|
|
580
|
-
if (node.type === "connector" || node.type === "violin" || node.type === "boxplot" || node.type === "wedge")
|
|
581
|
-
continue;
|
|
582
|
-
const idx = indexMap.get(node.datum);
|
|
583
|
-
if (idx == null)
|
|
584
|
-
continue;
|
|
585
|
-
const decayOpacity = this.computeDecayOpacity(idx, bufferSize);
|
|
586
|
-
const baseOpacity = node.style?.opacity ?? 1;
|
|
587
|
-
node.style = { ...node.style, opacity: baseOpacity * decayOpacity };
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
// ── Pulse ───────────────────────────────────────────────────────────
|
|
591
|
-
applyPulse(nodes, data) {
|
|
592
|
-
if (!this.config.pulse || !this.timestampBuffer)
|
|
593
|
-
return;
|
|
594
|
-
const now = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
595
|
-
const duration = this.config.pulse.duration ?? 500;
|
|
596
|
-
const pulseColor = this.config.pulse.color ?? "rgba(255,255,255,0.6)";
|
|
597
|
-
const indexMap = new Map();
|
|
598
|
-
for (let i = 0; i < data.length; i++) {
|
|
599
|
-
indexMap.set(data[i], i);
|
|
600
|
-
}
|
|
601
|
-
for (const node of nodes) {
|
|
602
|
-
if (node.type === "connector" || node.type === "violin" || node.type === "boxplot" || node.type === "wedge")
|
|
603
|
-
continue;
|
|
604
|
-
const idx = indexMap.get(node.datum);
|
|
605
|
-
if (idx == null)
|
|
606
|
-
continue;
|
|
607
|
-
const insertTime = this.timestampBuffer.get(idx);
|
|
608
|
-
if (insertTime == null)
|
|
609
|
-
continue;
|
|
610
|
-
const age = now - insertTime;
|
|
611
|
-
if (age < duration) {
|
|
612
|
-
const intensity = 1 - age / duration;
|
|
613
|
-
node._pulseIntensity = intensity;
|
|
614
|
-
node._pulseColor = pulseColor;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
get hasActivePulses() {
|
|
619
|
-
if (!this.config.pulse || !this.timestampBuffer || this.timestampBuffer.size === 0)
|
|
620
|
-
return false;
|
|
621
|
-
const now = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
622
|
-
const duration = this.config.pulse.duration ?? 500;
|
|
623
|
-
const newest = this.timestampBuffer.peek();
|
|
624
|
-
return newest != null && (now - newest) < duration;
|
|
625
|
-
}
|
|
626
|
-
// ── Transitions ─────────────────────────────────────────────────────
|
|
627
|
-
snapshotPositions() {
|
|
628
|
-
this.prevPositionMap.clear();
|
|
629
|
-
for (let i = 0; i < this.scene.length; i++) {
|
|
630
|
-
const node = this.scene[i];
|
|
631
|
-
if (node.type === "point") {
|
|
632
|
-
this.prevPositionMap.set(`p:${i}`, { x: node.x, y: node.y, r: node.r });
|
|
633
|
-
}
|
|
634
|
-
else if (node.type === "rect") {
|
|
635
|
-
const key = `r:${node.group || ""}:${node.datum?.category ?? i}`;
|
|
636
|
-
this.prevPositionMap.set(key, { x: node.x, y: node.y, w: node.w, h: node.h });
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
startTransition() {
|
|
641
|
-
if (!this.config.transition || this.prevPositionMap.size === 0)
|
|
642
|
-
return;
|
|
643
|
-
const duration = this.config.transition.duration ?? 300;
|
|
644
|
-
let hasChanges = false;
|
|
645
|
-
for (let i = 0; i < this.scene.length; i++) {
|
|
646
|
-
const node = this.scene[i];
|
|
647
|
-
let key = null;
|
|
648
|
-
if (node.type === "point") {
|
|
649
|
-
key = `p:${i}`;
|
|
650
|
-
}
|
|
651
|
-
else if (node.type === "rect") {
|
|
652
|
-
key = `r:${node.group || ""}:${node.datum?.category ?? i}`;
|
|
653
|
-
}
|
|
654
|
-
if (!key)
|
|
655
|
-
continue;
|
|
656
|
-
const prev = this.prevPositionMap.get(key);
|
|
657
|
-
if (!prev)
|
|
658
|
-
continue;
|
|
659
|
-
if (node.type === "point") {
|
|
660
|
-
if (prev.x !== node.x || prev.y !== node.y) {
|
|
661
|
-
node._targetX = node.x;
|
|
662
|
-
node._targetY = node.y;
|
|
663
|
-
node.x = prev.x;
|
|
664
|
-
node.y = prev.y;
|
|
665
|
-
hasChanges = true;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
else if (node.type === "rect") {
|
|
669
|
-
if (prev.x !== node.x || prev.y !== node.y || prev.w !== node.w || prev.h !== node.h) {
|
|
670
|
-
node._targetX = node.x;
|
|
671
|
-
node._targetY = node.y;
|
|
672
|
-
node._targetW = node.w;
|
|
673
|
-
node._targetH = node.h;
|
|
674
|
-
node.x = prev.x;
|
|
675
|
-
node.y = prev.y;
|
|
676
|
-
node.w = prev.w ?? node.w;
|
|
677
|
-
node.h = prev.h ?? node.h;
|
|
678
|
-
hasChanges = true;
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
if (hasChanges) {
|
|
683
|
-
this.activeTransition = {
|
|
684
|
-
startTime: typeof performance !== "undefined" ? performance.now() : Date.now(),
|
|
685
|
-
duration
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
advanceTransition(now) {
|
|
690
|
-
if (!this.activeTransition)
|
|
691
|
-
return false;
|
|
692
|
-
const elapsed = now - this.activeTransition.startTime;
|
|
693
|
-
const rawT = Math.min(elapsed / this.activeTransition.duration, 1);
|
|
694
|
-
const t = this.config.transition?.easing === "linear"
|
|
695
|
-
? rawT
|
|
696
|
-
: 1 - Math.pow(1 - rawT, 3);
|
|
697
|
-
for (const node of this.scene) {
|
|
698
|
-
if (node.type === "point") {
|
|
699
|
-
if (node._targetX === undefined)
|
|
700
|
-
continue;
|
|
701
|
-
const key = `p:${0}`;
|
|
702
|
-
const prev = this.prevPositionMap.get(key);
|
|
703
|
-
if (!prev)
|
|
704
|
-
continue;
|
|
705
|
-
node.x = prev.x + (node._targetX - prev.x) * t;
|
|
706
|
-
node.y = prev.y + (node._targetY - prev.y) * t;
|
|
707
|
-
}
|
|
708
|
-
else if (node.type === "rect") {
|
|
709
|
-
if (node._targetX === undefined)
|
|
710
|
-
continue;
|
|
711
|
-
const key = `r:${node.group || ""}:${node.datum?.category ?? 0}`;
|
|
712
|
-
const prev = this.prevPositionMap.get(key);
|
|
713
|
-
if (!prev)
|
|
714
|
-
continue;
|
|
715
|
-
node.x = prev.x + (node._targetX - prev.x) * t;
|
|
716
|
-
node.y = prev.y + (node._targetY - prev.y) * t;
|
|
717
|
-
if (prev.w !== undefined) {
|
|
718
|
-
node.w = prev.w + (node._targetW - prev.w) * t;
|
|
719
|
-
node.h = prev.h + (node._targetH - prev.h) * t;
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
if (rawT >= 1) {
|
|
724
|
-
for (const node of this.scene) {
|
|
725
|
-
if (node.type === "point") {
|
|
726
|
-
if (node._targetX === undefined)
|
|
727
|
-
continue;
|
|
728
|
-
node.x = node._targetX;
|
|
729
|
-
node.y = node._targetY;
|
|
730
|
-
node._targetX = undefined;
|
|
731
|
-
node._targetY = undefined;
|
|
732
|
-
}
|
|
733
|
-
else if (node.type === "rect") {
|
|
734
|
-
if (node._targetX === undefined)
|
|
735
|
-
continue;
|
|
736
|
-
node.x = node._targetX;
|
|
737
|
-
node.y = node._targetY;
|
|
738
|
-
node.w = node._targetW;
|
|
739
|
-
node.h = node._targetH;
|
|
740
|
-
node._targetX = undefined;
|
|
741
|
-
node._targetY = undefined;
|
|
742
|
-
node._targetW = undefined;
|
|
743
|
-
node._targetH = undefined;
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
this.activeTransition = null;
|
|
747
|
-
return false;
|
|
748
|
-
}
|
|
749
|
-
return true;
|
|
750
|
-
}
|
|
751
|
-
// ── Public accessors ─────────────────────────────────────────────────
|
|
752
|
-
getData() {
|
|
753
|
-
return this.buffer.toArray();
|
|
754
|
-
}
|
|
755
|
-
clear() {
|
|
756
|
-
this.buffer.clear();
|
|
757
|
-
this.rExtent.clear();
|
|
758
|
-
this.categories.clear();
|
|
759
|
-
if (this.timestampBuffer)
|
|
760
|
-
this.timestampBuffer.clear();
|
|
761
|
-
this.prevPositionMap.clear();
|
|
762
|
-
this.activeTransition = null;
|
|
763
|
-
this.lastIngestTime = 0;
|
|
764
|
-
this.scales = null;
|
|
765
|
-
this.scene = [];
|
|
766
|
-
this.columns = {};
|
|
767
|
-
this.version++;
|
|
768
|
-
}
|
|
769
|
-
get size() {
|
|
770
|
-
return this.buffer.size;
|
|
771
|
-
}
|
|
772
|
-
getOAccessor() {
|
|
773
|
-
return this.getO;
|
|
774
|
-
}
|
|
775
|
-
getRAccessor() {
|
|
776
|
-
return this.getR;
|
|
777
|
-
}
|
|
778
|
-
updateConfig(config) {
|
|
779
|
-
if (config.colorScheme !== this.config.colorScheme) {
|
|
780
|
-
this._colorSchemeMap = null;
|
|
781
|
-
this._colorSchemeIndex = 0;
|
|
782
|
-
}
|
|
783
|
-
Object.assign(this.config, config);
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
exports.OrdinalPipelineStore = OrdinalPipelineStore;
|