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,487 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateDataExtent = void 0;
|
|
4
|
+
exports.stringToFn = stringToFn;
|
|
5
|
+
exports.stringToArrayFn = stringToArrayFn;
|
|
6
|
+
const lineDrawing_1 = require("../geometry/lineDrawing");
|
|
7
|
+
const coordinateNames_1 = require("../constants/coordinateNames");
|
|
8
|
+
const lineDrawing_2 = require("../geometry/lineDrawing");
|
|
9
|
+
const areaDrawing_1 = require("../geometry/areaDrawing");
|
|
10
|
+
const unflowedFunctions_1 = require("./unflowedFunctions");
|
|
11
|
+
const baseDefinedFunction = () => true;
|
|
12
|
+
const whichPointsHashY = {
|
|
13
|
+
top: coordinateNames_1.projectedYTop,
|
|
14
|
+
bottom: coordinateNames_1.projectedYBottom,
|
|
15
|
+
orphan: coordinateNames_1.projectedY
|
|
16
|
+
};
|
|
17
|
+
const whichPointsHashX = {
|
|
18
|
+
top: coordinateNames_1.projectedXTop,
|
|
19
|
+
bottom: coordinateNames_1.projectedXBottom,
|
|
20
|
+
orphan: coordinateNames_1.projectedX
|
|
21
|
+
};
|
|
22
|
+
const builtInTransformations = {
|
|
23
|
+
stackedarea: lineDrawing_2.stackedArea,
|
|
24
|
+
"stackedarea-invert": lineDrawing_2.stackedArea,
|
|
25
|
+
stackedpercent: lineDrawing_2.stackedArea,
|
|
26
|
+
"stackedpercent-invert": lineDrawing_2.stackedArea,
|
|
27
|
+
linepercent: lineDrawing_2.stackedArea,
|
|
28
|
+
difference: lineDrawing_2.differenceLine,
|
|
29
|
+
bumparea: lineDrawing_2.bumpChart,
|
|
30
|
+
bumpline: lineDrawing_2.bumpChart,
|
|
31
|
+
"bumparea-invert": lineDrawing_2.bumpChart,
|
|
32
|
+
line: lineDrawing_2.lineChart,
|
|
33
|
+
area: lineDrawing_2.lineChart,
|
|
34
|
+
cumulative: lineDrawing_2.cumulativeLine,
|
|
35
|
+
"cumulative-reverse": lineDrawing_2.cumulativeLine
|
|
36
|
+
};
|
|
37
|
+
function stringToFn(accessor, defaultAccessor, raw) {
|
|
38
|
+
if (!accessor && defaultAccessor) {
|
|
39
|
+
return defaultAccessor;
|
|
40
|
+
}
|
|
41
|
+
else if (typeof accessor === "object") {
|
|
42
|
+
return () => accessor;
|
|
43
|
+
}
|
|
44
|
+
else if (accessor instanceof Function) {
|
|
45
|
+
return accessor;
|
|
46
|
+
}
|
|
47
|
+
else if (raw === true) {
|
|
48
|
+
const castAccessor = accessor;
|
|
49
|
+
return () => castAccessor;
|
|
50
|
+
}
|
|
51
|
+
else if (typeof accessor === "string") {
|
|
52
|
+
return (d) => (d ? d[accessor] : undefined);
|
|
53
|
+
}
|
|
54
|
+
return () => undefined;
|
|
55
|
+
}
|
|
56
|
+
function stringToArrayFn(accessor, defaultAccessor, raw) {
|
|
57
|
+
if (accessor === undefined) {
|
|
58
|
+
return [stringToFn(undefined, defaultAccessor, raw)];
|
|
59
|
+
}
|
|
60
|
+
let arrayOfAccessors = [];
|
|
61
|
+
if (Array.isArray(accessor)) {
|
|
62
|
+
arrayOfAccessors = accessor;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
arrayOfAccessors = [accessor];
|
|
66
|
+
}
|
|
67
|
+
return arrayOfAccessors.map((a) => stringToFn(a, defaultAccessor, raw));
|
|
68
|
+
}
|
|
69
|
+
function rebuildFullDatasetWithSummaries(fullDataset, projectedSummaries) {
|
|
70
|
+
const rebuilt = [];
|
|
71
|
+
for (const d of projectedSummaries) {
|
|
72
|
+
rebuilt.push({ ...d });
|
|
73
|
+
}
|
|
74
|
+
for (const d of fullDataset) {
|
|
75
|
+
if (!d.parentSummary) {
|
|
76
|
+
rebuilt.push(d);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return rebuilt;
|
|
80
|
+
}
|
|
81
|
+
const calculateDataExtent = ({ lineDataAccessor, xAccessor, yAccessor, summaries, points, lines, lineType, showLinePoints, showSummaryPoints, xExtent, yExtent, invertX, invertY, summaryDataAccessor, summaryType, adjustedSize: size, margin, summaryStyleFn, summaryClassFn, summaryRenderModeFn, chartSize, filterRenderedLines, filterRenderedSummaries, filterRenderedPoints, defined = baseDefinedFunction, annotations = [] }) => {
|
|
82
|
+
let fullDataset = [];
|
|
83
|
+
let initialProjectedLines = [];
|
|
84
|
+
let projectedPoints = [], projectedLines = [], projectedSummaries = [];
|
|
85
|
+
if (points) {
|
|
86
|
+
xAccessor.forEach((actualXAccessor, xIndex) => {
|
|
87
|
+
yAccessor.forEach((actualYAccessor, yIndex) => {
|
|
88
|
+
let i = 0;
|
|
89
|
+
for (const d of points) {
|
|
90
|
+
const x = actualXAccessor(d, i);
|
|
91
|
+
const y = actualYAccessor(d, i);
|
|
92
|
+
const projectedPoint = { x, y, data: d, xIndex, yIndex };
|
|
93
|
+
if (Array.isArray(y)) {
|
|
94
|
+
projectedPoint[coordinateNames_1.projectedYBottom] = Math.min(...y);
|
|
95
|
+
projectedPoint[coordinateNames_1.projectedYTop] = Math.max(...y);
|
|
96
|
+
projectedPoint[coordinateNames_1.projectedYMiddle] =
|
|
97
|
+
(projectedPoint[coordinateNames_1.projectedYBottom] +
|
|
98
|
+
projectedPoint[coordinateNames_1.projectedYTop]) /
|
|
99
|
+
2;
|
|
100
|
+
}
|
|
101
|
+
if (Array.isArray(x)) {
|
|
102
|
+
projectedPoint[coordinateNames_1.projectedXBottom] = Math.min(...x);
|
|
103
|
+
projectedPoint[coordinateNames_1.projectedXTop] = Math.max(...x);
|
|
104
|
+
projectedPoint[coordinateNames_1.projectedXMiddle] =
|
|
105
|
+
(projectedPoint[coordinateNames_1.projectedXBottom] +
|
|
106
|
+
projectedPoint[coordinateNames_1.projectedXTop]) /
|
|
107
|
+
2;
|
|
108
|
+
}
|
|
109
|
+
projectedPoints.push(projectedPoint);
|
|
110
|
+
i++;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
for (const d of projectedPoints) {
|
|
115
|
+
fullDataset.push({
|
|
116
|
+
...d,
|
|
117
|
+
[coordinateNames_1.projectedX]: d[coordinateNames_1.projectedXTop] || d[coordinateNames_1.projectedXBottom] || d.x,
|
|
118
|
+
[coordinateNames_1.projectedY]: d[coordinateNames_1.projectedYTop] || d[coordinateNames_1.projectedYBottom] || d.y
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (lines) {
|
|
123
|
+
initialProjectedLines = (0, lineDrawing_1.projectLineData)({
|
|
124
|
+
data: lines,
|
|
125
|
+
lineDataAccessor,
|
|
126
|
+
xProp: coordinateNames_1.projectedX,
|
|
127
|
+
xPropTop: coordinateNames_1.projectedXTop,
|
|
128
|
+
xPropBottom: coordinateNames_1.projectedXBottom,
|
|
129
|
+
yProp: coordinateNames_1.projectedY,
|
|
130
|
+
yPropTop: coordinateNames_1.projectedYTop,
|
|
131
|
+
yPropBottom: coordinateNames_1.projectedYBottom,
|
|
132
|
+
xAccessor,
|
|
133
|
+
yAccessor
|
|
134
|
+
});
|
|
135
|
+
const optionsObject = {
|
|
136
|
+
xProp: coordinateNames_1.projectedX,
|
|
137
|
+
yProp: coordinateNames_1.projectedY,
|
|
138
|
+
yPropMiddle: coordinateNames_1.projectedYMiddle,
|
|
139
|
+
yPropTop: coordinateNames_1.projectedYTop,
|
|
140
|
+
yPropBottom: coordinateNames_1.projectedYBottom,
|
|
141
|
+
xPropMiddle: coordinateNames_1.projectedXMiddle,
|
|
142
|
+
xPropTop: coordinateNames_1.projectedXTop,
|
|
143
|
+
xPropBottom: coordinateNames_1.projectedXBottom
|
|
144
|
+
};
|
|
145
|
+
projectedLines = lineTransformation(lineType, optionsObject)(initialProjectedLines);
|
|
146
|
+
for (const d of projectedLines) {
|
|
147
|
+
for (let q = 0; q < d.data.length; q++) {
|
|
148
|
+
const p = d.data[q];
|
|
149
|
+
if (!defined(Object.assign({}, p.data, p), q))
|
|
150
|
+
continue;
|
|
151
|
+
const mappedP = {
|
|
152
|
+
parentLine: d,
|
|
153
|
+
y: p.y,
|
|
154
|
+
x: p.x,
|
|
155
|
+
xTop: p.xTop,
|
|
156
|
+
xMiddle: p.xMiddle,
|
|
157
|
+
xBottom: p.xBottom,
|
|
158
|
+
yTop: p.yTop,
|
|
159
|
+
yMiddle: p.yMiddle,
|
|
160
|
+
yBottom: p.yBottom,
|
|
161
|
+
data: p.data
|
|
162
|
+
};
|
|
163
|
+
if (p.percent) {
|
|
164
|
+
mappedP.percent = p.percent;
|
|
165
|
+
}
|
|
166
|
+
fullDataset.push(mappedP);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (showLinePoints) {
|
|
170
|
+
const whichPointsX = showLinePoints === true
|
|
171
|
+
? coordinateNames_1.projectedXMiddle
|
|
172
|
+
: whichPointsHashX[showLinePoints];
|
|
173
|
+
const whichPointsY = showLinePoints === true
|
|
174
|
+
? coordinateNames_1.projectedYMiddle
|
|
175
|
+
: whichPointsHashY[showLinePoints];
|
|
176
|
+
projectedLines.forEach((d) => {
|
|
177
|
+
d.data
|
|
178
|
+
.filter((p, q) => {
|
|
179
|
+
const isDefined = defined(Object.assign({}, p.data, p));
|
|
180
|
+
if (isDefined) {
|
|
181
|
+
if (showLinePoints === "orphan") {
|
|
182
|
+
const prePoint = d.data[q - 1];
|
|
183
|
+
const postPoint = d.data[q + 1];
|
|
184
|
+
if ((!prePoint ||
|
|
185
|
+
!defined(Object.assign({}, prePoint.data, prePoint))) &&
|
|
186
|
+
(!postPoint ||
|
|
187
|
+
!defined(Object.assign({}, postPoint.data, postPoint)))) {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
.forEach((p) => {
|
|
203
|
+
projectedPoints.push({
|
|
204
|
+
...p,
|
|
205
|
+
parentLine: d,
|
|
206
|
+
[coordinateNames_1.projectedY]: p[whichPointsY] !== undefined
|
|
207
|
+
? p[whichPointsY]
|
|
208
|
+
: p[coordinateNames_1.projectedYMiddle] !== undefined
|
|
209
|
+
? p[coordinateNames_1.projectedYMiddle]
|
|
210
|
+
: p[coordinateNames_1.projectedYBottom] !== undefined
|
|
211
|
+
? p[coordinateNames_1.projectedYBottom]
|
|
212
|
+
: p.y,
|
|
213
|
+
[coordinateNames_1.projectedX]: p[whichPointsX] !== undefined
|
|
214
|
+
? p[whichPointsX]
|
|
215
|
+
: p[coordinateNames_1.projectedXMiddle] !== undefined
|
|
216
|
+
? p[coordinateNames_1.projectedXMiddle]
|
|
217
|
+
: p[coordinateNames_1.projectedXBottom] !== undefined
|
|
218
|
+
? p[coordinateNames_1.projectedXBottom]
|
|
219
|
+
: p.y
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (summaries) {
|
|
226
|
+
projectedSummaries = (0, lineDrawing_1.projectSummaryData)({
|
|
227
|
+
data: summaries,
|
|
228
|
+
summaryDataAccessor,
|
|
229
|
+
xAccessor,
|
|
230
|
+
yAccessor
|
|
231
|
+
});
|
|
232
|
+
projectedSummaries.forEach((d) => {
|
|
233
|
+
const baseData = d._baseData;
|
|
234
|
+
if (d._xyfCoordinates.length > 0 && d._xyfCoordinates[0][0][0]) {
|
|
235
|
+
d._xyfCoordinates[0].forEach((multi) => {
|
|
236
|
+
if (Array.isArray(multi)) {
|
|
237
|
+
multi
|
|
238
|
+
.map((p, q) => Object.assign({ parentSummary: d }, baseData[q], {
|
|
239
|
+
[coordinateNames_1.projectedX]: p[0],
|
|
240
|
+
[coordinateNames_1.projectedY]: p[1]
|
|
241
|
+
}))
|
|
242
|
+
.forEach((e) => {
|
|
243
|
+
if (showSummaryPoints) {
|
|
244
|
+
projectedPoints.push({
|
|
245
|
+
x: 0,
|
|
246
|
+
...e,
|
|
247
|
+
[coordinateNames_1.projectedY]: e[coordinateNames_1.projectedYTop] || e[coordinateNames_1.projectedYBottom] || e[coordinateNames_1.projectedY]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
fullDataset.push({ x: 0, y: 0, ...e });
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
else if (d._xyfCoordinates.length > 0) {
|
|
256
|
+
if (Array.isArray(d._xyfCoordinates)) {
|
|
257
|
+
const coordArray = d._xyfCoordinates;
|
|
258
|
+
coordArray
|
|
259
|
+
.map((p, q) => ({
|
|
260
|
+
parentSummary: d,
|
|
261
|
+
...baseData[q],
|
|
262
|
+
[coordinateNames_1.projectedX]: p[0],
|
|
263
|
+
[coordinateNames_1.projectedY]: p[1]
|
|
264
|
+
}))
|
|
265
|
+
.forEach((e) => {
|
|
266
|
+
if (showSummaryPoints) {
|
|
267
|
+
projectedPoints.push({
|
|
268
|
+
x: 0,
|
|
269
|
+
...e,
|
|
270
|
+
[coordinateNames_1.projectedY]: e[coordinateNames_1.projectedYTop] || e[coordinateNames_1.projectedYBottom] || e[coordinateNames_1.projectedY]
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
fullDataset.push({ x: 0, y: 0, ...e });
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
let suitableXAnnotations = [];
|
|
280
|
+
let suitableYAnnotations = [];
|
|
281
|
+
if (xExtent &&
|
|
282
|
+
!Array.isArray(xExtent) &&
|
|
283
|
+
xExtent.includeAnnotations === true) {
|
|
284
|
+
xAccessor.forEach((actualXAccessor) => {
|
|
285
|
+
annotations.forEach((annotation, annotationIndex) => {
|
|
286
|
+
const x = actualXAccessor(annotation, annotationIndex);
|
|
287
|
+
if (isFinite(x)) {
|
|
288
|
+
suitableXAnnotations.push({
|
|
289
|
+
[coordinateNames_1.projectedX]: x
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
if (yExtent &&
|
|
296
|
+
!Array.isArray(yExtent) &&
|
|
297
|
+
yExtent.includeAnnotations === true) {
|
|
298
|
+
yAccessor.forEach((actualYAccessor) => {
|
|
299
|
+
annotations.forEach((annotation, annotationIndex) => {
|
|
300
|
+
const y = actualYAccessor(annotation, annotationIndex);
|
|
301
|
+
if (isFinite(y)) {
|
|
302
|
+
suitableYAnnotations.push({
|
|
303
|
+
[coordinateNames_1.projectedY]: y
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
// Single-pass extent calculation over fullDataset + annotations
|
|
310
|
+
let xMinVal;
|
|
311
|
+
let xMaxVal;
|
|
312
|
+
let yMinVal;
|
|
313
|
+
let yMaxVal;
|
|
314
|
+
for (const d of fullDataset) {
|
|
315
|
+
const xLo = d[coordinateNames_1.projectedXBottom] === undefined
|
|
316
|
+
? d[coordinateNames_1.projectedX]
|
|
317
|
+
: Math.min(d[coordinateNames_1.projectedXTop], d[coordinateNames_1.projectedXBottom]);
|
|
318
|
+
const xHi = d[coordinateNames_1.projectedXTop] === undefined
|
|
319
|
+
? d[coordinateNames_1.projectedX]
|
|
320
|
+
: Math.max(d[coordinateNames_1.projectedXBottom], d[coordinateNames_1.projectedXTop]);
|
|
321
|
+
const yLo = d[coordinateNames_1.projectedYBottom] === undefined
|
|
322
|
+
? d[coordinateNames_1.projectedY]
|
|
323
|
+
: Math.min(d[coordinateNames_1.projectedYTop], d[coordinateNames_1.projectedYBottom]);
|
|
324
|
+
const yHi = d[coordinateNames_1.projectedYTop] === undefined
|
|
325
|
+
? d[coordinateNames_1.projectedY]
|
|
326
|
+
: Math.max(d[coordinateNames_1.projectedYBottom], d[coordinateNames_1.projectedYTop]);
|
|
327
|
+
if (xLo !== undefined && (xMinVal === undefined || xLo < xMinVal))
|
|
328
|
+
xMinVal = xLo;
|
|
329
|
+
if (xHi !== undefined && (xMaxVal === undefined || xHi > xMaxVal))
|
|
330
|
+
xMaxVal = xHi;
|
|
331
|
+
if (yLo !== undefined && (yMinVal === undefined || yLo < yMinVal))
|
|
332
|
+
yMinVal = yLo;
|
|
333
|
+
if (yHi !== undefined && (yMaxVal === undefined || yHi > yMaxVal))
|
|
334
|
+
yMaxVal = yHi;
|
|
335
|
+
}
|
|
336
|
+
for (const d of suitableXAnnotations) {
|
|
337
|
+
const v = d[coordinateNames_1.projectedX];
|
|
338
|
+
if (v !== undefined && (xMinVal === undefined || v < xMinVal))
|
|
339
|
+
xMinVal = v;
|
|
340
|
+
if (v !== undefined && (xMaxVal === undefined || v > xMaxVal))
|
|
341
|
+
xMaxVal = v;
|
|
342
|
+
}
|
|
343
|
+
for (const d of suitableYAnnotations) {
|
|
344
|
+
const v = d[coordinateNames_1.projectedY];
|
|
345
|
+
if (v !== undefined && (yMinVal === undefined || v < yMinVal))
|
|
346
|
+
yMinVal = v;
|
|
347
|
+
if (v !== undefined && (yMaxVal === undefined || v > yMaxVal))
|
|
348
|
+
yMaxVal = v;
|
|
349
|
+
}
|
|
350
|
+
const calculatedXExtent = [xMinVal, xMaxVal];
|
|
351
|
+
const calculatedYExtent = [yMinVal, yMaxVal];
|
|
352
|
+
const actualXExtent = (0, unflowedFunctions_1.extentValue)(xExtent);
|
|
353
|
+
const actualYExtent = (0, unflowedFunctions_1.extentValue)(yExtent);
|
|
354
|
+
const xMin = actualXExtent && actualXExtent[0] !== undefined
|
|
355
|
+
? actualXExtent[0]
|
|
356
|
+
: calculatedXExtent[0];
|
|
357
|
+
const xMax = actualXExtent && actualXExtent[1] !== undefined
|
|
358
|
+
? actualXExtent[1]
|
|
359
|
+
: calculatedXExtent[1];
|
|
360
|
+
const yMin = actualYExtent && actualYExtent[0] !== undefined
|
|
361
|
+
? actualYExtent[0]
|
|
362
|
+
: calculatedYExtent[0];
|
|
363
|
+
const yMax = actualYExtent && actualYExtent[1] !== undefined
|
|
364
|
+
? actualYExtent[1]
|
|
365
|
+
: calculatedYExtent[1];
|
|
366
|
+
let finalYExtent = [yMin, yMax];
|
|
367
|
+
let finalXExtent = [xMin, xMax];
|
|
368
|
+
if (invertX && !(actualXExtent && actualXExtent.length === 2)) {
|
|
369
|
+
finalXExtent = [finalXExtent[1], finalXExtent[0]];
|
|
370
|
+
}
|
|
371
|
+
if ((lineType.type === "bumpline" || invertY) &&
|
|
372
|
+
!(actualYExtent && actualYExtent.length === 2)) {
|
|
373
|
+
finalYExtent = [finalYExtent[1], finalYExtent[0]];
|
|
374
|
+
}
|
|
375
|
+
if (summaryType.type && summaryType.type === "contour") {
|
|
376
|
+
projectedSummaries = (0, areaDrawing_1.contouring)({
|
|
377
|
+
summaryType,
|
|
378
|
+
data: projectedSummaries,
|
|
379
|
+
finalXExtent,
|
|
380
|
+
finalYExtent
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
else if (summaryType.type && summaryType.type === "linebounds") {
|
|
384
|
+
projectedSummaries = (0, areaDrawing_1.lineBounding)({
|
|
385
|
+
summaryType,
|
|
386
|
+
data: projectedSummaries,
|
|
387
|
+
defined
|
|
388
|
+
});
|
|
389
|
+
// Expand y extent to include the bounds so they aren't clipped
|
|
390
|
+
if (!(actualYExtent && actualYExtent.length === 2)) {
|
|
391
|
+
for (const summary of projectedSummaries) {
|
|
392
|
+
for (const coord of summary._xyfCoordinates) {
|
|
393
|
+
const yVal = coord[1];
|
|
394
|
+
if (yVal !== undefined && isFinite(yVal)) {
|
|
395
|
+
if (yVal < finalYExtent[0])
|
|
396
|
+
finalYExtent[0] = yVal;
|
|
397
|
+
if (yVal > finalYExtent[1])
|
|
398
|
+
finalYExtent[1] = yVal;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
else if (summaryType.type && summaryType.type === "hexbin") {
|
|
405
|
+
projectedSummaries = (0, areaDrawing_1.hexbinning)({
|
|
406
|
+
summaryType,
|
|
407
|
+
data: projectedSummaries[0],
|
|
408
|
+
processedData: summaries && !!summaries[0].processedData,
|
|
409
|
+
preprocess: false,
|
|
410
|
+
finalXExtent,
|
|
411
|
+
finalYExtent,
|
|
412
|
+
size,
|
|
413
|
+
margin,
|
|
414
|
+
styleFn: summaryStyleFn,
|
|
415
|
+
classFn: summaryClassFn,
|
|
416
|
+
renderFn: summaryRenderModeFn,
|
|
417
|
+
chartSize
|
|
418
|
+
});
|
|
419
|
+
fullDataset = rebuildFullDatasetWithSummaries(fullDataset, projectedSummaries);
|
|
420
|
+
}
|
|
421
|
+
else if (summaryType.type && summaryType.type === "heatmap") {
|
|
422
|
+
projectedSummaries = (0, areaDrawing_1.heatmapping)({
|
|
423
|
+
summaryType,
|
|
424
|
+
data: projectedSummaries[0],
|
|
425
|
+
processedData: summaries && !!summaries[0].processedData,
|
|
426
|
+
preprocess: false,
|
|
427
|
+
finalXExtent,
|
|
428
|
+
finalYExtent,
|
|
429
|
+
size,
|
|
430
|
+
margin,
|
|
431
|
+
styleFn: summaryStyleFn,
|
|
432
|
+
classFn: summaryClassFn,
|
|
433
|
+
renderFn: summaryRenderModeFn,
|
|
434
|
+
chartSize
|
|
435
|
+
});
|
|
436
|
+
fullDataset = rebuildFullDatasetWithSummaries(fullDataset, projectedSummaries);
|
|
437
|
+
}
|
|
438
|
+
else if (summaryType.type && summaryType.type === "trendline") {
|
|
439
|
+
projectedSummaries = (0, areaDrawing_1.trendlining)({
|
|
440
|
+
summaryType,
|
|
441
|
+
data: projectedSummaries[0],
|
|
442
|
+
preprocess: summaries && !!summaries[0].processedData,
|
|
443
|
+
finalXExtent
|
|
444
|
+
});
|
|
445
|
+
fullDataset = rebuildFullDatasetWithSummaries(fullDataset, projectedSummaries);
|
|
446
|
+
}
|
|
447
|
+
if (filterRenderedLines) {
|
|
448
|
+
projectedLines = projectedLines.filter(filterRenderedLines);
|
|
449
|
+
fullDataset = fullDataset.filter((d, i) => {
|
|
450
|
+
return !d.parentLine || filterRenderedLines(d.parentLine, i, []);
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
if (filterRenderedPoints) {
|
|
454
|
+
fullDataset = fullDataset.filter(filterRenderedPoints);
|
|
455
|
+
}
|
|
456
|
+
if (filterRenderedSummaries) {
|
|
457
|
+
projectedSummaries = projectedSummaries.filter(filterRenderedSummaries);
|
|
458
|
+
fullDataset = fullDataset.filter((d, i) => {
|
|
459
|
+
return !d.parentSummary || filterRenderedSummaries(d.parentSummary, i, []);
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
return {
|
|
463
|
+
xExtent: finalXExtent,
|
|
464
|
+
yExtent: finalYExtent,
|
|
465
|
+
projectedLines,
|
|
466
|
+
projectedPoints,
|
|
467
|
+
projectedSummaries,
|
|
468
|
+
fullDataset,
|
|
469
|
+
calculatedXExtent,
|
|
470
|
+
calculatedYExtent
|
|
471
|
+
};
|
|
472
|
+
};
|
|
473
|
+
exports.calculateDataExtent = calculateDataExtent;
|
|
474
|
+
const differenceCatch = (olineType, data) => {
|
|
475
|
+
if (!builtInTransformations[olineType] ||
|
|
476
|
+
(olineType === "difference" && data.length !== 2)) {
|
|
477
|
+
return "line";
|
|
478
|
+
}
|
|
479
|
+
return olineType;
|
|
480
|
+
};
|
|
481
|
+
function lineTransformation(lineType, options) {
|
|
482
|
+
return (data) => builtInTransformations[differenceCatch(lineType.type, data)]({
|
|
483
|
+
...lineType,
|
|
484
|
+
...options,
|
|
485
|
+
data
|
|
486
|
+
});
|
|
487
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findFirstAccessorValue = void 0;
|
|
4
|
+
const findFirstAccessorValue = (accessorArray, data) => {
|
|
5
|
+
for (let i = 0; i < accessorArray.length; i++) {
|
|
6
|
+
const valueCheck = accessorArray[i](data);
|
|
7
|
+
if (valueCheck !== undefined &&
|
|
8
|
+
!Number.isNaN(valueCheck) &&
|
|
9
|
+
valueCheck !== null)
|
|
10
|
+
return valueCheck;
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
};
|
|
14
|
+
exports.findFirstAccessorValue = findFirstAccessorValue;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Data transform helpers for common data shapes.
|
|
4
|
+
* Import from "semiotic/data"
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.bin = bin;
|
|
8
|
+
exports.rollup = rollup;
|
|
9
|
+
exports.groupBy = groupBy;
|
|
10
|
+
exports.pivot = pivot;
|
|
11
|
+
/**
|
|
12
|
+
* Bin continuous data into histogram-ready format.
|
|
13
|
+
* Returns array of { category, value } objects suitable for BarChart.
|
|
14
|
+
*/
|
|
15
|
+
function bin(data, options) {
|
|
16
|
+
const { field, bins = 10 } = options;
|
|
17
|
+
const values = data.map((d) => Number(d[field])).filter((v) => !isNaN(v));
|
|
18
|
+
if (values.length === 0)
|
|
19
|
+
return [];
|
|
20
|
+
const min = options.domain ? options.domain[0] : Math.min(...values);
|
|
21
|
+
const max = options.domain ? options.domain[1] : Math.max(...values);
|
|
22
|
+
if (min === max) {
|
|
23
|
+
return [{ category: `${min}-${max}`, value: values.length }];
|
|
24
|
+
}
|
|
25
|
+
const binWidth = (max - min) / bins;
|
|
26
|
+
const counts = new Array(bins).fill(0);
|
|
27
|
+
for (const v of values) {
|
|
28
|
+
let idx = Math.floor((v - min) / binWidth);
|
|
29
|
+
if (idx === bins)
|
|
30
|
+
idx = bins - 1;
|
|
31
|
+
if (idx >= 0 && idx < bins) {
|
|
32
|
+
counts[idx]++;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return counts.map((count, i) => {
|
|
36
|
+
const lo = min + i * binWidth;
|
|
37
|
+
const hi = lo + binWidth;
|
|
38
|
+
return {
|
|
39
|
+
category: `${formatNum(lo)}-${formatNum(hi)}`,
|
|
40
|
+
value: count
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Group and aggregate data.
|
|
46
|
+
* Returns array of { [groupBy]: string, value: number } objects.
|
|
47
|
+
*/
|
|
48
|
+
function rollup(data, options) {
|
|
49
|
+
const { groupBy: groupField, value: valueField, agg = "sum" } = options;
|
|
50
|
+
const groups = new Map();
|
|
51
|
+
for (const d of data) {
|
|
52
|
+
const key = String(d[groupField]);
|
|
53
|
+
if (!groups.has(key)) {
|
|
54
|
+
groups.set(key, []);
|
|
55
|
+
}
|
|
56
|
+
groups.get(key).push(Number(d[valueField]));
|
|
57
|
+
}
|
|
58
|
+
const result = [];
|
|
59
|
+
for (const [key, vals] of groups) {
|
|
60
|
+
let aggregated;
|
|
61
|
+
switch (agg) {
|
|
62
|
+
case "count":
|
|
63
|
+
aggregated = vals.length;
|
|
64
|
+
break;
|
|
65
|
+
case "mean":
|
|
66
|
+
aggregated = vals.reduce((a, b) => a + b, 0) / vals.length;
|
|
67
|
+
break;
|
|
68
|
+
case "min":
|
|
69
|
+
aggregated = Math.min(...vals);
|
|
70
|
+
break;
|
|
71
|
+
case "max":
|
|
72
|
+
aggregated = Math.max(...vals);
|
|
73
|
+
break;
|
|
74
|
+
case "sum":
|
|
75
|
+
default:
|
|
76
|
+
aggregated = vals.reduce((a, b) => a + b, 0);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
result.push({ [groupField]: key, value: aggregated });
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Group flat rows into line-chart-ready nested format.
|
|
85
|
+
* Returns array of { id, coordinates } objects for LineChart with lineBy.
|
|
86
|
+
*/
|
|
87
|
+
function groupBy(data, options) {
|
|
88
|
+
const { key, fields } = options;
|
|
89
|
+
const groups = new Map();
|
|
90
|
+
for (const d of data) {
|
|
91
|
+
const groupKey = String(d[key]);
|
|
92
|
+
if (!groups.has(groupKey)) {
|
|
93
|
+
groups.set(groupKey, []);
|
|
94
|
+
}
|
|
95
|
+
if (fields) {
|
|
96
|
+
const filtered = {};
|
|
97
|
+
for (const f of fields) {
|
|
98
|
+
if (f in d) {
|
|
99
|
+
filtered[f] = d[f];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
groups.get(groupKey).push(filtered);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
groups.get(groupKey).push({ ...d });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const result = [];
|
|
109
|
+
for (const [id, coordinates] of groups) {
|
|
110
|
+
result.push({ id, coordinates });
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Pivot wide data to long format.
|
|
116
|
+
* Converts column-per-variable to row-per-variable.
|
|
117
|
+
*/
|
|
118
|
+
function pivot(data, options) {
|
|
119
|
+
const { columns, nameField = "name", valueField = "value" } = options;
|
|
120
|
+
const columnsSet = new Set(columns);
|
|
121
|
+
const result = [];
|
|
122
|
+
for (const row of data) {
|
|
123
|
+
const base = {};
|
|
124
|
+
for (const k of Object.keys(row)) {
|
|
125
|
+
if (!columnsSet.has(k)) {
|
|
126
|
+
base[k] = row[k];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
for (const col of columns) {
|
|
130
|
+
result.push({
|
|
131
|
+
...base,
|
|
132
|
+
[nameField]: col,
|
|
133
|
+
[valueField]: row[col]
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
/** Round to avoid long floating-point strings in bin labels. */
|
|
140
|
+
function formatNum(n) {
|
|
141
|
+
const rounded = Math.round(n * 1000) / 1000;
|
|
142
|
+
return String(rounded);
|
|
143
|
+
}
|