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,245 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sankeyLayoutPlugin = void 0;
|
|
4
|
+
const d3_sankey_circular_1 = require("d3-sankey-circular");
|
|
5
|
+
const d3_scale_chromatic_1 = require("d3-scale-chromatic");
|
|
6
|
+
const sankeyLinks_1 = require("../../geometry/sankeyLinks");
|
|
7
|
+
const sankeyOrientHash = {
|
|
8
|
+
left: d3_sankey_circular_1.sankeyLeft,
|
|
9
|
+
right: d3_sankey_circular_1.sankeyRight,
|
|
10
|
+
center: d3_sankey_circular_1.sankeyCenter,
|
|
11
|
+
justify: d3_sankey_circular_1.sankeyJustify
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Sankey layout plugin — uses d3-sankey-circular for layout computation.
|
|
15
|
+
*
|
|
16
|
+
* Produces rect scene nodes for Sankey node bars and bezier band scene edges
|
|
17
|
+
* for the flow links. Supports both horizontal and vertical orientation.
|
|
18
|
+
*/
|
|
19
|
+
exports.sankeyLayoutPlugin = {
|
|
20
|
+
supportsStreaming: true,
|
|
21
|
+
hierarchical: false,
|
|
22
|
+
computeLayout(nodes, edges, config, size) {
|
|
23
|
+
if (nodes.length === 0)
|
|
24
|
+
return;
|
|
25
|
+
const direction = config.orientation === "vertical" ? "down" : "right";
|
|
26
|
+
const orient = config.nodeAlign || "justify";
|
|
27
|
+
const nodeWidth = config.nodeWidth ?? 15;
|
|
28
|
+
const nodePaddingRatio = config.nodePaddingRatio ?? 0.05;
|
|
29
|
+
const iterations = config.iterations ?? 100;
|
|
30
|
+
// Clone for d3-sankey (it mutates)
|
|
31
|
+
const sankeyNodes = nodes.map((n) => ({ ...n }));
|
|
32
|
+
const sankeyEdges = edges.map((e) => ({
|
|
33
|
+
...e,
|
|
34
|
+
source: typeof e.source === "string" ? e.source : e.source.id,
|
|
35
|
+
target: typeof e.target === "string" ? e.target : e.target.id
|
|
36
|
+
}));
|
|
37
|
+
let frameExtent;
|
|
38
|
+
if (direction === "down") {
|
|
39
|
+
frameExtent = [[0, 0], [size[1], size[0]]];
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
frameExtent = [[0, 0], [size[0], size[1]]];
|
|
43
|
+
}
|
|
44
|
+
const sankey = (0, d3_sankey_circular_1.sankeyCircular)()
|
|
45
|
+
.extent(frameExtent)
|
|
46
|
+
.links(sankeyEdges)
|
|
47
|
+
.nodes(sankeyNodes)
|
|
48
|
+
.nodeAlign(sankeyOrientHash[orient] || d3_sankey_circular_1.sankeyJustify)
|
|
49
|
+
.nodeId((d) => d.id)
|
|
50
|
+
.nodeWidth(nodeWidth)
|
|
51
|
+
.iterations(iterations);
|
|
52
|
+
if (sankey.nodePaddingRatio) {
|
|
53
|
+
sankey.nodePaddingRatio(nodePaddingRatio);
|
|
54
|
+
}
|
|
55
|
+
// Execute layout
|
|
56
|
+
sankey();
|
|
57
|
+
// Write computed positions back to original nodes
|
|
58
|
+
for (const sn of sankeyNodes) {
|
|
59
|
+
const original = nodes.find((n) => n.id === sn.id);
|
|
60
|
+
if (original) {
|
|
61
|
+
original.x0 = sn.x0;
|
|
62
|
+
original.x1 = sn.x1;
|
|
63
|
+
original.y0 = sn.y0;
|
|
64
|
+
original.y1 = sn.y1;
|
|
65
|
+
original.value = sn.value;
|
|
66
|
+
original.depth = sn.depth;
|
|
67
|
+
original.sourceLinks = sn.sourceLinks;
|
|
68
|
+
original.targetLinks = sn.targetLinks;
|
|
69
|
+
// Derived
|
|
70
|
+
original.width = sn.x1 - sn.x0;
|
|
71
|
+
original.height = sn.y1 - sn.y0;
|
|
72
|
+
original.x = sn.x0 + (sn.x1 - sn.x0) / 2;
|
|
73
|
+
original.y = sn.y0 + (sn.y1 - sn.y0) / 2;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Write computed positions back to original edges
|
|
77
|
+
for (const se of sankeyEdges) {
|
|
78
|
+
const src = se.source;
|
|
79
|
+
const tgt = se.target;
|
|
80
|
+
const sourceId = typeof src === "object" && src !== null ? src.id : String(src);
|
|
81
|
+
const targetId = typeof tgt === "object" && tgt !== null ? tgt.id : String(tgt);
|
|
82
|
+
// Find matching original edge
|
|
83
|
+
const original = edges.find((e) => {
|
|
84
|
+
const eSrc = typeof e.source === "string" ? e.source : e.source.id;
|
|
85
|
+
const eTgt = typeof e.target === "string" ? e.target : e.target.id;
|
|
86
|
+
return eSrc === sourceId && eTgt === targetId;
|
|
87
|
+
});
|
|
88
|
+
if (original) {
|
|
89
|
+
original.y0 = se.y0;
|
|
90
|
+
original.y1 = se.y1;
|
|
91
|
+
original.sankeyWidth = se.width ?? 0;
|
|
92
|
+
original.circular = !!se.circular;
|
|
93
|
+
original.circularPathData = se.circularPathData;
|
|
94
|
+
original.direction = direction;
|
|
95
|
+
// Resolve source/target to node references
|
|
96
|
+
const srcNode = nodes.find((n) => n.id === sourceId);
|
|
97
|
+
const tgtNode = nodes.find((n) => n.id === targetId);
|
|
98
|
+
if (srcNode)
|
|
99
|
+
original.source = srcNode;
|
|
100
|
+
if (tgtNode)
|
|
101
|
+
original.target = tgtNode;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
buildScene(nodes, edges, config, size) {
|
|
106
|
+
const direction = config.orientation === "vertical" ? "down" : "right";
|
|
107
|
+
const nodeStyleFn = config.nodeStyle;
|
|
108
|
+
const edgeStyleFn = config.edgeStyle;
|
|
109
|
+
const edgeOpacity = config.edgeOpacity ?? 0.5;
|
|
110
|
+
const edgeColorBy = config.edgeColorBy || "source";
|
|
111
|
+
// Auto-color palette for when no nodeStyle is provided
|
|
112
|
+
const palette = Array.isArray(config.colorScheme)
|
|
113
|
+
? config.colorScheme
|
|
114
|
+
: d3_scale_chromatic_1.schemeCategory10;
|
|
115
|
+
const nodeColorMap = new Map();
|
|
116
|
+
nodes.forEach((n, i) => {
|
|
117
|
+
nodeColorMap.set(n.id, palette[i % palette.length]);
|
|
118
|
+
});
|
|
119
|
+
const sceneNodes = [];
|
|
120
|
+
const sceneEdges = [];
|
|
121
|
+
const labels = [];
|
|
122
|
+
// Build rect nodes
|
|
123
|
+
for (const node of nodes) {
|
|
124
|
+
const w = node.x1 - node.x0;
|
|
125
|
+
const h = node.y1 - node.y0;
|
|
126
|
+
if (w <= 0 || h <= 0)
|
|
127
|
+
continue;
|
|
128
|
+
const userStyle = nodeStyleFn ? nodeStyleFn(node) : {};
|
|
129
|
+
const style = {
|
|
130
|
+
fill: userStyle.fill || nodeColorMap.get(node.id) || "#4d430c",
|
|
131
|
+
stroke: userStyle.stroke,
|
|
132
|
+
strokeWidth: userStyle.strokeWidth,
|
|
133
|
+
opacity: userStyle.opacity
|
|
134
|
+
};
|
|
135
|
+
sceneNodes.push({
|
|
136
|
+
type: "rect",
|
|
137
|
+
x: node.x0,
|
|
138
|
+
y: node.y0,
|
|
139
|
+
w,
|
|
140
|
+
h,
|
|
141
|
+
style,
|
|
142
|
+
datum: node,
|
|
143
|
+
id: node.id,
|
|
144
|
+
label: node.id
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
// Build bezier edge bands
|
|
148
|
+
// Sort by width descending so narrow bands render on top
|
|
149
|
+
const sortedEdges = [...edges].sort((a, b) => (b.sankeyWidth || 0) - (a.sankeyWidth || 0));
|
|
150
|
+
for (const edge of sortedEdges) {
|
|
151
|
+
if (!edge.sankeyWidth || edge.sankeyWidth <= 0)
|
|
152
|
+
continue;
|
|
153
|
+
const sourceNode = typeof edge.source === "object" ? edge.source : null;
|
|
154
|
+
const targetNode = typeof edge.target === "object" ? edge.target : null;
|
|
155
|
+
if (!sourceNode || !targetNode)
|
|
156
|
+
continue;
|
|
157
|
+
// Generate SVG path string using existing helpers
|
|
158
|
+
let pathD;
|
|
159
|
+
if (edge.circular && edge.circularPathData) {
|
|
160
|
+
pathD = (0, sankeyLinks_1.circularAreaLink)(edge);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
pathD = (0, sankeyLinks_1.areaLink)(edge);
|
|
164
|
+
}
|
|
165
|
+
// Resolve edge fill — use edgeStyle if provided, otherwise
|
|
166
|
+
// inherit from source or target node color
|
|
167
|
+
let fill = "#999";
|
|
168
|
+
if (edgeStyleFn) {
|
|
169
|
+
const userStyle = edgeStyleFn(edge);
|
|
170
|
+
fill = userStyle.fill || fill;
|
|
171
|
+
}
|
|
172
|
+
else if (edgeColorBy === "target" && targetNode) {
|
|
173
|
+
fill = nodeColorMap.get(targetNode.id) || fill;
|
|
174
|
+
}
|
|
175
|
+
else if (sourceNode) {
|
|
176
|
+
fill = nodeColorMap.get(sourceNode.id) || fill;
|
|
177
|
+
}
|
|
178
|
+
const userStyle = edgeStyleFn ? edgeStyleFn(edge) : {};
|
|
179
|
+
const style = {
|
|
180
|
+
fill,
|
|
181
|
+
fillOpacity: userStyle.fillOpacity ?? edgeOpacity,
|
|
182
|
+
stroke: userStyle.stroke || "none",
|
|
183
|
+
strokeWidth: userStyle.strokeWidth,
|
|
184
|
+
opacity: userStyle.opacity
|
|
185
|
+
};
|
|
186
|
+
sceneEdges.push({
|
|
187
|
+
type: "bezier",
|
|
188
|
+
pathD,
|
|
189
|
+
bezierCache: edge.bezier,
|
|
190
|
+
style,
|
|
191
|
+
datum: edge
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
// Build labels
|
|
195
|
+
if (config.showLabels !== false) {
|
|
196
|
+
const labelFn = resolveLabelFn(config.nodeLabel);
|
|
197
|
+
for (const node of nodes) {
|
|
198
|
+
const w = node.x1 - node.x0;
|
|
199
|
+
const h = node.y1 - node.y0;
|
|
200
|
+
if (w <= 0 || h <= 0)
|
|
201
|
+
continue;
|
|
202
|
+
const text = labelFn ? labelFn(node) : node.id;
|
|
203
|
+
if (!text)
|
|
204
|
+
continue;
|
|
205
|
+
let x;
|
|
206
|
+
let y;
|
|
207
|
+
let anchor;
|
|
208
|
+
if (direction === "down") {
|
|
209
|
+
x = node.x0 + w / 2;
|
|
210
|
+
y = node.y1 + 14;
|
|
211
|
+
anchor = "middle";
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
// Horizontal: label to the right or left depending on position
|
|
215
|
+
const midX = size[0] / 2;
|
|
216
|
+
if (node.x0 + w / 2 < midX) {
|
|
217
|
+
x = node.x0 - 6;
|
|
218
|
+
anchor = "end";
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
x = node.x1 + 6;
|
|
222
|
+
anchor = "start";
|
|
223
|
+
}
|
|
224
|
+
y = node.y0 + h / 2;
|
|
225
|
+
}
|
|
226
|
+
labels.push({
|
|
227
|
+
x,
|
|
228
|
+
y,
|
|
229
|
+
text: String(text),
|
|
230
|
+
anchor,
|
|
231
|
+
baseline: "middle",
|
|
232
|
+
fontSize: 11
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return { sceneNodes, sceneEdges, labels };
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
function resolveLabelFn(nodeLabel) {
|
|
240
|
+
if (!nodeLabel)
|
|
241
|
+
return null;
|
|
242
|
+
if (typeof nodeLabel === "function")
|
|
243
|
+
return nodeLabel;
|
|
244
|
+
return (d) => d[nodeLabel] || d.id;
|
|
245
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_PARTICLE_STYLE = exports.DEFAULT_TENSION_CONFIG = void 0;
|
|
4
|
+
exports.DEFAULT_TENSION_CONFIG = {
|
|
5
|
+
weightChange: 0.1,
|
|
6
|
+
newEdge: 0.5,
|
|
7
|
+
newNode: 1.0,
|
|
8
|
+
threshold: 3.0,
|
|
9
|
+
transitionDuration: 500
|
|
10
|
+
};
|
|
11
|
+
exports.DEFAULT_PARTICLE_STYLE = {
|
|
12
|
+
radius: 3,
|
|
13
|
+
opacity: 0.7,
|
|
14
|
+
speedMultiplier: 1,
|
|
15
|
+
maxPerEdge: 50,
|
|
16
|
+
spawnRate: 0.1
|
|
17
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildBarScene = buildBarScene;
|
|
4
|
+
exports.buildClusterBarScene = buildClusterBarScene;
|
|
5
|
+
const SceneGraph_1 = require("../SceneGraph");
|
|
6
|
+
function buildBarScene(ctx, layout) {
|
|
7
|
+
const { scales, columns, config, getR, getStack, resolvePieceStyle } = ctx;
|
|
8
|
+
const { r: rScale, projection } = scales;
|
|
9
|
+
const nodes = [];
|
|
10
|
+
const isVertical = projection === "vertical";
|
|
11
|
+
const isHorizontal = projection === "horizontal";
|
|
12
|
+
const normalize = config.normalize;
|
|
13
|
+
for (const col of Object.values(columns)) {
|
|
14
|
+
// Group pieces by stack key if stacking, and aggregate values per group
|
|
15
|
+
const stacks = new Map();
|
|
16
|
+
for (const d of col.pieceData) {
|
|
17
|
+
const key = getStack ? getStack(d) : "_default";
|
|
18
|
+
if (!stacks.has(key))
|
|
19
|
+
stacks.set(key, { total: 0, pieces: [] });
|
|
20
|
+
const group = stacks.get(key);
|
|
21
|
+
group.total += getR(d);
|
|
22
|
+
group.pieces.push(d);
|
|
23
|
+
}
|
|
24
|
+
// Compute totals for normalization
|
|
25
|
+
let colTotal = 0;
|
|
26
|
+
if (normalize) {
|
|
27
|
+
for (const g of stacks.values())
|
|
28
|
+
colTotal += Math.abs(g.total);
|
|
29
|
+
}
|
|
30
|
+
let posOffset = 0;
|
|
31
|
+
let negOffset = 0;
|
|
32
|
+
for (const [stackKey, group] of stacks) {
|
|
33
|
+
// Use the aggregated total for the stack group (one rect per group)
|
|
34
|
+
let val = group.total;
|
|
35
|
+
if (normalize && colTotal > 0)
|
|
36
|
+
val = val / colTotal;
|
|
37
|
+
// Use the first piece for styling — look up barColors by stack key (not category)
|
|
38
|
+
const style = getStack
|
|
39
|
+
? resolvePieceStyle(group.pieces[0], stackKey)
|
|
40
|
+
: resolvePieceStyle(group.pieces[0], col.name);
|
|
41
|
+
// Build a synthetic datum that includes the aggregate info
|
|
42
|
+
const aggDatum = {
|
|
43
|
+
...group.pieces[0],
|
|
44
|
+
__aggregateValue: group.total,
|
|
45
|
+
__pieceCount: group.pieces.length,
|
|
46
|
+
category: col.name
|
|
47
|
+
};
|
|
48
|
+
if (isVertical) {
|
|
49
|
+
const actualY = val >= 0
|
|
50
|
+
? rScale(posOffset + val)
|
|
51
|
+
: rScale(negOffset);
|
|
52
|
+
const actualH = val >= 0
|
|
53
|
+
? rScale(posOffset) - rScale(posOffset + val)
|
|
54
|
+
: rScale(negOffset + val) - rScale(negOffset);
|
|
55
|
+
nodes.push((0, SceneGraph_1.buildRectNode)(col.x, actualY, col.width, Math.abs(actualH), style, aggDatum, stackKey));
|
|
56
|
+
if (val >= 0)
|
|
57
|
+
posOffset += val;
|
|
58
|
+
else
|
|
59
|
+
negOffset += val;
|
|
60
|
+
}
|
|
61
|
+
else if (isHorizontal) {
|
|
62
|
+
const actualX = val >= 0
|
|
63
|
+
? rScale(posOffset)
|
|
64
|
+
: rScale(negOffset + val);
|
|
65
|
+
const actualW = val >= 0
|
|
66
|
+
? rScale(posOffset + val) - rScale(posOffset)
|
|
67
|
+
: rScale(negOffset) - rScale(negOffset + val);
|
|
68
|
+
nodes.push((0, SceneGraph_1.buildRectNode)(actualX, col.x, Math.abs(actualW), col.width, style, aggDatum, stackKey));
|
|
69
|
+
if (val >= 0)
|
|
70
|
+
posOffset += val;
|
|
71
|
+
else
|
|
72
|
+
negOffset += val;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return nodes;
|
|
77
|
+
}
|
|
78
|
+
function buildClusterBarScene(ctx, layout) {
|
|
79
|
+
const { scales, columns, getR, getGroup, resolvePieceStyle } = ctx;
|
|
80
|
+
const { r: rScale, projection } = scales;
|
|
81
|
+
const nodes = [];
|
|
82
|
+
const isVertical = projection === "vertical";
|
|
83
|
+
// Discover all group keys
|
|
84
|
+
const groupKeys = [];
|
|
85
|
+
const groupSet = new Set();
|
|
86
|
+
for (const col of Object.values(columns)) {
|
|
87
|
+
for (const d of col.pieceData) {
|
|
88
|
+
const key = getGroup ? getGroup(d) : "_default";
|
|
89
|
+
if (!groupSet.has(key)) {
|
|
90
|
+
groupSet.add(key);
|
|
91
|
+
groupKeys.push(key);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const groupCount = groupKeys.length || 1;
|
|
96
|
+
for (const col of Object.values(columns)) {
|
|
97
|
+
const subWidth = col.width / groupCount;
|
|
98
|
+
const grouped = new Map();
|
|
99
|
+
for (const d of col.pieceData) {
|
|
100
|
+
const key = getGroup ? getGroup(d) : "_default";
|
|
101
|
+
if (!grouped.has(key))
|
|
102
|
+
grouped.set(key, []);
|
|
103
|
+
grouped.get(key).push(d);
|
|
104
|
+
}
|
|
105
|
+
for (let gi = 0; gi < groupKeys.length; gi++) {
|
|
106
|
+
const groupData = grouped.get(groupKeys[gi]) || [];
|
|
107
|
+
for (const d of groupData) {
|
|
108
|
+
const val = getR(d);
|
|
109
|
+
const style = resolvePieceStyle(d, col.name);
|
|
110
|
+
if (isVertical) {
|
|
111
|
+
const barX = col.x + gi * subWidth;
|
|
112
|
+
const zeroY = rScale(0);
|
|
113
|
+
const valY = rScale(val);
|
|
114
|
+
nodes.push((0, SceneGraph_1.buildRectNode)(barX, Math.min(zeroY, valY), subWidth, Math.abs(zeroY - valY), style, d, groupKeys[gi]));
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
const barY = col.x + gi * subWidth;
|
|
118
|
+
const zeroX = rScale(0);
|
|
119
|
+
const valX = rScale(val);
|
|
120
|
+
nodes.push((0, SceneGraph_1.buildRectNode)(Math.min(zeroX, valX), barY, Math.abs(valX - zeroX), subWidth, style, d, groupKeys[gi]));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return nodes;
|
|
126
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildConnectors = buildConnectors;
|
|
4
|
+
function buildConnectors(ctx, pieceNodes, layout) {
|
|
5
|
+
const { scales, config, getConnector, getO } = ctx;
|
|
6
|
+
if (!getConnector || !scales)
|
|
7
|
+
return [];
|
|
8
|
+
const connectors = [];
|
|
9
|
+
const { projection } = scales;
|
|
10
|
+
// Group pieces by connector key
|
|
11
|
+
const groups = new Map();
|
|
12
|
+
for (const node of pieceNodes) {
|
|
13
|
+
if (node.type !== "point" && node.type !== "rect")
|
|
14
|
+
continue;
|
|
15
|
+
const datum = node.datum;
|
|
16
|
+
if (!datum)
|
|
17
|
+
continue;
|
|
18
|
+
const key = getConnector(datum);
|
|
19
|
+
if (!key)
|
|
20
|
+
continue;
|
|
21
|
+
let cx, cy;
|
|
22
|
+
if (node.type === "point") {
|
|
23
|
+
cx = node.x;
|
|
24
|
+
cy = node.y;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// rect: use center
|
|
28
|
+
cx = node.x + node.w / 2;
|
|
29
|
+
cy = node.y + (projection === "vertical" ? 0 : node.h / 2);
|
|
30
|
+
}
|
|
31
|
+
if (!groups.has(key))
|
|
32
|
+
groups.set(key, []);
|
|
33
|
+
groups.get(key).push({ x: cx, y: cy, datum, category: getO(datum) });
|
|
34
|
+
}
|
|
35
|
+
// Draw lines connecting pieces with the same connector key, sorted by category order
|
|
36
|
+
const oExtent = scales.o.domain();
|
|
37
|
+
const resolveConnStyle = config.connectorStyle;
|
|
38
|
+
for (const [key, points] of groups) {
|
|
39
|
+
if (points.length < 2)
|
|
40
|
+
continue;
|
|
41
|
+
// Sort by category order
|
|
42
|
+
points.sort((a, b) => oExtent.indexOf(a.category) - oExtent.indexOf(b.category));
|
|
43
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
44
|
+
const from = points[i];
|
|
45
|
+
const to = points[i + 1];
|
|
46
|
+
const style = typeof resolveConnStyle === "function"
|
|
47
|
+
? resolveConnStyle(from.datum)
|
|
48
|
+
: (resolveConnStyle || { stroke: "#999", strokeWidth: 1, opacity: 0.5 });
|
|
49
|
+
connectors.push({
|
|
50
|
+
type: "connector",
|
|
51
|
+
x1: from.x,
|
|
52
|
+
y1: from.y,
|
|
53
|
+
x2: to.x,
|
|
54
|
+
y2: to.y,
|
|
55
|
+
style,
|
|
56
|
+
datum: from.datum,
|
|
57
|
+
group: key
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return connectors;
|
|
62
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildPieScene = buildPieScene;
|
|
4
|
+
function buildPieScene(ctx, layout) {
|
|
5
|
+
const { scales, columns, config, resolvePieceStyle } = ctx;
|
|
6
|
+
const nodes = [];
|
|
7
|
+
// cx/cy are 0 because StreamOrdinalFrame translates the canvas
|
|
8
|
+
// to the center of the chart area for radial projection
|
|
9
|
+
const cx = 0;
|
|
10
|
+
const cy = 0;
|
|
11
|
+
const outerRadius = Math.min(layout.width, layout.height) / 2 - 4;
|
|
12
|
+
const innerRadius = config.chartType === "donut" ? (config.innerRadius || 60) : 0;
|
|
13
|
+
// Start from 12 o'clock (-π/2) plus any user offset
|
|
14
|
+
const startAngleOffset = -Math.PI / 2 + ((config.startAngle || 0) * Math.PI) / 180;
|
|
15
|
+
const twoPi = Math.PI * 2;
|
|
16
|
+
for (const col of Object.values(columns)) {
|
|
17
|
+
const startAngle = startAngleOffset + col.pctStart * twoPi;
|
|
18
|
+
const endAngle = startAngleOffset + (col.pctStart + col.pct) * twoPi;
|
|
19
|
+
const style = resolvePieceStyle(col.pieceData[0], col.name);
|
|
20
|
+
nodes.push({
|
|
21
|
+
type: "wedge",
|
|
22
|
+
cx, cy,
|
|
23
|
+
innerRadius,
|
|
24
|
+
outerRadius,
|
|
25
|
+
startAngle,
|
|
26
|
+
endAngle,
|
|
27
|
+
style,
|
|
28
|
+
datum: col.pieceData,
|
|
29
|
+
category: col.name
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return nodes;
|
|
33
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildPointScene = buildPointScene;
|
|
4
|
+
exports.buildSwarmScene = buildSwarmScene;
|
|
5
|
+
function buildPointScene(ctx, layout) {
|
|
6
|
+
const { scales, columns, getR, multiScales, resolvePieceStyle } = ctx;
|
|
7
|
+
const { r: rScale, projection } = scales;
|
|
8
|
+
const nodes = [];
|
|
9
|
+
const isVertical = projection === "vertical";
|
|
10
|
+
const isRadial = projection === "radial";
|
|
11
|
+
const hasMultiAxis = multiScales.length > 0;
|
|
12
|
+
const twoPi = Math.PI * 2;
|
|
13
|
+
const startAngleOffset = -Math.PI / 2;
|
|
14
|
+
for (const col of Object.values(columns)) {
|
|
15
|
+
for (const d of col.pieceData) {
|
|
16
|
+
const rIndex = d.__rIndex ?? 0;
|
|
17
|
+
const val = d.__rValue ?? getR(d);
|
|
18
|
+
const scale = hasMultiAxis ? (multiScales[rIndex] || rScale) : rScale;
|
|
19
|
+
const style = resolvePieceStyle(d, col.name);
|
|
20
|
+
const r = style.r || 5;
|
|
21
|
+
let px, py;
|
|
22
|
+
if (isRadial) {
|
|
23
|
+
// Radial: angle from category position, radius from value
|
|
24
|
+
const midAngle = startAngleOffset + (col.pctStart + col.pct / 2) * twoPi;
|
|
25
|
+
const radius = scale(val);
|
|
26
|
+
px = Math.cos(midAngle) * radius;
|
|
27
|
+
py = Math.sin(midAngle) * radius;
|
|
28
|
+
}
|
|
29
|
+
else if (isVertical) {
|
|
30
|
+
px = col.middle;
|
|
31
|
+
py = scale(val);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
px = scale(val);
|
|
35
|
+
py = col.middle;
|
|
36
|
+
}
|
|
37
|
+
nodes.push({ type: "point", x: px, y: py, r, style, datum: d });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return nodes;
|
|
41
|
+
}
|
|
42
|
+
function buildSwarmScene(ctx, layout) {
|
|
43
|
+
const { scales, columns, getR, resolvePieceStyle } = ctx;
|
|
44
|
+
const { r: rScale, projection } = scales;
|
|
45
|
+
const nodes = [];
|
|
46
|
+
const isVertical = projection === "vertical";
|
|
47
|
+
for (const col of Object.values(columns)) {
|
|
48
|
+
// Simple jittered placement (real force sim in Phase 3)
|
|
49
|
+
const halfWidth = col.width / 2;
|
|
50
|
+
for (let i = 0; i < col.pieceData.length; i++) {
|
|
51
|
+
const d = col.pieceData[i];
|
|
52
|
+
const val = getR(d);
|
|
53
|
+
const style = resolvePieceStyle(d, col.name);
|
|
54
|
+
const r = style.r || 4;
|
|
55
|
+
// Deterministic jitter based on index
|
|
56
|
+
const jitter = (((i * 7919) % 100) / 100 - 0.5) * halfWidth * 0.8;
|
|
57
|
+
const px = isVertical ? col.middle + jitter : rScale(val);
|
|
58
|
+
const py = isVertical ? rScale(val) : col.middle + jitter;
|
|
59
|
+
nodes.push({ type: "point", x: px, y: py, r, style, datum: d });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return nodes;
|
|
63
|
+
}
|