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,594 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.renderToStaticSVG = renderToStaticSVG;
|
|
37
|
+
exports.renderXYToStaticSVG = renderXYToStaticSVG;
|
|
38
|
+
exports.renderOrdinalToStaticSVG = renderOrdinalToStaticSVG;
|
|
39
|
+
exports.renderNetworkToStaticSVG = renderNetworkToStaticSVG;
|
|
40
|
+
const React = __importStar(require("react"));
|
|
41
|
+
const ReactDOMServer = __importStar(require("react-dom/server"));
|
|
42
|
+
const d3_shape_1 = require("d3-shape");
|
|
43
|
+
const PipelineStore_1 = require("../stream/PipelineStore");
|
|
44
|
+
const layouts_1 = require("../stream/layouts");
|
|
45
|
+
const OrdinalPipelineStore_1 = require("../stream/OrdinalPipelineStore");
|
|
46
|
+
// ── Scene graph → SVG conversion ──────────────────────────────────────────
|
|
47
|
+
function sceneNodeToSVG(node, i) {
|
|
48
|
+
switch (node.type) {
|
|
49
|
+
case "line": {
|
|
50
|
+
const n = node;
|
|
51
|
+
if (n.path.length === 0)
|
|
52
|
+
return null;
|
|
53
|
+
const d = "M" + n.path.map(([x, y]) => `${x},${y}`).join("L");
|
|
54
|
+
return (React.createElement("path", { key: `line-${i}`, d: d, fill: "none", stroke: n.style.stroke || "#4e79a7", strokeWidth: n.style.strokeWidth || 2, strokeDasharray: n.style.strokeDasharray, opacity: n.style.opacity }));
|
|
55
|
+
}
|
|
56
|
+
case "area": {
|
|
57
|
+
const n = node;
|
|
58
|
+
if (n.topPath.length === 0)
|
|
59
|
+
return null;
|
|
60
|
+
const top = n.topPath.map(([x, y]) => `${x},${y}`).join("L");
|
|
61
|
+
const bottom = [...n.bottomPath].reverse().map(([x, y]) => `${x},${y}`).join("L");
|
|
62
|
+
const d = `M${top}L${bottom}Z`;
|
|
63
|
+
return (React.createElement("path", { key: `area-${i}`, d: d, fill: n.style.fill || "#4e79a7", fillOpacity: n.style.fillOpacity ?? n.style.opacity ?? 0.7, stroke: n.style.stroke, strokeWidth: n.style.strokeWidth }));
|
|
64
|
+
}
|
|
65
|
+
case "point": {
|
|
66
|
+
const n = node;
|
|
67
|
+
return (React.createElement("circle", { key: `point-${i}`, cx: n.x, cy: n.y, r: n.r, fill: n.style.fill || "#4e79a7", opacity: n.style.opacity ?? 0.8, stroke: n.style.stroke, strokeWidth: n.style.strokeWidth }));
|
|
68
|
+
}
|
|
69
|
+
case "rect": {
|
|
70
|
+
const n = node;
|
|
71
|
+
return (React.createElement("rect", { key: `rect-${i}`, x: n.x, y: n.y, width: n.w, height: n.h, fill: n.style.fill || "#4e79a7", opacity: n.style.opacity, stroke: n.style.stroke, strokeWidth: n.style.strokeWidth }));
|
|
72
|
+
}
|
|
73
|
+
case "heatcell": {
|
|
74
|
+
const n = node;
|
|
75
|
+
return (React.createElement("rect", { key: `heatcell-${i}`, x: n.x, y: n.y, width: n.w, height: n.h, fill: n.fill }));
|
|
76
|
+
}
|
|
77
|
+
case "candlestick": {
|
|
78
|
+
const n = node;
|
|
79
|
+
const bodyTop = Math.min(n.openY, n.closeY);
|
|
80
|
+
const bodyHeight = Math.max(Math.abs(n.openY - n.closeY), 1);
|
|
81
|
+
const bodyColor = n.isUp ? n.upColor : n.downColor;
|
|
82
|
+
return (React.createElement("g", { key: `candle-${i}` },
|
|
83
|
+
React.createElement("line", { x1: n.x, y1: n.highY, x2: n.x, y2: n.lowY, stroke: n.wickColor, strokeWidth: n.wickWidth }),
|
|
84
|
+
React.createElement("rect", { x: n.x - n.bodyWidth / 2, y: bodyTop, width: n.bodyWidth, height: bodyHeight, fill: bodyColor, stroke: bodyColor, strokeWidth: 1 })));
|
|
85
|
+
}
|
|
86
|
+
default:
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function defaultTickFormat(v) {
|
|
91
|
+
return String(Math.round(v * 100) / 100);
|
|
92
|
+
}
|
|
93
|
+
function generateAxesSVG(scales, layout, props) {
|
|
94
|
+
const xTicks = scales.x.ticks(5).map(v => ({
|
|
95
|
+
pixel: scales.x(v),
|
|
96
|
+
label: (props.xFormat || props.tickFormatTime || defaultTickFormat)(v)
|
|
97
|
+
}));
|
|
98
|
+
const yTicks = scales.y.ticks(5).map(v => ({
|
|
99
|
+
pixel: scales.y(v),
|
|
100
|
+
label: (props.yFormat || props.tickFormatValue || defaultTickFormat)(v)
|
|
101
|
+
}));
|
|
102
|
+
return (React.createElement("g", { className: "stream-axes" },
|
|
103
|
+
React.createElement("line", { x1: 0, y1: layout.height, x2: layout.width, y2: layout.height, stroke: "#ccc", strokeWidth: 1 }),
|
|
104
|
+
xTicks.map((tick, i) => (React.createElement("g", { key: `xtick-${i}`, transform: `translate(${tick.pixel},${layout.height})` },
|
|
105
|
+
React.createElement("line", { y2: 5, stroke: "#ccc", strokeWidth: 1 }),
|
|
106
|
+
React.createElement("text", { y: 18, textAnchor: "middle", fontSize: 10, fill: "#666" }, tick.label)))),
|
|
107
|
+
props.xLabel && (React.createElement("text", { x: layout.width / 2, y: layout.height + 40, textAnchor: "middle", fontSize: 12, fill: "#333" }, props.xLabel)),
|
|
108
|
+
React.createElement("line", { x1: 0, y1: 0, x2: 0, y2: layout.height, stroke: "#ccc", strokeWidth: 1 }),
|
|
109
|
+
yTicks.map((tick, i) => (React.createElement("g", { key: `ytick-${i}`, transform: `translate(0,${tick.pixel})` },
|
|
110
|
+
React.createElement("line", { x2: -5, stroke: "#ccc", strokeWidth: 1 }),
|
|
111
|
+
React.createElement("text", { x: -8, textAnchor: "end", dominantBaseline: "middle", fontSize: 10, fill: "#666" }, tick.label)))),
|
|
112
|
+
props.yLabel && (React.createElement("text", { x: -(props.margin?.left ?? 40) + 15, y: layout.height / 2, textAnchor: "middle", fontSize: 12, fill: "#333", transform: `rotate(-90, ${-(props.margin?.left ?? 40) + 15}, ${layout.height / 2})` }, props.yLabel))));
|
|
113
|
+
}
|
|
114
|
+
// ── StreamXYFrame SSR ─────────────────────────────────────────────────────
|
|
115
|
+
function renderStreamXYFrame(props) {
|
|
116
|
+
const defaultMargin = { top: 20, right: 20, bottom: 30, left: 40 };
|
|
117
|
+
const size = props.size || [500, 300];
|
|
118
|
+
const margin = { ...defaultMargin, ...props.margin };
|
|
119
|
+
const width = size[0] - margin.left - margin.right;
|
|
120
|
+
const height = size[1] - margin.top - margin.bottom;
|
|
121
|
+
const isStreaming = props.runtimeMode === "streaming" ||
|
|
122
|
+
["bar", "swarm", "waterfall"].includes(props.chartType);
|
|
123
|
+
const pipelineConfig = {
|
|
124
|
+
chartType: props.chartType,
|
|
125
|
+
windowSize: props.windowSize ?? 200,
|
|
126
|
+
windowMode: props.windowMode ?? "sliding",
|
|
127
|
+
arrowOfTime: isStreaming ? (props.arrowOfTime ?? "right") : "right",
|
|
128
|
+
extentPadding: props.extentPadding ?? 0.1,
|
|
129
|
+
xAccessor: isStreaming ? undefined : props.xAccessor,
|
|
130
|
+
yAccessor: isStreaming ? undefined : props.yAccessor,
|
|
131
|
+
timeAccessor: isStreaming ? props.timeAccessor : undefined,
|
|
132
|
+
valueAccessor: props.valueAccessor,
|
|
133
|
+
colorAccessor: props.colorAccessor,
|
|
134
|
+
sizeAccessor: props.sizeAccessor,
|
|
135
|
+
groupAccessor: props.groupAccessor,
|
|
136
|
+
categoryAccessor: props.categoryAccessor,
|
|
137
|
+
lineDataAccessor: props.lineDataAccessor,
|
|
138
|
+
xExtent: props.xExtent,
|
|
139
|
+
yExtent: props.yExtent,
|
|
140
|
+
sizeRange: props.sizeRange,
|
|
141
|
+
binSize: props.binSize,
|
|
142
|
+
normalize: props.normalize,
|
|
143
|
+
boundsAccessor: props.boundsAccessor,
|
|
144
|
+
boundsStyle: props.boundsStyle,
|
|
145
|
+
openAccessor: props.openAccessor,
|
|
146
|
+
highAccessor: props.highAccessor,
|
|
147
|
+
lowAccessor: props.lowAccessor,
|
|
148
|
+
closeAccessor: props.closeAccessor,
|
|
149
|
+
candlestickStyle: props.candlestickStyle,
|
|
150
|
+
lineStyle: props.lineStyle,
|
|
151
|
+
pointStyle: props.pointStyle,
|
|
152
|
+
areaStyle: props.areaStyle,
|
|
153
|
+
colorScheme: props.colorScheme,
|
|
154
|
+
barColors: props.barColors
|
|
155
|
+
};
|
|
156
|
+
const store = new PipelineStore_1.PipelineStore(pipelineConfig);
|
|
157
|
+
// Ingest bounded data
|
|
158
|
+
if (props.data) {
|
|
159
|
+
store.ingest({ inserts: props.data, bounded: true });
|
|
160
|
+
}
|
|
161
|
+
// Compute scene graph
|
|
162
|
+
store.computeScene({ width, height });
|
|
163
|
+
if (!store.scales || store.scene.length === 0) {
|
|
164
|
+
// No data — return empty SVG
|
|
165
|
+
return ReactDOMServer.renderToStaticMarkup(React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: "stream-xy-frame", width: size[0], height: size[1] }));
|
|
166
|
+
}
|
|
167
|
+
// Convert scene nodes to SVG
|
|
168
|
+
const dataMarks = store.scene
|
|
169
|
+
.map((node, i) => sceneNodeToSVG(node, i))
|
|
170
|
+
.filter(Boolean);
|
|
171
|
+
// Generate axes
|
|
172
|
+
const showAxes = props.showAxes !== false;
|
|
173
|
+
const axes = showAxes
|
|
174
|
+
? generateAxesSVG(store.scales, { width, height }, props)
|
|
175
|
+
: null;
|
|
176
|
+
// Title
|
|
177
|
+
const title = props.title && typeof props.title === "string" ? (React.createElement("text", { x: size[0] / 2, y: 16, textAnchor: "middle", fontSize: 14, fontWeight: "bold", fill: "#333" }, props.title)) : null;
|
|
178
|
+
// Background
|
|
179
|
+
const bg = props.background ? (React.createElement("rect", { x: 0, y: 0, width: width, height: height, fill: props.background })) : null;
|
|
180
|
+
const svgElement = (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: `stream-xy-frame${props.className ? ` ${props.className}` : ""}`, width: size[0], height: size[1] },
|
|
181
|
+
React.createElement("g", { transform: `translate(${margin.left},${margin.top})` },
|
|
182
|
+
bg,
|
|
183
|
+
dataMarks,
|
|
184
|
+
axes),
|
|
185
|
+
title));
|
|
186
|
+
return ReactDOMServer.renderToStaticMarkup(svgElement);
|
|
187
|
+
}
|
|
188
|
+
// ── Network scene graph → SVG conversion ──────────────────────────────────
|
|
189
|
+
function networkSceneNodeToSVG(node, i) {
|
|
190
|
+
switch (node.type) {
|
|
191
|
+
case "circle": {
|
|
192
|
+
const n = node;
|
|
193
|
+
return (React.createElement("circle", { key: `net-circle-${i}`, cx: n.cx, cy: n.cy, r: n.r, fill: n.style.fill || "#4e79a7", stroke: n.style.stroke, strokeWidth: n.style.strokeWidth, opacity: n.style.opacity }));
|
|
194
|
+
}
|
|
195
|
+
case "rect": {
|
|
196
|
+
const n = node;
|
|
197
|
+
return (React.createElement("rect", { key: `net-rect-${i}`, x: n.x, y: n.y, width: n.w, height: n.h, fill: n.style.fill || "#4e79a7", stroke: n.style.stroke, strokeWidth: n.style.strokeWidth, opacity: n.style.opacity }));
|
|
198
|
+
}
|
|
199
|
+
case "arc": {
|
|
200
|
+
const n = node;
|
|
201
|
+
const arcPath = (0, d3_shape_1.arc)()
|
|
202
|
+
.innerRadius(n.innerR)
|
|
203
|
+
.outerRadius(n.outerR)
|
|
204
|
+
.startAngle(n.startAngle)
|
|
205
|
+
.endAngle(n.endAngle)({}) || "";
|
|
206
|
+
return (React.createElement("path", { key: `net-arc-${i}`, d: arcPath, transform: `translate(${n.cx},${n.cy})`, fill: n.style.fill || "#4e79a7", stroke: n.style.stroke, strokeWidth: n.style.strokeWidth, opacity: n.style.opacity }));
|
|
207
|
+
}
|
|
208
|
+
default:
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function networkSceneEdgeToSVG(edge, i) {
|
|
213
|
+
switch (edge.type) {
|
|
214
|
+
case "line": {
|
|
215
|
+
const e = edge;
|
|
216
|
+
return (React.createElement("line", { key: `net-edge-line-${i}`, x1: e.x1, y1: e.y1, x2: e.x2, y2: e.y2, stroke: e.style.stroke || "#999", strokeWidth: e.style.strokeWidth || 1, opacity: e.style.opacity }));
|
|
217
|
+
}
|
|
218
|
+
case "bezier": {
|
|
219
|
+
const e = edge;
|
|
220
|
+
return (React.createElement("path", { key: `net-edge-bezier-${i}`, d: e.pathD, fill: e.style.fill || "#999", fillOpacity: e.style.fillOpacity, stroke: e.style.stroke || "none", strokeWidth: e.style.strokeWidth, opacity: e.style.opacity }));
|
|
221
|
+
}
|
|
222
|
+
case "ribbon": {
|
|
223
|
+
const e = edge;
|
|
224
|
+
return (React.createElement("path", { key: `net-edge-ribbon-${i}`, d: e.pathD, fill: e.style.fill || "#999", fillOpacity: e.style.fillOpacity, stroke: e.style.stroke || "none", strokeWidth: e.style.strokeWidth, opacity: e.style.opacity }));
|
|
225
|
+
}
|
|
226
|
+
case "curved": {
|
|
227
|
+
const e = edge;
|
|
228
|
+
return (React.createElement("path", { key: `net-edge-curved-${i}`, d: e.pathD, fill: e.style.fill || "none", stroke: e.style.stroke || "#999", strokeWidth: e.style.strokeWidth || 1, opacity: e.style.opacity }));
|
|
229
|
+
}
|
|
230
|
+
default:
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function networkLabelToSVG(label, i) {
|
|
235
|
+
return (React.createElement("text", { key: `net-label-${i}`, x: label.x, y: label.y, textAnchor: label.anchor || "middle", dominantBaseline: (label.baseline || "auto"), fontSize: label.fontSize || 11, fontWeight: label.fontWeight, fill: label.fill || "#333", stroke: label.stroke, strokeWidth: label.strokeWidth, paintOrder: label.paintOrder }, label.text));
|
|
236
|
+
}
|
|
237
|
+
// ── Helper functions for building RealtimeNodes/Edges from props ──────────
|
|
238
|
+
function resolveAccessor(accessor, defaultKey) {
|
|
239
|
+
if (!accessor)
|
|
240
|
+
return (d) => d[defaultKey];
|
|
241
|
+
if (typeof accessor === "function")
|
|
242
|
+
return accessor;
|
|
243
|
+
return (d) => d[accessor];
|
|
244
|
+
}
|
|
245
|
+
function buildRealtimeNodes(propsNodes, config) {
|
|
246
|
+
const nodeIDFn = resolveAccessor(config.nodeIDAccessor, "id");
|
|
247
|
+
return propsNodes.map((d) => ({
|
|
248
|
+
id: String(nodeIDFn(d)),
|
|
249
|
+
x: 0,
|
|
250
|
+
y: 0,
|
|
251
|
+
x0: 0,
|
|
252
|
+
x1: 0,
|
|
253
|
+
y0: 0,
|
|
254
|
+
y1: 0,
|
|
255
|
+
width: 0,
|
|
256
|
+
height: 0,
|
|
257
|
+
value: 0,
|
|
258
|
+
data: d
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
261
|
+
function buildRealtimeEdges(propsEdges, config) {
|
|
262
|
+
const sourceFn = resolveAccessor(config.sourceAccessor, "source");
|
|
263
|
+
const targetFn = resolveAccessor(config.targetAccessor, "target");
|
|
264
|
+
const valueFn = resolveAccessor(config.valueAccessor, "value");
|
|
265
|
+
return propsEdges.map((d) => ({
|
|
266
|
+
source: String(sourceFn(d)),
|
|
267
|
+
target: String(targetFn(d)),
|
|
268
|
+
value: Number(valueFn(d)) || 1,
|
|
269
|
+
y0: 0,
|
|
270
|
+
y1: 0,
|
|
271
|
+
sankeyWidth: 0,
|
|
272
|
+
data: d
|
|
273
|
+
}));
|
|
274
|
+
}
|
|
275
|
+
// ── Stream-first network renderer ─────────────────────────────────────────
|
|
276
|
+
const HIERARCHICAL_TYPES = new Set([
|
|
277
|
+
"tree",
|
|
278
|
+
"cluster",
|
|
279
|
+
"treemap",
|
|
280
|
+
"circlepack",
|
|
281
|
+
"partition"
|
|
282
|
+
]);
|
|
283
|
+
function renderNetworkFrame(props) {
|
|
284
|
+
const chartType = props.chartType || "force";
|
|
285
|
+
const size = props.size || [500, 500];
|
|
286
|
+
const defaultMargin = { top: 20, right: 20, bottom: 20, left: 20 };
|
|
287
|
+
const margin = { ...defaultMargin, ...props.margin };
|
|
288
|
+
const innerWidth = size[0] - margin.left - margin.right;
|
|
289
|
+
const innerHeight = size[1] - margin.top - margin.bottom;
|
|
290
|
+
const plugin = (0, layouts_1.getLayoutPlugin)(chartType);
|
|
291
|
+
if (!plugin) {
|
|
292
|
+
throw new Error(`No layout plugin found for chart type: "${chartType}". ` +
|
|
293
|
+
`Supported types: force, sankey, chord, tree, cluster, treemap, circlepack, partition.`);
|
|
294
|
+
}
|
|
295
|
+
// Build pipeline config from props
|
|
296
|
+
const config = {
|
|
297
|
+
chartType,
|
|
298
|
+
nodeIDAccessor: props.nodeIDAccessor,
|
|
299
|
+
sourceAccessor: props.sourceAccessor,
|
|
300
|
+
targetAccessor: props.targetAccessor,
|
|
301
|
+
valueAccessor: props.valueAccessor,
|
|
302
|
+
childrenAccessor: props.childrenAccessor,
|
|
303
|
+
hierarchySum: props.hierarchySum,
|
|
304
|
+
orientation: props.orientation,
|
|
305
|
+
nodeAlign: props.nodeAlign,
|
|
306
|
+
nodePaddingRatio: props.nodePaddingRatio,
|
|
307
|
+
nodeWidth: props.nodeWidth,
|
|
308
|
+
iterations: props.iterations,
|
|
309
|
+
forceStrength: props.forceStrength,
|
|
310
|
+
padAngle: props.padAngle,
|
|
311
|
+
groupWidth: props.groupWidth,
|
|
312
|
+
sortGroups: props.sortGroups,
|
|
313
|
+
edgeSort: props.edgeSort,
|
|
314
|
+
treeOrientation: props.treeOrientation,
|
|
315
|
+
edgeType: props.edgeType,
|
|
316
|
+
padding: props.padding,
|
|
317
|
+
paddingTop: props.paddingTop,
|
|
318
|
+
nodeStyle: props.nodeStyle,
|
|
319
|
+
edgeStyle: props.edgeStyle,
|
|
320
|
+
nodeLabel: props.nodeLabel,
|
|
321
|
+
showLabels: props.showLabels,
|
|
322
|
+
colorBy: props.colorBy,
|
|
323
|
+
colorScheme: props.colorScheme,
|
|
324
|
+
edgeColorBy: props.edgeColorBy,
|
|
325
|
+
edgeOpacity: props.edgeOpacity,
|
|
326
|
+
colorByDepth: props.colorByDepth,
|
|
327
|
+
nodeSize: props.nodeSize,
|
|
328
|
+
nodeSizeRange: props.nodeSizeRange
|
|
329
|
+
};
|
|
330
|
+
let nodes;
|
|
331
|
+
let edges;
|
|
332
|
+
if (HIERARCHICAL_TYPES.has(chartType)) {
|
|
333
|
+
// Hierarchical layouts: single root object from props.data or props.edges
|
|
334
|
+
const hierarchyRoot = props.data || props.edges;
|
|
335
|
+
if (!hierarchyRoot || Array.isArray(hierarchyRoot)) {
|
|
336
|
+
// No valid hierarchy root — return empty SVG
|
|
337
|
+
return ReactDOMServer.renderToStaticMarkup(React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: "stream-network-frame", width: size[0], height: size[1] }));
|
|
338
|
+
}
|
|
339
|
+
// The hierarchy plugin expects the root via config.__hierarchyRoot
|
|
340
|
+
;
|
|
341
|
+
config.__hierarchyRoot = hierarchyRoot;
|
|
342
|
+
// computeLayout will populate these arrays from the hierarchy
|
|
343
|
+
nodes = [];
|
|
344
|
+
edges = [];
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
// Graph layouts (force, sankey, chord): nodes + edges arrays
|
|
348
|
+
const propsNodes = props.nodes || [];
|
|
349
|
+
const propsEdges = Array.isArray(props.edges) ? props.edges : [];
|
|
350
|
+
if (propsNodes.length === 0 && propsEdges.length === 0) {
|
|
351
|
+
return ReactDOMServer.renderToStaticMarkup(React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: "stream-network-frame", width: size[0], height: size[1] }));
|
|
352
|
+
}
|
|
353
|
+
nodes = buildRealtimeNodes(propsNodes, config);
|
|
354
|
+
edges = buildRealtimeEdges(propsEdges, config);
|
|
355
|
+
}
|
|
356
|
+
// Run layout
|
|
357
|
+
plugin.computeLayout(nodes, edges, config, [innerWidth, innerHeight]);
|
|
358
|
+
// Build scene graph
|
|
359
|
+
const { sceneNodes, sceneEdges, labels } = plugin.buildScene(nodes, edges, config, [innerWidth, innerHeight]);
|
|
360
|
+
// Convert scene graph to SVG elements
|
|
361
|
+
const edgeElements = sceneEdges
|
|
362
|
+
.map((edge, i) => networkSceneEdgeToSVG(edge, i))
|
|
363
|
+
.filter(Boolean);
|
|
364
|
+
const nodeElements = sceneNodes
|
|
365
|
+
.map((node, i) => networkSceneNodeToSVG(node, i))
|
|
366
|
+
.filter(Boolean);
|
|
367
|
+
const labelElements = labels
|
|
368
|
+
.map((label, i) => networkLabelToSVG(label, i))
|
|
369
|
+
.filter(Boolean);
|
|
370
|
+
// Title
|
|
371
|
+
const title = props.title && typeof props.title === "string" ? (React.createElement("text", { x: size[0] / 2, y: 16, textAnchor: "middle", fontSize: 14, fontWeight: "bold", fill: "#333" }, props.title)) : null;
|
|
372
|
+
// Background
|
|
373
|
+
const bg = props.background ? (React.createElement("rect", { x: 0, y: 0, width: innerWidth, height: innerHeight, fill: props.background })) : null;
|
|
374
|
+
const svgElement = (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: `stream-network-frame${props.className ? ` ${props.className}` : ""}`, width: size[0], height: size[1] },
|
|
375
|
+
React.createElement("g", { transform: `translate(${margin.left},${margin.top})` },
|
|
376
|
+
bg,
|
|
377
|
+
edgeElements,
|
|
378
|
+
nodeElements,
|
|
379
|
+
labelElements),
|
|
380
|
+
title));
|
|
381
|
+
return ReactDOMServer.renderToStaticMarkup(svgElement);
|
|
382
|
+
}
|
|
383
|
+
// ── Ordinal scene graph → SVG conversion ─────────────────────────────
|
|
384
|
+
function ordinalSceneNodeToSVG(node, i) {
|
|
385
|
+
switch (node.type) {
|
|
386
|
+
case "rect": {
|
|
387
|
+
const n = node;
|
|
388
|
+
return (React.createElement("rect", { key: `ord-rect-${i}`, x: n.x, y: n.y, width: n.w, height: n.h, fill: n.style.fill || "#4e79a7", opacity: n.style.opacity, stroke: n.style.stroke, strokeWidth: n.style.strokeWidth }));
|
|
389
|
+
}
|
|
390
|
+
case "point": {
|
|
391
|
+
const n = node;
|
|
392
|
+
return (React.createElement("circle", { key: `ord-point-${i}`, cx: n.x, cy: n.y, r: n.r, fill: n.style.fill || "#4e79a7", opacity: n.style.opacity ?? 0.8, stroke: n.style.stroke, strokeWidth: n.style.strokeWidth }));
|
|
393
|
+
}
|
|
394
|
+
case "wedge": {
|
|
395
|
+
const n = node;
|
|
396
|
+
const arcPath = (0, d3_shape_1.arc)()
|
|
397
|
+
.innerRadius(n.innerRadius)
|
|
398
|
+
.outerRadius(n.outerRadius)
|
|
399
|
+
.startAngle(n.startAngle)
|
|
400
|
+
.endAngle(n.endAngle)({}) || "";
|
|
401
|
+
return (React.createElement("path", { key: `ord-wedge-${i}`, d: arcPath, transform: `translate(${n.cx},${n.cy})`, fill: n.style.fill || "#4e79a7", stroke: n.style.stroke, strokeWidth: n.style.strokeWidth, opacity: n.style.opacity }));
|
|
402
|
+
}
|
|
403
|
+
case "boxplot": {
|
|
404
|
+
const n = node;
|
|
405
|
+
const halfW = n.columnWidth / 2;
|
|
406
|
+
if (n.projection === "vertical") {
|
|
407
|
+
return (React.createElement("g", { key: `ord-boxplot-${i}` },
|
|
408
|
+
React.createElement("line", { x1: n.x, y1: n.minPos, x2: n.x, y2: n.maxPos, stroke: n.style.stroke || "#333", strokeWidth: 1 }),
|
|
409
|
+
React.createElement("rect", { x: n.x - halfW, y: Math.min(n.q1Pos, n.q3Pos), width: n.columnWidth, height: Math.abs(n.q3Pos - n.q1Pos), fill: n.style.fill || "#4e79a7", fillOpacity: n.style.fillOpacity ?? 0.6, stroke: n.style.stroke || "#333", strokeWidth: 1 }),
|
|
410
|
+
React.createElement("line", { x1: n.x - halfW, y1: n.medianPos, x2: n.x + halfW, y2: n.medianPos, stroke: n.style.stroke || "#333", strokeWidth: 2 }),
|
|
411
|
+
React.createElement("line", { x1: n.x - halfW * 0.5, y1: n.minPos, x2: n.x + halfW * 0.5, y2: n.minPos, stroke: n.style.stroke || "#333", strokeWidth: 1 }),
|
|
412
|
+
React.createElement("line", { x1: n.x - halfW * 0.5, y1: n.maxPos, x2: n.x + halfW * 0.5, y2: n.maxPos, stroke: n.style.stroke || "#333", strokeWidth: 1 })));
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
// horizontal
|
|
416
|
+
return (React.createElement("g", { key: `ord-boxplot-${i}` },
|
|
417
|
+
React.createElement("line", { x1: n.minPos, y1: n.y, x2: n.maxPos, y2: n.y, stroke: n.style.stroke || "#333", strokeWidth: 1 }),
|
|
418
|
+
React.createElement("rect", { x: Math.min(n.q1Pos, n.q3Pos), y: n.y - halfW, width: Math.abs(n.q3Pos - n.q1Pos), height: n.columnWidth, fill: n.style.fill || "#4e79a7", fillOpacity: n.style.fillOpacity ?? 0.6, stroke: n.style.stroke || "#333", strokeWidth: 1 }),
|
|
419
|
+
React.createElement("line", { x1: n.medianPos, y1: n.y - halfW, x2: n.medianPos, y2: n.y + halfW, stroke: n.style.stroke || "#333", strokeWidth: 2 }),
|
|
420
|
+
React.createElement("line", { x1: n.minPos, y1: n.y - halfW * 0.5, x2: n.minPos, y2: n.y + halfW * 0.5, stroke: n.style.stroke || "#333", strokeWidth: 1 }),
|
|
421
|
+
React.createElement("line", { x1: n.maxPos, y1: n.y - halfW * 0.5, x2: n.maxPos, y2: n.y + halfW * 0.5, stroke: n.style.stroke || "#333", strokeWidth: 1 })));
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
case "violin": {
|
|
425
|
+
const n = node;
|
|
426
|
+
const elements = [
|
|
427
|
+
React.createElement("path", { key: `ord-violin-path-${i}`, d: n.pathString, transform: n.translateX || n.translateY ? `translate(${n.translateX},${n.translateY})` : undefined, fill: n.style.fill || "#4e79a7", fillOpacity: n.style.fillOpacity ?? 0.6, stroke: n.style.stroke || "#333", strokeWidth: n.style.strokeWidth || 1 })
|
|
428
|
+
];
|
|
429
|
+
if (n.iqrLine && n.bounds) {
|
|
430
|
+
const b = n.bounds;
|
|
431
|
+
const midX = b.x + b.width / 2;
|
|
432
|
+
const midY = b.y + b.height / 2;
|
|
433
|
+
const isVerticalViolin = b.height > b.width;
|
|
434
|
+
if (isVerticalViolin) {
|
|
435
|
+
elements.push(React.createElement("line", { key: `ord-violin-iqr-${i}`, x1: midX, y1: n.iqrLine.q1Pos, x2: midX, y2: n.iqrLine.q3Pos, stroke: n.style.stroke || "#333", strokeWidth: 2 }), React.createElement("circle", { key: `ord-violin-med-${i}`, cx: midX, cy: n.iqrLine.medianPos, r: 3, fill: "white", stroke: n.style.stroke || "#333", strokeWidth: 1 }));
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
elements.push(React.createElement("line", { key: `ord-violin-iqr-${i}`, x1: n.iqrLine.q1Pos, y1: midY, x2: n.iqrLine.q3Pos, y2: midY, stroke: n.style.stroke || "#333", strokeWidth: 2 }), React.createElement("circle", { key: `ord-violin-med-${i}`, cx: n.iqrLine.medianPos, cy: midY, r: 3, fill: "white", stroke: n.style.stroke || "#333", strokeWidth: 1 }));
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return React.createElement("g", { key: `ord-violin-${i}` }, elements);
|
|
442
|
+
}
|
|
443
|
+
case "connector": {
|
|
444
|
+
const n = node;
|
|
445
|
+
return (React.createElement("line", { key: `ord-conn-${i}`, x1: n.x1, y1: n.y1, x2: n.x2, y2: n.y2, stroke: n.style.stroke || "#999", strokeWidth: n.style.strokeWidth || 1, opacity: n.style.opacity ?? 0.5 }));
|
|
446
|
+
}
|
|
447
|
+
default:
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
function generateOrdinalAxesSVG(store, layout, props) {
|
|
452
|
+
const scales = store.scales;
|
|
453
|
+
if (!scales)
|
|
454
|
+
return null;
|
|
455
|
+
// Skip axes for radial projection (pie/donut)
|
|
456
|
+
if (scales.projection === "radial")
|
|
457
|
+
return null;
|
|
458
|
+
const isVertical = scales.projection === "vertical";
|
|
459
|
+
const columns = store.columns;
|
|
460
|
+
const categoryTicks = Object.values(columns).map(col => ({
|
|
461
|
+
pixel: col.middle,
|
|
462
|
+
label: (props.oFormat || String)(col.name)
|
|
463
|
+
}));
|
|
464
|
+
const rTicks = scales.r.ticks(5).map(v => ({
|
|
465
|
+
pixel: scales.r(v),
|
|
466
|
+
label: (props.rFormat || defaultTickFormat)(v)
|
|
467
|
+
}));
|
|
468
|
+
if (isVertical) {
|
|
469
|
+
// Vertical: categories on x-axis, values on y-axis
|
|
470
|
+
return (React.createElement("g", { className: "ordinal-axes" },
|
|
471
|
+
React.createElement("line", { x1: 0, y1: layout.height, x2: layout.width, y2: layout.height, stroke: "#ccc", strokeWidth: 1 }),
|
|
472
|
+
categoryTicks.map((tick, i) => (React.createElement("g", { key: `oxtick-${i}`, transform: `translate(${tick.pixel},${layout.height})` },
|
|
473
|
+
React.createElement("line", { y2: 5, stroke: "#ccc", strokeWidth: 1 }),
|
|
474
|
+
React.createElement("text", { y: 18, textAnchor: "middle", fontSize: 10, fill: "#666" }, tick.label)))),
|
|
475
|
+
props.oLabel && (React.createElement("text", { x: layout.width / 2, y: layout.height + 40, textAnchor: "middle", fontSize: 12, fill: "#333" }, props.oLabel)),
|
|
476
|
+
React.createElement("line", { x1: 0, y1: 0, x2: 0, y2: layout.height, stroke: "#ccc", strokeWidth: 1 }),
|
|
477
|
+
rTicks.map((tick, i) => (React.createElement("g", { key: `oytick-${i}`, transform: `translate(0,${tick.pixel})` },
|
|
478
|
+
React.createElement("line", { x2: -5, stroke: "#ccc", strokeWidth: 1 }),
|
|
479
|
+
React.createElement("text", { x: -8, textAnchor: "end", dominantBaseline: "middle", fontSize: 10, fill: "#666" }, tick.label)))),
|
|
480
|
+
props.rLabel && (React.createElement("text", { x: -(props.margin?.left ?? 40) + 15, y: layout.height / 2, textAnchor: "middle", fontSize: 12, fill: "#333", transform: `rotate(-90, ${-(props.margin?.left ?? 40) + 15}, ${layout.height / 2})` }, props.rLabel))));
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
// Horizontal: categories on y-axis, values on x-axis
|
|
484
|
+
return (React.createElement("g", { className: "ordinal-axes" },
|
|
485
|
+
React.createElement("line", { x1: 0, y1: layout.height, x2: layout.width, y2: layout.height, stroke: "#ccc", strokeWidth: 1 }),
|
|
486
|
+
rTicks.map((tick, i) => (React.createElement("g", { key: `oxtick-${i}`, transform: `translate(${tick.pixel},${layout.height})` },
|
|
487
|
+
React.createElement("line", { y2: 5, stroke: "#ccc", strokeWidth: 1 }),
|
|
488
|
+
React.createElement("text", { y: 18, textAnchor: "middle", fontSize: 10, fill: "#666" }, tick.label)))),
|
|
489
|
+
props.rLabel && (React.createElement("text", { x: layout.width / 2, y: layout.height + 40, textAnchor: "middle", fontSize: 12, fill: "#333" }, props.rLabel)),
|
|
490
|
+
React.createElement("line", { x1: 0, y1: 0, x2: 0, y2: layout.height, stroke: "#ccc", strokeWidth: 1 }),
|
|
491
|
+
categoryTicks.map((tick, i) => (React.createElement("g", { key: `oytick-${i}`, transform: `translate(0,${tick.pixel})` },
|
|
492
|
+
React.createElement("line", { x2: -5, stroke: "#ccc", strokeWidth: 1 }),
|
|
493
|
+
React.createElement("text", { x: -8, textAnchor: "end", dominantBaseline: "middle", fontSize: 10, fill: "#666" }, tick.label)))),
|
|
494
|
+
props.oLabel && (React.createElement("text", { x: -(props.margin?.left ?? 40) + 15, y: layout.height / 2, textAnchor: "middle", fontSize: 12, fill: "#333", transform: `rotate(-90, ${-(props.margin?.left ?? 40) + 15}, ${layout.height / 2})` }, props.oLabel))));
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
// ── StreamOrdinalFrame SSR ───────────────────────────────────────────
|
|
498
|
+
function renderOrdinalFrame(props) {
|
|
499
|
+
const defaultMargin = { top: 20, right: 20, bottom: 30, left: 40 };
|
|
500
|
+
const size = props.size || [500, 400];
|
|
501
|
+
const margin = { ...defaultMargin, ...props.margin };
|
|
502
|
+
const width = size[0] - margin.left - margin.right;
|
|
503
|
+
const height = size[1] - margin.top - margin.bottom;
|
|
504
|
+
const projection = props.projection || "vertical";
|
|
505
|
+
const isRadial = projection === "radial";
|
|
506
|
+
const pipelineConfig = {
|
|
507
|
+
chartType: props.chartType,
|
|
508
|
+
windowSize: props.windowSize ?? 10000,
|
|
509
|
+
windowMode: props.windowMode ?? "sliding",
|
|
510
|
+
extentPadding: props.extentPadding ?? 0.05,
|
|
511
|
+
projection,
|
|
512
|
+
oAccessor: props.oAccessor,
|
|
513
|
+
rAccessor: props.rAccessor,
|
|
514
|
+
colorAccessor: props.colorAccessor,
|
|
515
|
+
stackBy: props.stackBy,
|
|
516
|
+
groupBy: props.groupBy,
|
|
517
|
+
categoryAccessor: props.categoryAccessor,
|
|
518
|
+
valueAccessor: props.valueAccessor,
|
|
519
|
+
timeAccessor: props.timeAccessor,
|
|
520
|
+
rExtent: props.rExtent,
|
|
521
|
+
oExtent: props.oExtent,
|
|
522
|
+
barPadding: props.barPadding,
|
|
523
|
+
innerRadius: props.innerRadius,
|
|
524
|
+
normalize: props.normalize,
|
|
525
|
+
startAngle: props.startAngle,
|
|
526
|
+
bins: props.bins,
|
|
527
|
+
showOutliers: props.showOutliers,
|
|
528
|
+
showIQR: props.showIQR,
|
|
529
|
+
amplitude: props.amplitude,
|
|
530
|
+
oSort: props.oSort,
|
|
531
|
+
connectorAccessor: props.connectorAccessor,
|
|
532
|
+
connectorStyle: props.connectorStyle,
|
|
533
|
+
dynamicColumnWidth: props.dynamicColumnWidth,
|
|
534
|
+
pieceStyle: props.pieceStyle,
|
|
535
|
+
summaryStyle: props.summaryStyle,
|
|
536
|
+
colorScheme: props.colorScheme,
|
|
537
|
+
barColors: props.barColors
|
|
538
|
+
};
|
|
539
|
+
const store = new OrdinalPipelineStore_1.OrdinalPipelineStore(pipelineConfig);
|
|
540
|
+
// Ingest bounded data
|
|
541
|
+
if (props.data) {
|
|
542
|
+
store.ingest({ inserts: props.data, bounded: true });
|
|
543
|
+
}
|
|
544
|
+
// Compute scene graph
|
|
545
|
+
store.computeScene({ width, height });
|
|
546
|
+
if (!store.scales || store.scene.length === 0) {
|
|
547
|
+
return ReactDOMServer.renderToStaticMarkup(React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: "stream-ordinal-frame", width: size[0], height: size[1] }));
|
|
548
|
+
}
|
|
549
|
+
// Convert scene nodes to SVG
|
|
550
|
+
const dataMarks = store.scene
|
|
551
|
+
.map((node, i) => ordinalSceneNodeToSVG(node, i))
|
|
552
|
+
.filter(Boolean);
|
|
553
|
+
// Generate axes
|
|
554
|
+
const showAxes = props.showAxes !== false;
|
|
555
|
+
const axes = showAxes
|
|
556
|
+
? generateOrdinalAxesSVG(store, { width, height }, props)
|
|
557
|
+
: null;
|
|
558
|
+
// Title
|
|
559
|
+
const title = props.title && typeof props.title === "string" ? (React.createElement("text", { x: size[0] / 2, y: 16, textAnchor: "middle", fontSize: 14, fontWeight: "bold", fill: "#333" }, props.title)) : null;
|
|
560
|
+
// Background
|
|
561
|
+
const bg = props.background ? (React.createElement("rect", { x: 0, y: 0, width: width, height: height, fill: props.background })) : null;
|
|
562
|
+
// For radial projection, translate to center
|
|
563
|
+
const translateX = isRadial ? margin.left + width / 2 : margin.left;
|
|
564
|
+
const translateY = isRadial ? margin.top + height / 2 : margin.top;
|
|
565
|
+
const svgElement = (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: `stream-ordinal-frame${props.className ? ` ${props.className}` : ""}`, width: size[0], height: size[1] },
|
|
566
|
+
React.createElement("g", { transform: `translate(${translateX},${translateY})` },
|
|
567
|
+
bg,
|
|
568
|
+
dataMarks,
|
|
569
|
+
axes),
|
|
570
|
+
title));
|
|
571
|
+
return ReactDOMServer.renderToStaticMarkup(svgElement);
|
|
572
|
+
}
|
|
573
|
+
// ── Public API ────────────────────────────────────────────────────────────
|
|
574
|
+
function renderToStaticSVG(frameType, props) {
|
|
575
|
+
switch (frameType) {
|
|
576
|
+
case "xy":
|
|
577
|
+
return renderStreamXYFrame(props);
|
|
578
|
+
case "ordinal":
|
|
579
|
+
return renderOrdinalFrame(props);
|
|
580
|
+
case "network":
|
|
581
|
+
return renderNetworkFrame(props);
|
|
582
|
+
default:
|
|
583
|
+
throw new Error(`Unknown frame type: ${frameType}. Must be "xy", "ordinal", or "network".`);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
function renderXYToStaticSVG(props) {
|
|
587
|
+
return renderStreamXYFrame(props);
|
|
588
|
+
}
|
|
589
|
+
function renderOrdinalToStaticSVG(props) {
|
|
590
|
+
return renderOrdinalFrame(props);
|
|
591
|
+
}
|
|
592
|
+
function renderNetworkToStaticSVG(props) {
|
|
593
|
+
return renderNetworkFrame(props);
|
|
594
|
+
}
|