semiotic 3.0.0-beta.2 → 3.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +93 -753
- package/README.md +92 -7
- package/ai/dist/componentRegistry.js +26 -0
- package/ai/dist/{ai/mcp-server.js → mcp-server.js} +1 -1
- package/ai/dist/{ai/renderHOCToSVG.js → renderHOCToSVG.js} +2 -2
- package/dist/ChartContainer.d.ts +60 -0
- package/dist/DetailsPanel.d.ts +37 -0
- package/dist/LinkedCharts.d.ts +2 -0
- package/dist/Tooltip/Tooltip.d.ts +2 -2
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/ordinal/BarChart.d.ts +1 -0
- package/dist/charts/ordinal/BoxPlot.d.ts +1 -0
- package/dist/charts/ordinal/DonutChart.d.ts +1 -0
- package/dist/charts/ordinal/DotPlot.d.ts +1 -0
- package/dist/charts/ordinal/GroupedBarChart.d.ts +1 -0
- package/dist/charts/ordinal/Histogram.d.ts +1 -0
- package/dist/charts/ordinal/PieChart.d.ts +1 -0
- package/dist/charts/ordinal/RidgelinePlot.d.ts +1 -0
- package/dist/charts/ordinal/StackedBarChart.d.ts +1 -0
- package/dist/charts/ordinal/SwarmPlot.d.ts +1 -0
- package/dist/charts/ordinal/ViolinPlot.d.ts +1 -0
- package/dist/charts/realtime/RealtimeHeatmap.d.ts +11 -0
- package/dist/charts/realtime/RealtimeHistogram.d.ts +15 -1
- package/dist/charts/realtime/RealtimeLineChart.d.ts +6 -0
- package/dist/charts/realtime/RealtimeSwarmChart.d.ts +6 -0
- package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +6 -0
- package/dist/charts/shared/annotationRules.d.ts +3 -0
- package/dist/charts/shared/colorUtils.d.ts +17 -11
- package/dist/charts/shared/hooks.d.ts +96 -1
- package/dist/charts/shared/loess.d.ts +13 -0
- package/dist/charts/shared/networkUtils.d.ts +31 -0
- package/dist/charts/shared/tooltipUtils.d.ts +16 -0
- package/dist/charts/shared/types.d.ts +17 -2
- package/dist/charts/shared/validateChartData.d.ts +2 -3
- package/dist/charts/shared/validateProps.d.ts +18 -0
- package/dist/charts/xy/AreaChart.d.ts +4 -0
- package/dist/charts/xy/BubbleChart.d.ts +6 -0
- package/dist/charts/xy/Heatmap.d.ts +4 -0
- package/dist/charts/xy/LineChart.d.ts +6 -0
- package/dist/charts/xy/Scatterplot.d.ts +4 -0
- package/dist/charts/xy/StackedAreaChart.d.ts +4 -0
- package/dist/data/fromVegaLite.d.ts +48 -0
- package/dist/export/chartConfig.d.ts +29 -0
- package/dist/export/selectionSerializer.d.ts +20 -0
- package/dist/geometry/sankeyLinks.d.ts +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime/types.d.ts +20 -6
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +14 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.d.ts +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-network.d.ts +9 -19
- package/dist/semiotic-ordinal.d.ts +12 -14
- package/dist/semiotic-xy.d.ts +12 -18
- package/dist/semiotic.d.ts +16 -13
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/store/ObservationStore.d.ts +61 -0
- package/dist/store/SelectionStore.d.ts +9 -1
- package/dist/store/ThemeStore.d.ts +6 -1
- package/dist/store/TooltipStore.d.ts +3 -1
- package/dist/store/createStore.d.ts +4 -1
- package/dist/store/useObservation.d.ts +18 -0
- package/dist/stream/MarginalGraphics.d.ts +1 -1
- package/dist/stream/NetworkPipelineStore.d.ts +44 -0
- package/dist/stream/OrdinalCanvasHitTester.d.ts +1 -0
- package/dist/stream/OrdinalSVGOverlay.d.ts +6 -2
- package/dist/stream/ParticlePool.d.ts +2 -1
- package/dist/stream/PipelineStore.d.ts +11 -0
- package/dist/stream/SVGOverlay.d.ts +21 -2
- package/dist/stream/SceneGraph.d.ts +1 -1
- package/dist/stream/networkTypes.d.ts +58 -1
- package/dist/stream/ordinalTypes.d.ts +13 -0
- package/dist/stream/types.d.ts +14 -0
- package/dist/types/annotationTypes.d.ts +10 -0
- package/dist/types/networkTypes.d.ts +1 -2
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +30 -42
- package/ai/dist/ai/componentRegistry.js +0 -45
- package/ai/dist/src/components/Annotation.js +0 -358
- package/ai/dist/src/components/AnnotationLayer/AnnotationLayer.js +0 -369
- package/ai/dist/src/components/Axis/Axis.js +0 -374
- package/ai/dist/src/components/Axis/axisTitle.js +0 -14
- package/ai/dist/src/components/Axis/index.js +0 -7
- package/ai/dist/src/components/Axis/summaryGraphic.js +0 -37
- package/ai/dist/src/components/Brush.js +0 -84
- package/ai/dist/src/components/ChartErrorBoundary.js +0 -91
- package/ai/dist/src/components/DividedLine.js +0 -65
- package/ai/dist/src/components/Legend.js +0 -140
- package/ai/dist/src/components/LinkedCharts.js +0 -95
- package/ai/dist/src/components/ThemeProvider.js +0 -79
- package/ai/dist/src/components/Tooltip/Tooltip.js +0 -309
- package/ai/dist/src/components/TooltipPositioner/index.js +0 -132
- package/ai/dist/src/components/annotationLayerBehavior/annotationHandling.js +0 -73
- package/ai/dist/src/components/annotationLayerBehavior/d3labeler.js +0 -254
- package/ai/dist/src/components/annotationRules/baseRules.js +0 -150
- package/ai/dist/src/components/annotationRules/networkframeRules.js +0 -196
- package/ai/dist/src/components/annotationRules/xyframeRules.js +0 -297
- package/ai/dist/src/components/batchWork.js +0 -35
- package/ai/dist/src/components/charts/index.js +0 -109
- package/ai/dist/src/components/charts/network/ChordDiagram.js +0 -142
- package/ai/dist/src/components/charts/network/CirclePack.js +0 -108
- package/ai/dist/src/components/charts/network/ForceDirectedGraph.js +0 -121
- package/ai/dist/src/components/charts/network/SankeyDiagram.js +0 -155
- package/ai/dist/src/components/charts/network/TreeDiagram.js +0 -110
- package/ai/dist/src/components/charts/network/Treemap.js +0 -106
- package/ai/dist/src/components/charts/ordinal/BarChart.js +0 -156
- package/ai/dist/src/components/charts/ordinal/BoxPlot.js +0 -139
- package/ai/dist/src/components/charts/ordinal/DonutChart.js +0 -130
- package/ai/dist/src/components/charts/ordinal/DotPlot.js +0 -126
- package/ai/dist/src/components/charts/ordinal/GroupedBarChart.js +0 -129
- package/ai/dist/src/components/charts/ordinal/Histogram.js +0 -132
- package/ai/dist/src/components/charts/ordinal/PieChart.js +0 -128
- package/ai/dist/src/components/charts/ordinal/RidgelinePlot.js +0 -130
- package/ai/dist/src/components/charts/ordinal/StackedBarChart.js +0 -130
- package/ai/dist/src/components/charts/ordinal/SwarmPlot.js +0 -147
- package/ai/dist/src/components/charts/ordinal/ViolinPlot.js +0 -138
- package/ai/dist/src/components/charts/realtime/RealtimeHeatmap.js +0 -79
- package/ai/dist/src/components/charts/realtime/RealtimeHistogram.js +0 -114
- package/ai/dist/src/components/charts/realtime/RealtimeLineChart.js +0 -93
- package/ai/dist/src/components/charts/realtime/RealtimeSwarmChart.js +0 -105
- package/ai/dist/src/components/charts/realtime/RealtimeWaterfallChart.js +0 -106
- package/ai/dist/src/components/charts/shared/ChartError.js +0 -72
- package/ai/dist/src/components/charts/shared/colorUtils.js +0 -138
- package/ai/dist/src/components/charts/shared/formatUtils.js +0 -213
- package/ai/dist/src/components/charts/shared/hooks.js +0 -49
- package/ai/dist/src/components/charts/shared/legendUtils.js +0 -57
- package/ai/dist/src/components/charts/shared/selectionUtils.js +0 -67
- package/ai/dist/src/components/charts/shared/tooltipUtils.js +0 -79
- package/ai/dist/src/components/charts/shared/types.js +0 -2
- package/ai/dist/src/components/charts/shared/validateChartData.js +0 -82
- package/ai/dist/src/components/charts/shared/validateProps.js +0 -736
- package/ai/dist/src/components/charts/xy/AreaChart.js +0 -230
- package/ai/dist/src/components/charts/xy/BubbleChart.js +0 -251
- package/ai/dist/src/components/charts/xy/Heatmap.js +0 -235
- package/ai/dist/src/components/charts/xy/LineChart.js +0 -307
- package/ai/dist/src/components/charts/xy/MinimapChart.js +0 -298
- package/ai/dist/src/components/charts/xy/Scatterplot.js +0 -172
- package/ai/dist/src/components/charts/xy/ScatterplotMatrix.js +0 -426
- package/ai/dist/src/components/charts/xy/StackedAreaChart.js +0 -231
- package/ai/dist/src/components/constants/coordinateNames.js +0 -11
- package/ai/dist/src/components/constants/frame_props.js +0 -251
- package/ai/dist/src/components/data/dataFunctions.js +0 -487
- package/ai/dist/src/components/data/multiAccessorUtils.js +0 -14
- package/ai/dist/src/components/data/transforms.js +0 -143
- package/ai/dist/src/components/data/unflowedFunctions.js +0 -5
- package/ai/dist/src/components/export/exportChart.js +0 -121
- package/ai/dist/src/components/generic_utilities/functions.js +0 -5
- package/ai/dist/src/components/geometry/areaDrawing.js +0 -312
- package/ai/dist/src/components/geometry/contourLayout.js +0 -73
- package/ai/dist/src/components/geometry/hexbinLayout.js +0 -163
- package/ai/dist/src/components/geometry/lineDrawing.js +0 -356
- package/ai/dist/src/components/geometry/sankeyLinks.js +0 -331
- package/ai/dist/src/components/geometry/summaryLayouts.js +0 -136
- package/ai/dist/src/components/index.js +0 -18
- package/ai/dist/src/components/processing/InteractionItems.js +0 -223
- package/ai/dist/src/components/processing/hierarchyUtils.js +0 -104
- package/ai/dist/src/components/processing/layouts/chordLayout.js +0 -58
- package/ai/dist/src/components/processing/layouts/forceLayout.js +0 -142
- package/ai/dist/src/components/processing/layouts/hierarchyLayout.js +0 -31
- package/ai/dist/src/components/processing/layouts/index.js +0 -32
- package/ai/dist/src/components/processing/layouts/sankeyLayout.js +0 -96
- package/ai/dist/src/components/processing/layouts/simpleLayouts.js +0 -34
- package/ai/dist/src/components/processing/layouts/types.js +0 -2
- package/ai/dist/src/components/processing/networkDefaults.js +0 -39
- package/ai/dist/src/components/realtime/BinAccumulator.js +0 -36
- package/ai/dist/src/components/realtime/IncrementalExtent.js +0 -55
- package/ai/dist/src/components/realtime/RingBuffer.js +0 -104
- package/ai/dist/src/components/realtime/renderers/barRenderer.js +0 -133
- package/ai/dist/src/components/realtime/renderers/candlestickRenderer.js +0 -7
- package/ai/dist/src/components/realtime/renderers/lineRenderer.js +0 -164
- package/ai/dist/src/components/realtime/renderers/swarmRenderer.js +0 -91
- package/ai/dist/src/components/realtime/renderers/types.js +0 -2
- package/ai/dist/src/components/realtime/renderers/waterfallRenderer.js +0 -163
- package/ai/dist/src/components/realtime/types.js +0 -2
- package/ai/dist/src/components/semiotic-ai.js +0 -89
- package/ai/dist/src/components/semiotic-data.js +0 -12
- package/ai/dist/src/components/semiotic-network.js +0 -38
- package/ai/dist/src/components/semiotic-ordinal.js +0 -28
- package/ai/dist/src/components/semiotic-realtime.js +0 -30
- package/ai/dist/src/components/semiotic-server.js +0 -8
- package/ai/dist/src/components/semiotic-xy.js +0 -35
- package/ai/dist/src/components/semiotic.js +0 -109
- package/ai/dist/src/components/server/renderToStaticSVG.js +0 -594
- package/ai/dist/src/components/store/SelectionStore.js +0 -91
- package/ai/dist/src/components/store/ThemeStore.js +0 -78
- package/ai/dist/src/components/store/TooltipStore.js +0 -13
- package/ai/dist/src/components/store/createStore.js +0 -81
- package/ai/dist/src/components/store/useSelection.js +0 -133
- package/ai/dist/src/components/stream/CanvasHitTester.js +0 -164
- package/ai/dist/src/components/stream/DataSourceAdapter.js +0 -99
- package/ai/dist/src/components/stream/MarginalGraphics.js +0 -266
- package/ai/dist/src/components/stream/NetworkCanvasHitTester.js +0 -228
- package/ai/dist/src/components/stream/NetworkPipelineStore.js +0 -498
- package/ai/dist/src/components/stream/NetworkSVGOverlay.js +0 -70
- package/ai/dist/src/components/stream/NetworkSceneGraph.js +0 -38
- package/ai/dist/src/components/stream/OrdinalCanvasHitTester.js +0 -146
- package/ai/dist/src/components/stream/OrdinalPipelineStore.js +0 -786
- package/ai/dist/src/components/stream/OrdinalSVGOverlay.js +0 -130
- package/ai/dist/src/components/stream/ParticlePool.js +0 -174
- package/ai/dist/src/components/stream/PipelineStore.js +0 -1243
- package/ai/dist/src/components/stream/SVGOverlay.js +0 -129
- package/ai/dist/src/components/stream/SceneGraph.js +0 -132
- package/ai/dist/src/components/stream/StreamNetworkFrame.js +0 -561
- package/ai/dist/src/components/stream/StreamOrdinalFrame.js +0 -492
- package/ai/dist/src/components/stream/StreamXYFrame.js +0 -590
- package/ai/dist/src/components/stream/accessorUtils.js +0 -20
- package/ai/dist/src/components/stream/index.js +0 -32
- package/ai/dist/src/components/stream/layouts/chordLayoutPlugin.js +0 -352
- package/ai/dist/src/components/stream/layouts/forceLayoutPlugin.js +0 -230
- package/ai/dist/src/components/stream/layouts/hierarchyLayoutPlugin.js +0 -568
- package/ai/dist/src/components/stream/layouts/index.js +0 -28
- package/ai/dist/src/components/stream/layouts/sankeyLayoutPlugin.js +0 -245
- package/ai/dist/src/components/stream/networkTypes.js +0 -17
- package/ai/dist/src/components/stream/ordinalSceneBuilders/barScene.js +0 -126
- package/ai/dist/src/components/stream/ordinalSceneBuilders/connectorScene.js +0 -62
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pieScene.js +0 -33
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pointScene.js +0 -63
- package/ai/dist/src/components/stream/ordinalSceneBuilders/statisticalScene.js +0 -278
- package/ai/dist/src/components/stream/ordinalSceneBuilders/timelineScene.js +0 -30
- package/ai/dist/src/components/stream/ordinalSceneBuilders/types.js +0 -2
- package/ai/dist/src/components/stream/ordinalTypes.js +0 -2
- package/ai/dist/src/components/stream/renderers/areaCanvasRenderer.js +0 -48
- package/ai/dist/src/components/stream/renderers/barCanvasRenderer.js +0 -70
- package/ai/dist/src/components/stream/renderers/boxplotCanvasRenderer.js +0 -75
- package/ai/dist/src/components/stream/renderers/candlestickCanvasRenderer.js +0 -28
- package/ai/dist/src/components/stream/renderers/connectorCanvasRenderer.js +0 -47
- package/ai/dist/src/components/stream/renderers/heatmapCanvasRenderer.js +0 -31
- package/ai/dist/src/components/stream/renderers/lineCanvasRenderer.js +0 -140
- package/ai/dist/src/components/stream/renderers/networkArcRenderer.js +0 -38
- package/ai/dist/src/components/stream/renderers/networkCircleRenderer.js +0 -37
- package/ai/dist/src/components/stream/renderers/networkEdgeRenderer.js +0 -102
- package/ai/dist/src/components/stream/renderers/networkParticleRenderer.js +0 -63
- package/ai/dist/src/components/stream/renderers/networkRectRenderer.js +0 -35
- package/ai/dist/src/components/stream/renderers/pointCanvasRenderer.js +0 -38
- package/ai/dist/src/components/stream/renderers/swarmCanvasRenderer.js +0 -10
- package/ai/dist/src/components/stream/renderers/types.js +0 -2
- package/ai/dist/src/components/stream/renderers/violinCanvasRenderer.js +0 -47
- package/ai/dist/src/components/stream/renderers/waterfallCanvasRenderer.js +0 -38
- package/ai/dist/src/components/stream/renderers/wedgeCanvasRenderer.js +0 -33
- package/ai/dist/src/components/stream/types.js +0 -2
- package/ai/dist/src/components/types/annotationTypes.js +0 -2
- package/ai/dist/src/components/types/canvasTypes.js +0 -2
- package/ai/dist/src/components/types/generalTypes.js +0 -2
- package/ai/dist/src/components/types/interactionTypes.js +0 -2
- package/ai/dist/src/components/types/legendTypes.js +0 -2
- package/ai/dist/src/components/types/networkTypes.js +0 -2
- package/ai/dist/src/components/types/ordinalTypes.js +0 -2
- package/ai/dist/src/components/types/xyTypes.js +0 -2
- package/ai/dist/src/components/useBoundingRect.js +0 -24
- package/ai/dist/src/components/visualizationLayerBehavior/axis.js +0 -301
- package/ai/dist/src/components/visualizationLayerBehavior/general.js +0 -435
- package/ai/dist/src/setupTests.js +0 -4
- package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -25
- package/dist/Axis/Axis.d.ts +0 -7
- package/dist/Axis/axisTitle.d.ts +0 -10
- package/dist/Axis/index.d.ts +0 -2
- package/dist/Axis/summaryGraphic.d.ts +0 -17
- package/dist/Brush.d.ts +0 -12
- package/dist/DividedLine.d.ts +0 -16
- package/dist/TooltipPositioner/index.d.ts +0 -7
- package/dist/annotationLayerBehavior/annotationHandling.d.ts +0 -19
- package/dist/annotationLayerBehavior/d3labeler.d.ts +0 -9
- package/dist/annotationRules/baseRules.d.ts +0 -25
- package/dist/annotationRules/networkframeRules.d.ts +0 -48
- package/dist/annotationRules/xyframeRules.d.ts +0 -117
- package/dist/batchWork.d.ts +0 -6
- package/dist/constants/coordinateNames.d.ts +0 -8
- package/dist/constants/frame_props.d.ts +0 -13
- package/dist/data/dataFunctions.d.ts +0 -45
- package/dist/data/multiAccessorUtils.d.ts +0 -1
- package/dist/data/unflowedFunctions.d.ts +0 -1
- package/dist/generic_utilities/functions.d.ts +0 -1
- package/dist/geometry/areaDrawing.d.ts +0 -21
- package/dist/geometry/contourLayout.d.ts +0 -6
- package/dist/geometry/hexbinLayout.d.ts +0 -7
- package/dist/geometry/lineDrawing.d.ts +0 -71
- package/dist/geometry/summaryLayouts.d.ts +0 -45
- package/dist/index.d.ts +0 -1
- package/dist/network.js +0 -7495
- package/dist/network.js.map +0 -1
- package/dist/network.module.js +0 -7458
- package/dist/network.module.js.map +0 -1
- package/dist/ordinal.js +0 -6497
- package/dist/ordinal.js.map +0 -1
- package/dist/ordinal.module.js +0 -6465
- package/dist/ordinal.module.js.map +0 -1
- package/dist/processing/InteractionItems.d.ts +0 -13
- package/dist/processing/hierarchyUtils.d.ts +0 -16
- package/dist/processing/layouts/chordLayout.d.ts +0 -2
- package/dist/processing/layouts/forceLayout.d.ts +0 -3
- package/dist/processing/layouts/hierarchyLayout.d.ts +0 -10
- package/dist/processing/layouts/index.d.ts +0 -8
- package/dist/processing/layouts/sankeyLayout.d.ts +0 -8
- package/dist/processing/layouts/simpleLayouts.d.ts +0 -7
- package/dist/processing/layouts/types.d.ts +0 -17
- package/dist/processing/networkDefaults.d.ts +0 -36
- package/dist/realtime/renderers/barRenderer.d.ts +0 -2
- package/dist/realtime/renderers/candlestickRenderer.d.ts +0 -2
- package/dist/realtime/renderers/lineRenderer.d.ts +0 -2
- package/dist/realtime/renderers/swarmRenderer.d.ts +0 -2
- package/dist/realtime.js +0 -7072
- package/dist/realtime.js.map +0 -1
- package/dist/realtime.module.js +0 -7043
- package/dist/realtime.module.js.map +0 -1
- package/dist/semiotic-ai.js +0 -13323
- package/dist/semiotic-ai.js.map +0 -1
- package/dist/semiotic-ai.module.js +0 -13264
- package/dist/semiotic-ai.module.js.map +0 -1
- package/dist/semiotic-data.js +0 -141
- package/dist/semiotic-data.js.map +0 -1
- package/dist/semiotic-data.module.js +0 -136
- package/dist/semiotic-data.module.js.map +0 -1
- package/dist/semiotic.js +0 -16351
- package/dist/semiotic.js.map +0 -1
- package/dist/semiotic.module.js +0 -16265
- package/dist/semiotic.module.js.map +0 -1
- package/dist/server.js +0 -5191
- package/dist/server.js.map +0 -1
- package/dist/server.module.js +0 -5166
- package/dist/server.module.js.map +0 -1
- package/dist/stream/NetworkSceneGraph.d.ts +0 -14
- package/dist/stream/index.d.ts +0 -16
- package/dist/types/canvasTypes.d.ts +0 -9
- package/dist/types/xyTypes.d.ts +0 -24
- package/dist/useBoundingRect.d.ts +0 -2
- package/dist/visualizationLayerBehavior/axis.d.ts +0 -36
- package/dist/visualizationLayerBehavior/general.d.ts +0 -80
- package/dist/xy.js +0 -6993
- package/dist/xy.js.map +0 -1
- package/dist/xy.module.js +0 -6957
- package/dist/xy.module.js.map +0 -1
|
@@ -1,245 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,126 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
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
|
-
}
|