semiotic 2.0.3 → 3.0.0-beta.2
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 +828 -0
- package/README.md +215 -37
- package/ai/cli.js +48 -0
- package/ai/dist/ai/componentRegistry.js +45 -0
- package/ai/dist/ai/mcp-server.js +99 -0
- package/ai/dist/ai/renderHOCToSVG.js +77 -0
- package/ai/dist/src/components/Annotation.js +358 -0
- package/ai/dist/src/components/AnnotationLayer/AnnotationLayer.js +369 -0
- package/ai/dist/src/components/Axis/Axis.js +374 -0
- package/ai/dist/src/components/Axis/axisTitle.js +14 -0
- package/ai/dist/src/components/Axis/index.js +7 -0
- package/ai/dist/src/components/Axis/summaryGraphic.js +37 -0
- package/ai/dist/src/components/Brush.js +84 -0
- package/ai/dist/src/components/ChartErrorBoundary.js +91 -0
- package/ai/dist/src/components/DividedLine.js +65 -0
- package/ai/dist/src/components/Legend.js +140 -0
- package/ai/dist/src/components/LinkedCharts.js +95 -0
- package/ai/dist/src/components/ThemeProvider.js +79 -0
- package/ai/dist/src/components/Tooltip/Tooltip.js +309 -0
- package/ai/dist/src/components/TooltipPositioner/index.js +132 -0
- package/ai/dist/src/components/annotationLayerBehavior/annotationHandling.js +73 -0
- package/ai/dist/src/components/annotationLayerBehavior/d3labeler.js +254 -0
- package/ai/dist/src/components/annotationRules/baseRules.js +150 -0
- package/ai/dist/src/components/annotationRules/networkframeRules.js +196 -0
- package/ai/dist/src/components/annotationRules/xyframeRules.js +297 -0
- package/ai/dist/src/components/batchWork.js +35 -0
- package/ai/dist/src/components/charts/index.js +109 -0
- package/ai/dist/src/components/charts/network/ChordDiagram.js +142 -0
- package/ai/dist/src/components/charts/network/CirclePack.js +108 -0
- package/ai/dist/src/components/charts/network/ForceDirectedGraph.js +121 -0
- package/ai/dist/src/components/charts/network/SankeyDiagram.js +155 -0
- package/ai/dist/src/components/charts/network/TreeDiagram.js +110 -0
- package/ai/dist/src/components/charts/network/Treemap.js +106 -0
- package/ai/dist/src/components/charts/ordinal/BarChart.js +156 -0
- package/ai/dist/src/components/charts/ordinal/BoxPlot.js +139 -0
- package/ai/dist/src/components/charts/ordinal/DonutChart.js +130 -0
- package/ai/dist/src/components/charts/ordinal/DotPlot.js +126 -0
- package/ai/dist/src/components/charts/ordinal/GroupedBarChart.js +129 -0
- package/ai/dist/src/components/charts/ordinal/Histogram.js +132 -0
- package/ai/dist/src/components/charts/ordinal/PieChart.js +128 -0
- package/ai/dist/src/components/charts/ordinal/RidgelinePlot.js +130 -0
- package/ai/dist/src/components/charts/ordinal/StackedBarChart.js +130 -0
- package/ai/dist/src/components/charts/ordinal/SwarmPlot.js +147 -0
- package/ai/dist/src/components/charts/ordinal/ViolinPlot.js +138 -0
- package/ai/dist/src/components/charts/realtime/RealtimeHeatmap.js +79 -0
- package/ai/dist/src/components/charts/realtime/RealtimeHistogram.js +114 -0
- package/ai/dist/src/components/charts/realtime/RealtimeLineChart.js +93 -0
- package/ai/dist/src/components/charts/realtime/RealtimeSwarmChart.js +105 -0
- package/ai/dist/src/components/charts/realtime/RealtimeWaterfallChart.js +106 -0
- package/ai/dist/src/components/charts/shared/ChartError.js +72 -0
- package/ai/dist/src/components/charts/shared/colorUtils.js +138 -0
- package/ai/dist/src/components/charts/shared/formatUtils.js +213 -0
- package/ai/dist/src/components/charts/shared/hooks.js +49 -0
- package/ai/dist/src/components/charts/shared/legendUtils.js +57 -0
- package/ai/dist/src/components/charts/shared/selectionUtils.js +67 -0
- package/ai/dist/src/components/charts/shared/tooltipUtils.js +79 -0
- package/ai/dist/src/components/charts/shared/types.js +2 -0
- package/ai/dist/src/components/charts/shared/validateChartData.js +82 -0
- package/ai/dist/src/components/charts/shared/validateProps.js +736 -0
- package/ai/dist/src/components/charts/xy/AreaChart.js +230 -0
- package/ai/dist/src/components/charts/xy/BubbleChart.js +251 -0
- package/ai/dist/src/components/charts/xy/Heatmap.js +235 -0
- package/ai/dist/src/components/charts/xy/LineChart.js +307 -0
- package/ai/dist/src/components/charts/xy/MinimapChart.js +298 -0
- package/ai/dist/src/components/charts/xy/Scatterplot.js +172 -0
- package/ai/dist/src/components/charts/xy/ScatterplotMatrix.js +426 -0
- package/ai/dist/src/components/charts/xy/StackedAreaChart.js +231 -0
- package/ai/dist/src/components/constants/coordinateNames.js +11 -0
- package/ai/dist/src/components/constants/frame_props.js +251 -0
- package/ai/dist/src/components/data/dataFunctions.js +487 -0
- package/ai/dist/src/components/data/multiAccessorUtils.js +14 -0
- package/ai/dist/src/components/data/transforms.js +143 -0
- package/ai/dist/src/components/data/unflowedFunctions.js +5 -0
- package/ai/dist/src/components/export/exportChart.js +121 -0
- package/ai/dist/src/components/generic_utilities/functions.js +5 -0
- package/ai/dist/src/components/geometry/areaDrawing.js +312 -0
- package/ai/dist/src/components/geometry/contourLayout.js +73 -0
- package/ai/dist/src/components/geometry/hexbinLayout.js +163 -0
- package/ai/dist/src/components/geometry/lineDrawing.js +356 -0
- package/ai/dist/src/components/geometry/sankeyLinks.js +331 -0
- package/ai/dist/src/components/geometry/summaryLayouts.js +136 -0
- package/ai/dist/src/components/index.js +18 -0
- package/ai/dist/src/components/processing/InteractionItems.js +223 -0
- package/ai/dist/src/components/processing/hierarchyUtils.js +104 -0
- package/ai/dist/src/components/processing/layouts/chordLayout.js +58 -0
- package/ai/dist/src/components/processing/layouts/forceLayout.js +142 -0
- package/ai/dist/src/components/processing/layouts/hierarchyLayout.js +31 -0
- package/ai/dist/src/components/processing/layouts/index.js +32 -0
- package/ai/dist/src/components/processing/layouts/sankeyLayout.js +96 -0
- package/ai/dist/src/components/processing/layouts/simpleLayouts.js +34 -0
- package/ai/dist/src/components/processing/layouts/types.js +2 -0
- package/ai/dist/src/components/processing/networkDefaults.js +39 -0
- package/ai/dist/src/components/realtime/BinAccumulator.js +36 -0
- package/ai/dist/src/components/realtime/IncrementalExtent.js +55 -0
- package/ai/dist/src/components/realtime/RingBuffer.js +104 -0
- package/ai/dist/src/components/realtime/renderers/barRenderer.js +133 -0
- package/ai/dist/src/components/realtime/renderers/candlestickRenderer.js +7 -0
- package/ai/dist/src/components/realtime/renderers/lineRenderer.js +164 -0
- package/ai/dist/src/components/realtime/renderers/swarmRenderer.js +91 -0
- package/ai/dist/src/components/realtime/renderers/types.js +2 -0
- package/ai/dist/src/components/realtime/renderers/waterfallRenderer.js +163 -0
- package/ai/dist/src/components/realtime/types.js +2 -0
- package/ai/dist/src/components/semiotic-ai.js +89 -0
- package/ai/dist/src/components/semiotic-data.js +12 -0
- package/ai/dist/src/components/semiotic-network.js +38 -0
- package/ai/dist/src/components/semiotic-ordinal.js +28 -0
- package/ai/dist/src/components/semiotic-realtime.js +30 -0
- package/ai/dist/src/components/semiotic-server.js +8 -0
- package/ai/dist/src/components/semiotic-xy.js +35 -0
- package/ai/dist/src/components/semiotic.js +109 -0
- package/ai/dist/src/components/server/renderToStaticSVG.js +594 -0
- package/ai/dist/src/components/store/SelectionStore.js +91 -0
- package/ai/dist/src/components/store/ThemeStore.js +78 -0
- package/ai/dist/src/components/store/TooltipStore.js +13 -0
- package/ai/dist/src/components/store/createStore.js +81 -0
- package/ai/dist/src/components/store/useSelection.js +133 -0
- package/ai/dist/src/components/stream/CanvasHitTester.js +164 -0
- package/ai/dist/src/components/stream/DataSourceAdapter.js +99 -0
- package/ai/dist/src/components/stream/MarginalGraphics.js +266 -0
- package/ai/dist/src/components/stream/NetworkCanvasHitTester.js +228 -0
- package/ai/dist/src/components/stream/NetworkPipelineStore.js +498 -0
- package/ai/dist/src/components/stream/NetworkSVGOverlay.js +70 -0
- package/ai/dist/src/components/stream/NetworkSceneGraph.js +38 -0
- package/ai/dist/src/components/stream/OrdinalCanvasHitTester.js +146 -0
- package/ai/dist/src/components/stream/OrdinalPipelineStore.js +786 -0
- package/ai/dist/src/components/stream/OrdinalSVGOverlay.js +130 -0
- package/ai/dist/src/components/stream/ParticlePool.js +174 -0
- package/ai/dist/src/components/stream/PipelineStore.js +1243 -0
- package/ai/dist/src/components/stream/SVGOverlay.js +129 -0
- package/ai/dist/src/components/stream/SceneGraph.js +132 -0
- package/ai/dist/src/components/stream/StreamNetworkFrame.js +561 -0
- package/ai/dist/src/components/stream/StreamOrdinalFrame.js +492 -0
- package/ai/dist/src/components/stream/StreamXYFrame.js +590 -0
- package/ai/dist/src/components/stream/accessorUtils.js +20 -0
- package/ai/dist/src/components/stream/index.js +32 -0
- package/ai/dist/src/components/stream/layouts/chordLayoutPlugin.js +352 -0
- package/ai/dist/src/components/stream/layouts/forceLayoutPlugin.js +230 -0
- package/ai/dist/src/components/stream/layouts/hierarchyLayoutPlugin.js +568 -0
- package/ai/dist/src/components/stream/layouts/index.js +28 -0
- package/ai/dist/src/components/stream/layouts/sankeyLayoutPlugin.js +245 -0
- package/ai/dist/src/components/stream/networkTypes.js +17 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/barScene.js +126 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/connectorScene.js +62 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pieScene.js +33 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pointScene.js +63 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/statisticalScene.js +278 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/timelineScene.js +30 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/types.js +2 -0
- package/ai/dist/src/components/stream/ordinalTypes.js +2 -0
- package/ai/dist/src/components/stream/renderers/areaCanvasRenderer.js +48 -0
- package/ai/dist/src/components/stream/renderers/barCanvasRenderer.js +70 -0
- package/ai/dist/src/components/stream/renderers/boxplotCanvasRenderer.js +75 -0
- package/ai/dist/src/components/stream/renderers/candlestickCanvasRenderer.js +28 -0
- package/ai/dist/src/components/stream/renderers/connectorCanvasRenderer.js +47 -0
- package/ai/dist/src/components/stream/renderers/heatmapCanvasRenderer.js +31 -0
- package/ai/dist/src/components/stream/renderers/lineCanvasRenderer.js +140 -0
- package/ai/dist/src/components/stream/renderers/networkArcRenderer.js +38 -0
- package/ai/dist/src/components/stream/renderers/networkCircleRenderer.js +37 -0
- package/ai/dist/src/components/stream/renderers/networkEdgeRenderer.js +102 -0
- package/ai/dist/src/components/stream/renderers/networkParticleRenderer.js +63 -0
- package/ai/dist/src/components/stream/renderers/networkRectRenderer.js +35 -0
- package/ai/dist/src/components/stream/renderers/pointCanvasRenderer.js +38 -0
- package/ai/dist/src/components/stream/renderers/swarmCanvasRenderer.js +10 -0
- package/ai/dist/src/components/stream/renderers/types.js +2 -0
- package/ai/dist/src/components/stream/renderers/violinCanvasRenderer.js +47 -0
- package/ai/dist/src/components/stream/renderers/waterfallCanvasRenderer.js +38 -0
- package/ai/dist/src/components/stream/renderers/wedgeCanvasRenderer.js +33 -0
- package/ai/dist/src/components/stream/types.js +2 -0
- package/ai/dist/src/components/types/annotationTypes.js +2 -0
- package/ai/dist/src/components/types/canvasTypes.js +2 -0
- package/ai/dist/src/components/types/generalTypes.js +2 -0
- package/ai/dist/src/components/types/interactionTypes.js +2 -0
- package/ai/dist/src/components/types/legendTypes.js +2 -0
- package/ai/dist/src/components/types/networkTypes.js +2 -0
- package/ai/dist/src/components/types/ordinalTypes.js +2 -0
- package/ai/dist/src/components/types/xyTypes.js +2 -0
- package/ai/dist/src/components/useBoundingRect.js +24 -0
- package/ai/dist/src/components/visualizationLayerBehavior/axis.js +301 -0
- package/ai/dist/src/components/visualizationLayerBehavior/general.js +435 -0
- package/ai/dist/src/setupTests.js +4 -0
- package/ai/examples.md +489 -0
- package/ai/schema.json +1338 -0
- package/ai/system-prompt.md +41 -0
- package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -1
- package/dist/Axis/axisTitle.d.ts +3 -3
- package/dist/Axis/summaryGraphic.d.ts +1 -1
- package/dist/ChartErrorBoundary.d.ts +39 -0
- package/dist/LinkedCharts.d.ts +42 -0
- package/dist/ThemeProvider.d.ts +12 -0
- package/dist/Tooltip/Tooltip.d.ts +141 -0
- package/dist/TooltipPositioner/index.d.ts +1 -1
- package/dist/annotationLayerBehavior/annotationHandling.d.ts +2 -2
- package/dist/annotationRules/networkframeRules.d.ts +2 -2
- package/dist/annotationRules/xyframeRules.d.ts +2 -2
- package/dist/batchWork.d.ts +1 -1
- package/dist/charts/index.d.ts +74 -0
- package/dist/charts/network/ChordDiagram.d.ts +36 -0
- package/dist/charts/network/CirclePack.d.ts +32 -0
- package/dist/charts/network/ForceDirectedGraph.d.ts +38 -0
- package/dist/charts/network/SankeyDiagram.d.ts +38 -0
- package/dist/charts/network/TreeDiagram.d.ts +34 -0
- package/dist/charts/network/Treemap.d.ts +33 -0
- package/dist/charts/ordinal/BarChart.d.ts +32 -0
- package/dist/charts/ordinal/BoxPlot.d.ts +27 -0
- package/dist/charts/ordinal/DonutChart.d.ts +23 -0
- package/dist/charts/ordinal/DotPlot.d.ts +27 -0
- package/dist/charts/ordinal/GroupedBarChart.d.ts +26 -0
- package/dist/charts/ordinal/Histogram.d.ts +26 -0
- package/dist/charts/ordinal/PieChart.d.ts +21 -0
- package/dist/charts/ordinal/RidgelinePlot.d.ts +34 -0
- package/dist/charts/ordinal/StackedBarChart.d.ts +27 -0
- package/dist/charts/ordinal/SwarmPlot.d.ts +29 -0
- package/dist/charts/ordinal/ViolinPlot.d.ts +28 -0
- package/dist/charts/realtime/RealtimeHeatmap.d.ts +95 -0
- package/dist/charts/realtime/RealtimeHistogram.d.ts +119 -0
- package/dist/charts/realtime/RealtimeLineChart.d.ts +98 -0
- package/dist/charts/realtime/RealtimeSwarmChart.d.ts +100 -0
- package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +97 -0
- package/dist/charts/shared/ChartError.d.ts +19 -0
- package/dist/charts/shared/colorUtils.d.ts +62 -0
- package/dist/charts/shared/formatUtils.d.ts +94 -0
- package/dist/charts/shared/hooks.d.ts +20 -0
- package/dist/charts/shared/legendUtils.d.ts +32 -0
- package/dist/charts/shared/selectionUtils.d.ts +51 -0
- package/dist/charts/shared/tooltipUtils.d.ts +18 -0
- package/dist/charts/shared/types.d.ts +97 -0
- package/dist/charts/shared/validateChartData.d.ts +41 -0
- package/dist/charts/shared/validateProps.d.ts +18 -0
- package/dist/charts/xy/AreaChart.d.ts +130 -0
- package/dist/charts/xy/BubbleChart.d.ts +164 -0
- package/dist/charts/xy/Heatmap.d.ts +156 -0
- package/dist/charts/xy/LineChart.d.ts +196 -0
- package/dist/charts/xy/MinimapChart.d.ts +73 -0
- package/dist/charts/xy/Scatterplot.d.ts +55 -0
- package/dist/charts/xy/ScatterplotMatrix.d.ts +71 -0
- package/dist/charts/xy/StackedAreaChart.d.ts +134 -0
- package/dist/constants/frame_props.d.ts +9 -0
- package/dist/data/dataFunctions.d.ts +10 -11
- package/dist/data/transforms.d.ts +45 -0
- package/dist/export/exportChart.d.ts +16 -0
- package/dist/{svg → geometry}/areaDrawing.d.ts +3 -13
- package/dist/geometry/contourLayout.d.ts +6 -0
- package/dist/geometry/hexbinLayout.d.ts +7 -0
- package/dist/{svg → geometry}/lineDrawing.d.ts +7 -35
- package/dist/geometry/sankeyLinks.d.ts +2 -0
- package/dist/geometry/summaryLayouts.d.ts +45 -0
- package/dist/index.d.ts +1 -125
- package/dist/network.js +7495 -0
- package/dist/network.js.map +1 -0
- package/dist/network.min.js +1 -0
- package/dist/network.module.js +7458 -0
- package/dist/network.module.js.map +1 -0
- package/dist/network.module.min.js +1 -0
- package/dist/ordinal.js +6497 -0
- package/dist/ordinal.js.map +1 -0
- package/dist/ordinal.min.js +1 -0
- package/dist/ordinal.module.js +6465 -0
- package/dist/ordinal.module.js.map +1 -0
- package/dist/ordinal.module.min.js +1 -0
- package/dist/processing/InteractionItems.d.ts +5 -4
- package/dist/processing/hierarchyUtils.d.ts +16 -0
- package/dist/processing/layouts/chordLayout.d.ts +2 -0
- package/dist/processing/layouts/forceLayout.d.ts +3 -0
- package/dist/processing/layouts/hierarchyLayout.d.ts +10 -0
- package/dist/processing/layouts/index.d.ts +8 -0
- package/dist/processing/layouts/sankeyLayout.d.ts +8 -0
- package/dist/processing/layouts/simpleLayouts.d.ts +7 -0
- package/dist/processing/layouts/types.d.ts +17 -0
- package/dist/processing/networkDefaults.d.ts +36 -0
- package/dist/realtime/BinAccumulator.d.ts +8 -0
- package/dist/realtime/IncrementalExtent.d.ts +13 -0
- package/dist/realtime/RingBuffer.d.ts +19 -0
- package/dist/realtime/renderers/barRenderer.d.ts +2 -0
- package/dist/realtime/renderers/candlestickRenderer.d.ts +2 -0
- package/dist/realtime/renderers/lineRenderer.d.ts +2 -0
- package/dist/realtime/renderers/swarmRenderer.d.ts +2 -0
- package/dist/realtime/renderers/types.d.ts +9 -0
- package/dist/realtime/renderers/waterfallRenderer.d.ts +3 -0
- package/dist/realtime/types.d.ts +113 -0
- package/dist/realtime.js +7072 -0
- package/dist/realtime.js.map +1 -0
- package/dist/realtime.min.js +1 -0
- package/dist/realtime.module.js +7043 -0
- package/dist/realtime.module.js.map +1 -0
- package/dist/realtime.module.min.js +1 -0
- package/dist/semiotic-ai.d.ts +36 -0
- package/dist/semiotic-ai.js +13323 -0
- package/dist/semiotic-ai.js.map +1 -0
- package/dist/semiotic-ai.min.js +1 -0
- package/dist/semiotic-ai.module.js +13264 -0
- package/dist/semiotic-ai.module.js.map +1 -0
- package/dist/semiotic-ai.module.min.js +1 -0
- package/dist/semiotic-data.d.ts +5 -0
- package/dist/semiotic-data.js +141 -0
- package/dist/semiotic-data.js.map +1 -0
- package/dist/semiotic-data.min.js +1 -0
- package/dist/semiotic-data.module.js +136 -0
- package/dist/semiotic-data.module.js.map +1 -0
- package/dist/semiotic-data.module.min.js +1 -0
- package/dist/semiotic-network.d.ts +23 -0
- package/dist/semiotic-ordinal.d.ts +19 -0
- package/dist/semiotic-realtime.d.ts +22 -0
- package/dist/semiotic-server.d.ts +1 -0
- package/dist/semiotic-xy.d.ts +21 -0
- package/dist/semiotic.d.ts +41 -28
- package/dist/semiotic.js +16257 -13130
- package/dist/semiotic.js.map +1 -0
- package/dist/semiotic.min.js +1 -0
- package/dist/semiotic.module.js +16198 -13100
- package/dist/semiotic.module.js.map +1 -0
- package/dist/semiotic.module.min.js +1 -0
- package/dist/server/renderToStaticSVG.d.ts +9 -0
- package/dist/server.js +5191 -0
- package/dist/server.js.map +1 -0
- package/dist/server.min.js +1 -0
- package/dist/server.module.js +5166 -0
- package/dist/server.module.js.map +1 -0
- package/dist/server.module.min.js +1 -0
- package/dist/store/SelectionStore.d.ts +29 -0
- package/dist/store/ThemeStore.d.ts +26 -0
- package/dist/store/useSelection.d.ts +66 -0
- package/dist/stream/CanvasHitTester.d.ts +18 -0
- package/dist/stream/DataSourceAdapter.d.ts +32 -0
- package/dist/stream/MarginalGraphics.d.ts +19 -0
- package/dist/stream/NetworkCanvasHitTester.d.ts +14 -0
- package/dist/stream/NetworkPipelineStore.d.ts +74 -0
- package/dist/stream/NetworkSVGOverlay.d.ts +40 -0
- package/dist/stream/NetworkSceneGraph.d.ts +14 -0
- package/dist/stream/OrdinalCanvasHitTester.d.ts +9 -0
- package/dist/stream/OrdinalPipelineStore.d.ts +65 -0
- package/dist/stream/OrdinalSVGOverlay.d.ts +34 -0
- package/dist/stream/ParticlePool.d.ts +28 -0
- package/dist/stream/PipelineStore.d.ts +161 -0
- package/dist/stream/SVGOverlay.d.ts +37 -0
- package/dist/stream/SceneGraph.d.ts +16 -0
- package/dist/stream/StreamNetworkFrame.d.ts +4 -0
- package/dist/stream/StreamOrdinalFrame.d.ts +4 -0
- package/dist/stream/StreamXYFrame.d.ts +4 -0
- package/dist/stream/accessorUtils.d.ts +2 -0
- package/dist/stream/index.d.ts +16 -0
- package/dist/stream/layouts/chordLayoutPlugin.d.ts +8 -0
- package/dist/stream/layouts/forceLayoutPlugin.d.ts +9 -0
- package/dist/stream/layouts/hierarchyLayoutPlugin.d.ts +17 -0
- package/dist/stream/layouts/index.d.ts +11 -0
- package/dist/stream/layouts/sankeyLayoutPlugin.d.ts +8 -0
- package/dist/stream/networkTypes.d.ts +346 -0
- package/dist/stream/ordinalSceneBuilders/barScene.d.ts +4 -0
- package/dist/stream/ordinalSceneBuilders/connectorScene.d.ts +3 -0
- package/dist/stream/ordinalSceneBuilders/pieScene.d.ts +3 -0
- package/dist/stream/ordinalSceneBuilders/pointScene.d.ts +4 -0
- package/dist/stream/ordinalSceneBuilders/statisticalScene.d.ts +6 -0
- package/dist/stream/ordinalSceneBuilders/timelineScene.d.ts +3 -0
- package/dist/stream/ordinalSceneBuilders/types.d.ts +21 -0
- package/dist/stream/ordinalTypes.d.ts +225 -0
- package/dist/stream/renderers/areaCanvasRenderer.d.ts +7 -0
- package/dist/stream/renderers/barCanvasRenderer.d.ts +7 -0
- package/dist/stream/renderers/boxplotCanvasRenderer.d.ts +2 -0
- package/dist/stream/renderers/candlestickCanvasRenderer.d.ts +2 -0
- package/dist/stream/renderers/connectorCanvasRenderer.d.ts +2 -0
- package/dist/stream/renderers/heatmapCanvasRenderer.d.ts +6 -0
- package/dist/stream/renderers/lineCanvasRenderer.d.ts +8 -0
- package/dist/stream/renderers/networkArcRenderer.d.ts +5 -0
- package/dist/stream/renderers/networkCircleRenderer.d.ts +5 -0
- package/dist/stream/renderers/networkEdgeRenderer.d.ts +10 -0
- package/dist/stream/renderers/networkParticleRenderer.d.ts +11 -0
- package/dist/stream/renderers/networkRectRenderer.d.ts +5 -0
- package/dist/stream/renderers/pointCanvasRenderer.d.ts +7 -0
- package/dist/stream/renderers/swarmCanvasRenderer.d.ts +7 -0
- package/dist/stream/renderers/types.d.ts +7 -0
- package/dist/stream/renderers/violinCanvasRenderer.d.ts +2 -0
- package/dist/stream/renderers/waterfallCanvasRenderer.d.ts +8 -0
- package/dist/stream/renderers/wedgeCanvasRenderer.d.ts +2 -0
- package/dist/stream/types.d.ts +307 -0
- package/dist/types/annotationTypes.d.ts +13 -18
- package/dist/types/canvasTypes.d.ts +1 -1
- package/dist/types/generalTypes.d.ts +41 -36
- package/dist/types/interactionTypes.d.ts +7 -9
- package/dist/types/legendTypes.d.ts +2 -2
- package/dist/types/networkTypes.d.ts +40 -30
- package/dist/types/ordinalTypes.d.ts +27 -18
- package/dist/types/xyTypes.d.ts +1 -95
- package/dist/visualizationLayerBehavior/axis.d.ts +3 -5
- package/dist/visualizationLayerBehavior/general.d.ts +8 -12
- package/dist/xy.js +6993 -0
- package/dist/xy.js.map +1 -0
- package/dist/xy.min.js +1 -0
- package/dist/xy.module.js +6957 -0
- package/dist/xy.module.js.map +1 -0
- package/dist/xy.module.min.js +1 -0
- package/package.json +123 -67
- package/dist/AnnotationLayer/helpers.d.ts +0 -6
- package/dist/AnnotationLayer/index.d.ts +0 -2
- package/dist/FacetController.d.ts +0 -12
- package/dist/Frame.d.ts +0 -2
- package/dist/InteractionLayer.d.ts +0 -3
- package/dist/Mark/Mark.d.ts +0 -3
- package/dist/Mark/Mark.types.d.ts +0 -10
- package/dist/Mark/constants/markTransition.d.ts +0 -10
- package/dist/Mark/markBehavior/drawing.d.ts +0 -13
- package/dist/MiniMap.d.ts +0 -14
- package/dist/MinimapXYFrame.d.ts +0 -10
- package/dist/NetworkFrame.d.ts +0 -4
- package/dist/OrdinalFrame.d.ts +0 -4
- package/dist/ResponsiveFrame.d.ts +0 -22
- package/dist/ResponsiveMinimapXYFrame.d.ts +0 -6
- package/dist/ResponsiveNetworkFrame.d.ts +0 -6
- package/dist/ResponsiveOrdinalFrame.d.ts +0 -6
- package/dist/ResponsiveXYFrame.d.ts +0 -6
- package/dist/SpanOrDiv.d.ts +0 -10
- package/dist/SparkFrame.d.ts +0 -14
- package/dist/SparkNetworkFrame.d.ts +0 -5
- package/dist/SparkOrdinalFrame.d.ts +0 -5
- package/dist/SparkXYFrame.d.ts +0 -5
- package/dist/VisualizationLayer.d.ts +0 -33
- package/dist/XYFrame.d.ts +0 -4
- package/dist/annotationRules/orframeRules.d.ts +0 -105
- package/dist/components/Annotation.d.ts +0 -3
- package/dist/components/AnnotationLayer/AnnotationLayer.d.ts +0 -26
- package/dist/components/Axis/Axis.d.ts +0 -7
- package/dist/components/Axis/axisTitle.d.ts +0 -10
- package/dist/components/Axis/index.d.ts +0 -2
- package/dist/components/Axis/summaryGraphic.d.ts +0 -17
- package/dist/components/Brush.d.ts +0 -12
- package/dist/components/DividedLine.d.ts +0 -16
- package/dist/components/FacetController.d.ts +0 -12
- package/dist/components/Frame.d.ts +0 -2
- package/dist/components/InteractionLayer.d.ts +0 -3
- package/dist/components/Legend.d.ts +0 -3
- package/dist/components/Mark/Mark.d.ts +0 -3
- package/dist/components/Mark/Mark.types.d.ts +0 -10
- package/dist/components/Mark/markBehavior/drawing.d.ts +0 -13
- package/dist/components/MiniMap.d.ts +0 -14
- package/dist/components/MinimapXYFrame.d.ts +0 -10
- package/dist/components/NetworkFrame.d.ts +0 -4
- package/dist/components/OrdinalFrame.d.ts +0 -4
- package/dist/components/ResponsiveFrame.d.ts +0 -22
- package/dist/components/ResponsiveMinimapXYFrame.d.ts +0 -6
- package/dist/components/ResponsiveNetworkFrame.d.ts +0 -6
- package/dist/components/ResponsiveOrdinalFrame.d.ts +0 -6
- package/dist/components/ResponsiveXYFrame.d.ts +0 -6
- package/dist/components/SpanOrDiv.d.ts +0 -10
- package/dist/components/SparkFrame.d.ts +0 -14
- package/dist/components/SparkNetworkFrame.d.ts +0 -5
- package/dist/components/SparkOrdinalFrame.d.ts +0 -5
- package/dist/components/SparkXYFrame.d.ts +0 -5
- package/dist/components/TooltipPositioner/index.d.ts +0 -7
- package/dist/components/VisualizationLayer.d.ts +0 -33
- package/dist/components/XYFrame.d.ts +0 -4
- package/dist/components/annotationLayerBehavior/annotationHandling.d.ts +0 -19
- package/dist/components/annotationLayerBehavior/d3labeler.d.ts +0 -9
- package/dist/components/annotationRules/baseRules.d.ts +0 -25
- package/dist/components/annotationRules/networkframeRules.d.ts +0 -48
- package/dist/components/annotationRules/orframeRules.d.ts +0 -105
- package/dist/components/annotationRules/xyframeRules.d.ts +0 -117
- package/dist/components/batchWork.d.ts +0 -6
- package/dist/components/constants/coordinateNames.d.ts +0 -8
- package/dist/components/constants/frame_props.d.ts +0 -4
- package/dist/components/constants/jsx.d.ts +0 -19
- package/dist/components/data/dataFunctions.d.ts +0 -46
- package/dist/components/data/multiAccessorUtils.d.ts +0 -1
- package/dist/components/data/unflowedFunctions.d.ts +0 -1
- package/dist/components/generic_utilities/functions.d.ts +0 -1
- package/dist/components/index.d.ts +0 -125
- package/dist/components/interactionLayerBehavior/InteractionCanvas.d.ts +0 -20
- package/dist/components/processing/InteractionItems.d.ts +0 -12
- package/dist/components/processing/network.d.ts +0 -114
- package/dist/components/processing/ordinal.d.ts +0 -102
- package/dist/components/processing/xyDrawing.d.ts +0 -135
- package/dist/components/semiotic.d.ts +0 -35
- package/dist/components/store/TooltipStore.d.ts +0 -2
- package/dist/components/store/createStore.d.ts +0 -1
- package/dist/components/svg/SvgHelper.d.ts +0 -37
- package/dist/components/svg/areaDrawing.d.ts +0 -31
- package/dist/components/svg/ckmeans.d.ts +0 -69
- package/dist/components/svg/frameFunctions.d.ts +0 -119
- package/dist/components/svg/lineDrawing.d.ts +0 -99
- package/dist/components/svg/networkDrawing.d.ts +0 -134
- package/dist/components/svg/pieceDrawing.d.ts +0 -13
- package/dist/components/svg/pieceLayouts.d.ts +0 -71
- package/dist/components/svg/summaryLayouts.d.ts +0 -74
- package/dist/components/types/annotationTypes.d.ts +0 -140
- package/dist/components/types/canvasTypes.d.ts +0 -9
- package/dist/components/types/generalTypes.d.ts +0 -236
- package/dist/components/types/interactionTypes.d.ts +0 -74
- package/dist/components/types/legendTypes.d.ts +0 -20
- package/dist/components/types/networkTypes.d.ts +0 -165
- package/dist/components/types/ordinalTypes.d.ts +0 -103
- package/dist/components/types/xyTypes.d.ts +0 -118
- package/dist/components/useBoundingRect.d.ts +0 -2
- package/dist/components/useDerivedStateFromProps.d.ts +0 -1
- package/dist/components/useLegacyUnmountCallback.d.ts +0 -1
- package/dist/components/visualizationLayerBehavior/axis.d.ts +0 -38
- package/dist/components/visualizationLayerBehavior/general.d.ts +0 -84
- package/dist/constants/jsx.d.ts +0 -19
- package/dist/interactionLayerBehavior/InteractionCanvas.d.ts +0 -20
- package/dist/processing/network.d.ts +0 -114
- package/dist/processing/ordinal.d.ts +0 -102
- package/dist/processing/xyDrawing.d.ts +0 -135
- package/dist/setupTests.d.ts +0 -1
- package/dist/svg/SvgHelper.d.ts +0 -37
- package/dist/svg/ckmeans.d.ts +0 -69
- package/dist/svg/frameFunctions.d.ts +0 -119
- package/dist/svg/networkDrawing.d.ts +0 -134
- package/dist/svg/pieceDrawing.d.ts +0 -13
- package/dist/svg/pieceLayouts.d.ts +0 -71
- package/dist/svg/summaryLayouts.d.ts +0 -74
- package/dist/useDerivedStateFromProps.d.ts +0 -1
- package/dist/useLegacyUnmountCallback.d.ts +0 -1
|
@@ -0,0 +1,786 @@
|
|
|
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;
|