semiotic 2.0.2 → 3.0.0-beta.1
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 +530 -0
- package/README.md +190 -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 +373 -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/DividedLine.js +65 -0
- package/ai/dist/src/components/FacetController.js +259 -0
- package/ai/dist/src/components/Frame.js +139 -0
- package/ai/dist/src/components/InteractionLayer.js +328 -0
- package/ai/dist/src/components/Legend.js +140 -0
- package/ai/dist/src/components/MiniMap.js +75 -0
- package/ai/dist/src/components/MinimapXYFrame.js +99 -0
- package/ai/dist/src/components/NetworkFrame.js +335 -0
- package/ai/dist/src/components/OrdinalFrame.js +437 -0
- package/ai/dist/src/components/ResponsiveFrame.js +68 -0
- package/ai/dist/src/components/ResponsiveMinimapXYFrame.js +11 -0
- package/ai/dist/src/components/ResponsiveNetworkFrame.js +11 -0
- package/ai/dist/src/components/ResponsiveOrdinalFrame.js +11 -0
- package/ai/dist/src/components/ResponsiveXYFrame.js +10 -0
- package/ai/dist/src/components/SparkFrame.js +113 -0
- package/ai/dist/src/components/SparkNetworkFrame.js +11 -0
- package/ai/dist/src/components/SparkOrdinalFrame.js +11 -0
- package/ai/dist/src/components/SparkXYFrame.js +11 -0
- package/ai/dist/src/components/Tooltip/Tooltip.js +304 -0
- package/ai/dist/src/components/TooltipPositioner/index.js +132 -0
- package/ai/dist/src/components/VisualizationLayer.js +395 -0
- package/ai/dist/src/components/XYFrame.js +524 -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 +198 -0
- package/ai/dist/src/components/annotationRules/orframeRules.js +695 -0
- package/ai/dist/src/components/annotationRules/xyframeRules.js +299 -0
- package/ai/dist/src/components/batchWork.js +35 -0
- package/ai/dist/src/components/charts/index.js +96 -0
- package/ai/dist/src/components/charts/network/ChordDiagram.js +245 -0
- package/ai/dist/src/components/charts/network/CirclePack.js +177 -0
- package/ai/dist/src/components/charts/network/ForceDirectedGraph.js +248 -0
- package/ai/dist/src/components/charts/network/SankeyDiagram.js +305 -0
- package/ai/dist/src/components/charts/network/TreeDiagram.js +268 -0
- package/ai/dist/src/components/charts/network/Treemap.js +177 -0
- package/ai/dist/src/components/charts/ordinal/BarChart.js +191 -0
- package/ai/dist/src/components/charts/ordinal/BoxPlot.js +235 -0
- package/ai/dist/src/components/charts/ordinal/DonutChart.js +178 -0
- package/ai/dist/src/components/charts/ordinal/DotPlot.js +194 -0
- package/ai/dist/src/components/charts/ordinal/GroupedBarChart.js +194 -0
- package/ai/dist/src/components/charts/ordinal/PieChart.js +155 -0
- package/ai/dist/src/components/charts/ordinal/StackedBarChart.js +213 -0
- package/ai/dist/src/components/charts/ordinal/SwarmPlot.js +219 -0
- package/ai/dist/src/components/charts/realtime/RealtimeBarChart.js +91 -0
- package/ai/dist/src/components/charts/realtime/RealtimeLineChart.js +73 -0
- package/ai/dist/src/components/charts/realtime/RealtimeSwarmChart.js +85 -0
- package/ai/dist/src/components/charts/realtime/RealtimeWaterfallChart.js +86 -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 +176 -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/types.js +2 -0
- package/ai/dist/src/components/charts/shared/validateChartData.js +82 -0
- package/ai/dist/src/components/charts/shared/validateProps.js +640 -0
- package/ai/dist/src/components/charts/xy/AreaChart.js +220 -0
- package/ai/dist/src/components/charts/xy/BubbleChart.js +222 -0
- package/ai/dist/src/components/charts/xy/Heatmap.js +230 -0
- package/ai/dist/src/components/charts/xy/LineChart.js +302 -0
- package/ai/dist/src/components/charts/xy/Scatterplot.js +136 -0
- package/ai/dist/src/components/charts/xy/StackedAreaChart.js +220 -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/constants/jsx.js +71 -0
- package/ai/dist/src/components/data/dataFunctions.js +473 -0
- package/ai/dist/src/components/data/multiAccessorUtils.js +14 -0
- package/ai/dist/src/components/data/networkPipelineCache.js +43 -0
- package/ai/dist/src/components/data/ordinalPipelineCache.js +53 -0
- package/ai/dist/src/components/data/unflowedFunctions.js +5 -0
- package/ai/dist/src/components/data/xyPipelineCache.js +49 -0
- package/ai/dist/src/components/generic_utilities/functions.js +5 -0
- package/ai/dist/src/components/index.js +145 -0
- package/ai/dist/src/components/interactionLayerBehavior/InteractionCanvas.js +128 -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/network.js +771 -0
- package/ai/dist/src/components/processing/networkDefaults.js +39 -0
- package/ai/dist/src/components/processing/networkLayoutHelpers.js +98 -0
- package/ai/dist/src/components/processing/ordinal.js +889 -0
- package/ai/dist/src/components/processing/ordinalConstants.js +23 -0
- package/ai/dist/src/components/processing/ordinalOverlays.js +88 -0
- package/ai/dist/src/components/processing/ordinalRenderPipeline.js +196 -0
- package/ai/dist/src/components/processing/xyDrawing.js +484 -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/RealtimeFrame.js +710 -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 +66 -0
- package/ai/dist/src/components/semiotic-network.js +30 -0
- package/ai/dist/src/components/semiotic-ordinal.js +28 -0
- package/ai/dist/src/components/semiotic-realtime.js +37 -0
- package/ai/dist/src/components/semiotic-server.js +8 -0
- package/ai/dist/src/components/semiotic-xy.js +41 -0
- package/ai/dist/src/components/semiotic.js +101 -0
- package/ai/dist/src/components/server/renderToStaticSVG.js +392 -0
- package/ai/dist/src/components/store/TooltipStore.js +13 -0
- package/ai/dist/src/components/store/createStore.js +77 -0
- package/ai/dist/src/components/svg/SvgHelper.js +308 -0
- package/ai/dist/src/components/svg/areaDrawing.js +312 -0
- package/ai/dist/src/components/svg/boxplotRenderer.js +441 -0
- package/ai/dist/src/components/svg/bucketizedRenderer.js +677 -0
- package/ai/dist/src/components/svg/ckbinsRenderer.js +92 -0
- package/ai/dist/src/components/svg/ckmeans.js +238 -0
- package/ai/dist/src/components/svg/contourLayout.js +73 -0
- package/ai/dist/src/components/svg/contourRenderer.js +53 -0
- package/ai/dist/src/components/svg/edgeGenerators.js +181 -0
- package/ai/dist/src/components/svg/frameFunctions.js +579 -0
- package/ai/dist/src/components/svg/graphAlgorithms.js +138 -0
- package/ai/dist/src/components/svg/hexbinLayout.js +163 -0
- package/ai/dist/src/components/svg/lineDrawing.js +427 -0
- package/ai/dist/src/components/svg/networkDrawing.js +207 -0
- package/ai/dist/src/components/svg/nodeGenerators.js +131 -0
- package/ai/dist/src/components/svg/pieceDrawing.js +110 -0
- package/ai/dist/src/components/svg/pieceLayouts.js +588 -0
- package/ai/dist/src/components/svg/sankeyLinks.js +143 -0
- package/ai/dist/src/components/svg/summaryAxis.js +48 -0
- package/ai/dist/src/components/svg/summaryLayouts.js +202 -0
- package/ai/dist/src/components/svg/swarmLayout.js +128 -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/useDerivedStateFromProps.js +25 -0
- package/ai/dist/src/components/useLegacyUnmountCallback.js +21 -0
- package/ai/dist/src/components/visualizationLayerBehavior/axis.js +249 -0
- package/ai/dist/src/components/visualizationLayerBehavior/general.js +435 -0
- package/ai/dist/src/setupTests.js +4 -0
- package/ai/examples.md +394 -0
- package/ai/schema.json +1178 -0
- package/ai/system-prompt.md +38 -0
- package/dist/Annotation.d.ts +3 -0
- package/dist/AnnotationLayer/AnnotationLayer.d.ts +25 -0
- package/dist/Axis/Axis.d.ts +7 -0
- package/dist/Axis/axisTitle.d.ts +10 -0
- package/dist/Axis/index.d.ts +2 -0
- package/dist/Axis/summaryGraphic.d.ts +17 -0
- package/dist/Brush.d.ts +12 -0
- package/dist/DividedLine.d.ts +16 -0
- package/dist/FacetController.d.ts +12 -0
- package/dist/Frame.d.ts +2 -0
- package/dist/InteractionLayer.d.ts +3 -0
- package/dist/Legend.d.ts +3 -0
- package/dist/MiniMap.d.ts +14 -0
- package/dist/MinimapXYFrame.d.ts +10 -0
- package/dist/NetworkFrame.d.ts +8 -0
- package/dist/OrdinalFrame.d.ts +8 -0
- package/dist/ResponsiveFrame.d.ts +22 -0
- package/dist/ResponsiveMinimapXYFrame.d.ts +3 -0
- package/dist/ResponsiveNetworkFrame.d.ts +3 -0
- package/dist/ResponsiveOrdinalFrame.d.ts +3 -0
- package/dist/ResponsiveXYFrame.d.ts +3 -0
- package/dist/SparkFrame.d.ts +14 -0
- package/dist/SparkNetworkFrame.d.ts +5 -0
- package/dist/SparkOrdinalFrame.d.ts +5 -0
- package/dist/SparkXYFrame.d.ts +5 -0
- package/dist/Tooltip/Tooltip.d.ts +141 -0
- package/dist/TooltipPositioner/index.d.ts +7 -0
- package/dist/VisualizationLayer.d.ts +33 -0
- package/dist/XYFrame.d.ts +8 -0
- package/dist/annotationLayerBehavior/annotationHandling.d.ts +19 -0
- package/dist/annotationLayerBehavior/d3labeler.d.ts +9 -0
- package/dist/annotationRules/baseRules.d.ts +25 -0
- package/dist/annotationRules/networkframeRules.d.ts +48 -0
- package/dist/annotationRules/orframeRules.d.ts +103 -0
- package/dist/annotationRules/xyframeRules.d.ts +117 -0
- package/dist/batchWork.d.ts +6 -0
- package/dist/charts/index.d.ts +62 -0
- package/dist/charts/network/ChordDiagram.d.ts +181 -0
- package/dist/charts/network/CirclePack.d.ts +103 -0
- package/dist/charts/network/ForceDirectedGraph.d.ts +192 -0
- package/dist/charts/network/SankeyDiagram.d.ts +195 -0
- package/dist/charts/network/TreeDiagram.d.ts +200 -0
- package/dist/charts/network/Treemap.d.ts +98 -0
- package/dist/charts/ordinal/BarChart.d.ts +119 -0
- package/dist/charts/ordinal/BoxPlot.d.ts +125 -0
- package/dist/charts/ordinal/DonutChart.d.ts +95 -0
- package/dist/charts/ordinal/DotPlot.d.ts +128 -0
- package/dist/charts/ordinal/GroupedBarChart.d.ts +113 -0
- package/dist/charts/ordinal/PieChart.d.ts +83 -0
- package/dist/charts/ordinal/StackedBarChart.d.ts +119 -0
- package/dist/charts/ordinal/SwarmPlot.d.ts +137 -0
- package/dist/charts/realtime/RealtimeBarChart.d.ts +102 -0
- package/dist/charts/realtime/RealtimeLineChart.d.ts +78 -0
- package/dist/charts/realtime/RealtimeSwarmChart.d.ts +88 -0
- package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +85 -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 +82 -0
- package/dist/charts/shared/hooks.d.ts +20 -0
- package/dist/charts/shared/legendUtils.d.ts +32 -0
- package/dist/charts/shared/types.d.ts +58 -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 +127 -0
- package/dist/charts/xy/BubbleChart.d.ts +157 -0
- package/dist/charts/xy/Heatmap.d.ts +153 -0
- package/dist/charts/xy/LineChart.d.ts +193 -0
- package/dist/charts/xy/Scatterplot.d.ts +50 -0
- package/dist/charts/xy/StackedAreaChart.d.ts +131 -0
- package/dist/constants/coordinateNames.d.ts +8 -0
- package/dist/constants/frame_props.d.ts +13 -0
- package/dist/constants/jsx.d.ts +19 -0
- package/dist/data/dataFunctions.d.ts +45 -0
- package/dist/data/multiAccessorUtils.d.ts +1 -0
- package/dist/data/networkPipelineCache.d.ts +27 -0
- package/dist/data/ordinalPipelineCache.d.ts +33 -0
- package/dist/data/unflowedFunctions.d.ts +1 -0
- package/dist/data/xyPipelineCache.d.ts +35 -0
- package/dist/generic_utilities/functions.d.ts +1 -0
- package/dist/index.d.ts +133 -0
- package/dist/interactionLayerBehavior/InteractionCanvas.d.ts +20 -0
- package/dist/network.js +8520 -0
- package/dist/network.js.map +1 -0
- package/dist/network.min.js +1 -0
- package/dist/network.module.js +8484 -0
- package/dist/network.module.js.map +1 -0
- package/dist/network.module.min.js +1 -0
- package/dist/ordinal.js +9276 -0
- package/dist/ordinal.js.map +1 -0
- package/dist/ordinal.min.js +1 -0
- package/dist/ordinal.module.js +9242 -0
- package/dist/ordinal.module.js.map +1 -0
- package/dist/ordinal.module.min.js +1 -0
- package/dist/processing/InteractionItems.d.ts +13 -0
- 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/network.d.ts +111 -0
- package/dist/processing/networkDefaults.d.ts +36 -0
- package/dist/processing/networkLayoutHelpers.d.ts +54 -0
- package/dist/processing/ordinal.d.ts +102 -0
- package/dist/processing/ordinalConstants.d.ts +33 -0
- package/dist/processing/ordinalOverlays.d.ts +33 -0
- package/dist/processing/ordinalRenderPipeline.d.ts +148 -0
- package/dist/processing/xyDrawing.d.ts +140 -0
- package/dist/realtime/BinAccumulator.d.ts +8 -0
- package/dist/realtime/IncrementalExtent.d.ts +13 -0
- package/dist/realtime/RealtimeFrame.d.ts +4 -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 +1598 -0
- package/dist/realtime.js.map +1 -0
- package/dist/realtime.min.js +1 -0
- package/dist/realtime.module.js +1566 -0
- package/dist/realtime.module.js.map +1 -0
- package/dist/realtime.module.min.js +1 -0
- package/dist/semiotic-ai.d.ts +28 -0
- package/dist/semiotic-ai.js +18722 -0
- package/dist/semiotic-ai.js.map +1 -0
- package/dist/semiotic-ai.min.js +1 -0
- package/dist/semiotic-ai.module.js +18668 -0
- package/dist/semiotic-ai.module.js.map +1 -0
- package/dist/semiotic-ai.module.min.js +1 -0
- package/dist/semiotic-network.d.ts +19 -0
- package/dist/semiotic-ordinal.d.ts +18 -0
- package/dist/semiotic-realtime.d.ts +23 -0
- package/dist/semiotic-server.d.ts +1 -0
- package/dist/semiotic-xy.d.ts +24 -0
- package/dist/semiotic.d.ts +51 -0
- package/dist/semiotic.js +18723 -12996
- package/dist/semiotic.js.map +1 -0
- package/dist/semiotic.min.js +1 -0
- package/dist/semiotic.module.js +18666 -12965
- 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 +8360 -0
- package/dist/server.js.map +1 -0
- package/dist/server.min.js +1 -0
- package/dist/server.module.js +8331 -0
- package/dist/server.module.js.map +1 -0
- package/dist/server.module.min.js +1 -0
- package/dist/store/TooltipStore.d.ts +2 -0
- package/dist/store/createStore.d.ts +1 -0
- package/dist/svg/SvgHelper.d.ts +33 -0
- package/dist/svg/areaDrawing.d.ts +21 -0
- package/dist/svg/boxplotRenderer.d.ts +15 -0
- package/dist/svg/bucketizedRenderer.d.ts +16 -0
- package/dist/svg/ckbinsRenderer.d.ts +20 -0
- package/dist/svg/ckmeans.d.ts +69 -0
- package/dist/svg/contourLayout.d.ts +6 -0
- package/dist/svg/contourRenderer.d.ts +12 -0
- package/dist/svg/edgeGenerators.d.ts +51 -0
- package/dist/svg/frameFunctions.d.ts +108 -0
- package/dist/svg/graphAlgorithms.d.ts +14 -0
- package/dist/svg/hexbinLayout.d.ts +7 -0
- package/dist/svg/lineDrawing.d.ts +99 -0
- package/dist/svg/networkDrawing.d.ts +16 -0
- package/dist/svg/nodeGenerators.d.ts +58 -0
- package/dist/svg/pieceDrawing.d.ts +12 -0
- package/dist/svg/pieceLayouts.d.ts +53 -0
- package/dist/svg/sankeyLinks.d.ts +3 -0
- package/dist/svg/summaryAxis.d.ts +6 -0
- package/dist/svg/summaryLayouts.d.ts +53 -0
- package/dist/svg/swarmLayout.d.ts +13 -0
- package/dist/types/annotationTypes.d.ts +135 -0
- package/dist/types/canvasTypes.d.ts +9 -0
- package/dist/types/generalTypes.d.ts +238 -0
- package/dist/types/interactionTypes.d.ts +72 -0
- package/dist/types/legendTypes.d.ts +20 -0
- package/dist/types/networkTypes.d.ts +175 -0
- package/dist/types/ordinalTypes.d.ts +112 -0
- package/dist/types/xyTypes.d.ts +115 -0
- package/dist/useBoundingRect.d.ts +2 -0
- package/dist/useDerivedStateFromProps.d.ts +1 -0
- package/dist/useLegacyUnmountCallback.d.ts +2 -0
- package/dist/visualizationLayerBehavior/axis.d.ts +36 -0
- package/dist/visualizationLayerBehavior/general.d.ts +80 -0
- package/dist/xy.js +7944 -0
- package/dist/xy.js.map +1 -0
- package/dist/xy.min.js +1 -0
- package/dist/xy.module.js +7903 -0
- package/dist/xy.module.js.map +1 -0
- package/dist/xy.module.min.js +1 -0
- package/package.json +116 -65
|
@@ -0,0 +1,484 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.calculateXYFrame = void 0;
|
|
40
|
+
const React = __importStar(require("react"));
|
|
41
|
+
const d3_scale_1 = require("d3-scale");
|
|
42
|
+
const Axis_1 = __importDefault(require("../Axis"));
|
|
43
|
+
const axis_1 = require("../visualizationLayerBehavior/axis");
|
|
44
|
+
const dataFunctions_1 = require("../data/dataFunctions");
|
|
45
|
+
const general_1 = require("../visualizationLayerBehavior/general");
|
|
46
|
+
const frameFunctions_1 = require("../svg/frameFunctions");
|
|
47
|
+
const screenScales = ({ xExtent, yExtent, adjustedSize, xScaleType, yScaleType }) => {
|
|
48
|
+
const xDomain = [0, adjustedSize[0]];
|
|
49
|
+
const yDomain = [adjustedSize[1], 0];
|
|
50
|
+
const xScale = xScaleType;
|
|
51
|
+
const yScale = yScaleType;
|
|
52
|
+
if (xScaleType.domain) {
|
|
53
|
+
xScaleType.domain(xExtent);
|
|
54
|
+
}
|
|
55
|
+
if (yScaleType.domain) {
|
|
56
|
+
yScaleType.domain(yExtent);
|
|
57
|
+
}
|
|
58
|
+
xScaleType.range(xDomain);
|
|
59
|
+
yScaleType.range(yDomain);
|
|
60
|
+
return { xScale, yScale };
|
|
61
|
+
};
|
|
62
|
+
const naturalLanguageLineType = {
|
|
63
|
+
line: { items: "line", chart: "line chart" },
|
|
64
|
+
area: { items: "summary", chart: "summary chart" },
|
|
65
|
+
summary: { items: "summary", chart: "summary chart" },
|
|
66
|
+
cumulative: { items: "line", chart: "cumulative chart" },
|
|
67
|
+
"cumulative-reverse": { items: "line", chart: "cumulative chart" },
|
|
68
|
+
linepercent: { items: "line", chart: "line chart" },
|
|
69
|
+
stackedarea: { items: "stacked area", chart: "stacked area chart" },
|
|
70
|
+
"stackedarea-invert": { items: "stacked area", chart: "stacked area chart" },
|
|
71
|
+
stackedpercent: { items: "stacked area", chart: "stacked area chart" },
|
|
72
|
+
"stackedpercent-invert": {
|
|
73
|
+
items: "stacked area",
|
|
74
|
+
chart: "stacked area chart"
|
|
75
|
+
},
|
|
76
|
+
bumparea: { items: "ranked area", chart: "ranked area chart" },
|
|
77
|
+
"bumparea-invert": { items: "ranked area", chart: "ranked area chart" },
|
|
78
|
+
bumpline: { items: "ranked line", chart: "ranked line chart" },
|
|
79
|
+
difference: {
|
|
80
|
+
items: "line",
|
|
81
|
+
chart: "difference chart"
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const calculateXYFrame = (currentProps, prevState, updateData, cache) => {
|
|
85
|
+
const { legend, lines, lineClass, pointStyle, pointRenderMode, pointClass, summaryClass, canvasLines, canvasPoints, canvasSummaries, defined, size, renderKey, lineType, summaryType, customLineMark, customPointMark, customSummaryMark, summaryStyle, summaryRenderMode, lineStyle, lineRenderMode, xExtent: baseXExtent, yExtent: baseYExtent, title, xScaleType: baseXScaleType = (0, d3_scale_1.scaleLinear)(), yScaleType: baseYScaleType = (0, d3_scale_1.scaleLinear)(), lineIDAccessor, invertX, invertY, showLinePoints, showSummaryPoints, points, lineDataAccessor, summaryDataAccessor, yAccessor, xAccessor, useSummariesAsInteractionLayer, filterRenderedLines, filterRenderedSummaries, filterRenderedPoints, annotations } = currentProps;
|
|
86
|
+
let { projectedLines, projectedPoints, projectedSummaries, summaries, fullDataset } = currentProps;
|
|
87
|
+
if (summaryType && points && !summaries) {
|
|
88
|
+
summaries = [{ coordinates: points }];
|
|
89
|
+
}
|
|
90
|
+
else if (summaryType &&
|
|
91
|
+
summaryType.type === "linebounds" &&
|
|
92
|
+
lines &&
|
|
93
|
+
!summaries) {
|
|
94
|
+
summaries = lines;
|
|
95
|
+
}
|
|
96
|
+
const castXScaleType = baseXScaleType;
|
|
97
|
+
const xScaleType = baseXScaleType.domain ? baseXScaleType : castXScaleType();
|
|
98
|
+
const castYScaleType = baseYScaleType;
|
|
99
|
+
const yScaleType = baseYScaleType.domain ? baseYScaleType : castYScaleType();
|
|
100
|
+
const cachedAccessors = cache.annotatedSettings(xAccessor, yAccessor, summaryDataAccessor, lineDataAccessor, renderKey, lineType, summaryType, lineIDAccessor);
|
|
101
|
+
const annotatedSettings = {
|
|
102
|
+
...cachedAccessors,
|
|
103
|
+
lineType: (0, frameFunctions_1.objectifyType)(lineType),
|
|
104
|
+
summaryType: (0, frameFunctions_1.objectifyType)(summaryType),
|
|
105
|
+
summaries: !summaries || (Array.isArray(summaries) && summaries.length === 0)
|
|
106
|
+
? undefined
|
|
107
|
+
: !Array.isArray(summaries)
|
|
108
|
+
? [summaries]
|
|
109
|
+
: !summaryDataAccessor && !summaries[0].coordinates
|
|
110
|
+
? [{ coordinates: summaries }]
|
|
111
|
+
: summaries,
|
|
112
|
+
lines: !lines || (Array.isArray(lines) && lines.length === 0)
|
|
113
|
+
? undefined
|
|
114
|
+
: !Array.isArray(lines)
|
|
115
|
+
? [lines]
|
|
116
|
+
: !lineDataAccessor && !lines[0].coordinates
|
|
117
|
+
? [{ coordinates: lines }]
|
|
118
|
+
: lines,
|
|
119
|
+
title: typeof title === "object" &&
|
|
120
|
+
!React.isValidElement(title) &&
|
|
121
|
+
title !== null
|
|
122
|
+
? title
|
|
123
|
+
: { title, orient: "top" },
|
|
124
|
+
xExtent: Array.isArray(baseXExtent)
|
|
125
|
+
? baseXExtent
|
|
126
|
+
: !baseXExtent
|
|
127
|
+
? undefined
|
|
128
|
+
: baseXExtent.extent,
|
|
129
|
+
yExtent: Array.isArray(baseYExtent)
|
|
130
|
+
? baseYExtent
|
|
131
|
+
: !baseYExtent
|
|
132
|
+
? undefined
|
|
133
|
+
: baseYExtent.extent
|
|
134
|
+
};
|
|
135
|
+
if (annotatedSettings.lineType.type === "area") {
|
|
136
|
+
annotatedSettings.lineType.y1 = () => 0;
|
|
137
|
+
annotatedSettings.lineType.simpleLine = false;
|
|
138
|
+
}
|
|
139
|
+
const { summaryStyleFn, summaryClassFn, summaryRenderModeFn } = cache.summaryStyleFns(summaryStyle, summaryClass, summaryRenderMode);
|
|
140
|
+
const generatedAxes = currentProps.axes &&
|
|
141
|
+
currentProps.axes.map((axisFnOrObject) => typeof axisFnOrObject === "function"
|
|
142
|
+
? axisFnOrObject({ size: currentProps.size })
|
|
143
|
+
: axisFnOrObject);
|
|
144
|
+
const { margin, adjustedPosition, adjustedSize } = cache.marginCalc(currentProps.margin, generatedAxes, annotatedSettings.title, currentProps.size);
|
|
145
|
+
let calculatedXExtent = [], calculatedYExtent = [], yExtent, xExtent, xExtentSettings, yExtentSettings;
|
|
146
|
+
if (typeof baseXExtent === "object") {
|
|
147
|
+
xExtentSettings = baseXExtent;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
xExtentSettings = { extent: baseXExtent };
|
|
151
|
+
}
|
|
152
|
+
if (typeof baseYExtent === "object") {
|
|
153
|
+
yExtentSettings = baseYExtent;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
yExtentSettings = { extent: baseYExtent };
|
|
157
|
+
}
|
|
158
|
+
let xScale, yScale;
|
|
159
|
+
if (updateData ||
|
|
160
|
+
(currentProps.dataVersion &&
|
|
161
|
+
currentProps.dataVersion !== prevState.dataVersion)) {
|
|
162
|
+
//This will always fire at this point because xExtent/yExtent are just defined up there so revisit this logic
|
|
163
|
+
if (!xExtent ||
|
|
164
|
+
!yExtent ||
|
|
165
|
+
!fullDataset ||
|
|
166
|
+
(!projectedLines && !projectedPoints && !projectedSummaries)) {
|
|
167
|
+
;
|
|
168
|
+
({
|
|
169
|
+
xExtent,
|
|
170
|
+
yExtent,
|
|
171
|
+
projectedLines,
|
|
172
|
+
projectedPoints,
|
|
173
|
+
projectedSummaries,
|
|
174
|
+
fullDataset,
|
|
175
|
+
calculatedXExtent,
|
|
176
|
+
calculatedYExtent
|
|
177
|
+
} = (0, dataFunctions_1.calculateDataExtent)({
|
|
178
|
+
lineDataAccessor: annotatedSettings.lineDataAccessor,
|
|
179
|
+
summaryDataAccessor: annotatedSettings.summaryDataAccessor,
|
|
180
|
+
xAccessor: annotatedSettings.xAccessor,
|
|
181
|
+
yAccessor: annotatedSettings.yAccessor,
|
|
182
|
+
lineType: annotatedSettings.lineType,
|
|
183
|
+
summaryType: annotatedSettings.summaryType,
|
|
184
|
+
summaries: annotatedSettings.summaries,
|
|
185
|
+
points,
|
|
186
|
+
lines: annotatedSettings.lines,
|
|
187
|
+
showLinePoints,
|
|
188
|
+
showSummaryPoints,
|
|
189
|
+
xExtent: baseXExtent,
|
|
190
|
+
yExtent: baseYExtent,
|
|
191
|
+
invertX,
|
|
192
|
+
invertY,
|
|
193
|
+
adjustedSize,
|
|
194
|
+
margin,
|
|
195
|
+
summaryStyleFn,
|
|
196
|
+
summaryClassFn,
|
|
197
|
+
summaryRenderModeFn,
|
|
198
|
+
chartSize: size,
|
|
199
|
+
xScaleType,
|
|
200
|
+
yScaleType,
|
|
201
|
+
defined,
|
|
202
|
+
filterRenderedLines,
|
|
203
|
+
filterRenderedSummaries,
|
|
204
|
+
filterRenderedPoints,
|
|
205
|
+
annotations
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
;
|
|
209
|
+
({ xScale, yScale } = screenScales({
|
|
210
|
+
xExtent,
|
|
211
|
+
yExtent,
|
|
212
|
+
adjustedSize,
|
|
213
|
+
xScaleType: xScaleType.copy(),
|
|
214
|
+
yScaleType: yScaleType.copy()
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
;
|
|
219
|
+
({
|
|
220
|
+
xExtent,
|
|
221
|
+
yExtent,
|
|
222
|
+
projectedLines,
|
|
223
|
+
projectedPoints,
|
|
224
|
+
projectedSummaries,
|
|
225
|
+
fullDataset,
|
|
226
|
+
calculatedXExtent,
|
|
227
|
+
calculatedYExtent
|
|
228
|
+
} = prevState);
|
|
229
|
+
if (adjustedSize[0] === prevState.adjustedSize[0] &&
|
|
230
|
+
adjustedSize[1] === prevState.adjustedSize[1]) {
|
|
231
|
+
xScale = prevState.xScale;
|
|
232
|
+
yScale = prevState.yScale;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
;
|
|
236
|
+
({ xScale, yScale } = screenScales({
|
|
237
|
+
xExtent,
|
|
238
|
+
yExtent,
|
|
239
|
+
adjustedSize,
|
|
240
|
+
xScaleType,
|
|
241
|
+
yScaleType
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
xExtent =
|
|
246
|
+
Array.isArray(xExtentSettings.extent) && xExtentSettings.extent.length === 2
|
|
247
|
+
? xExtentSettings.extent
|
|
248
|
+
: xExtent;
|
|
249
|
+
yExtent =
|
|
250
|
+
Array.isArray(yExtentSettings.extent) && yExtentSettings.extent.length === 2
|
|
251
|
+
? yExtentSettings.extent
|
|
252
|
+
: yExtent;
|
|
253
|
+
const canvasDrawing = [];
|
|
254
|
+
let axes;
|
|
255
|
+
let axesTickLines;
|
|
256
|
+
const existingBaselines = {};
|
|
257
|
+
if (generatedAxes) {
|
|
258
|
+
axesTickLines = [];
|
|
259
|
+
axes = generatedAxes.map((d, i) => {
|
|
260
|
+
let axisClassname = d.className || "";
|
|
261
|
+
axisClassname += " axis";
|
|
262
|
+
let axisScale = yScale;
|
|
263
|
+
if (existingBaselines[d.orient]) {
|
|
264
|
+
d.baseline = d.baseline || false;
|
|
265
|
+
}
|
|
266
|
+
existingBaselines[d.orient] = true;
|
|
267
|
+
if (d.orient === "top" || d.orient === "bottom") {
|
|
268
|
+
axisClassname += " x";
|
|
269
|
+
axisScale = xScale;
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
axisClassname += " y";
|
|
273
|
+
}
|
|
274
|
+
axisClassname += ` ${d.orient}`;
|
|
275
|
+
let tickValues;
|
|
276
|
+
if (d.tickValues && Array.isArray(d.tickValues)) {
|
|
277
|
+
tickValues = d.tickValues;
|
|
278
|
+
}
|
|
279
|
+
else if (d.tickValues instanceof Function) {
|
|
280
|
+
//otherwise assume a function
|
|
281
|
+
tickValues = d.tickValues(fullDataset, currentProps.size, axisScale);
|
|
282
|
+
}
|
|
283
|
+
const axisSize = [adjustedSize[0], adjustedSize[1]];
|
|
284
|
+
const axisParts = (0, axis_1.axisPieces)({
|
|
285
|
+
padding: d.padding,
|
|
286
|
+
tickValues,
|
|
287
|
+
scale: axisScale,
|
|
288
|
+
ticks: d.ticks,
|
|
289
|
+
orient: d.orient,
|
|
290
|
+
size: axisSize,
|
|
291
|
+
footer: d.footer,
|
|
292
|
+
tickSize: d.tickSize,
|
|
293
|
+
jaggedBase: d.jaggedBase
|
|
294
|
+
});
|
|
295
|
+
const axisTickLines = (React.createElement("g", { key: `axes-tick-lines-${i}`, className: `axis ${axisClassname}` },
|
|
296
|
+
(0, axis_1.axisLines)({
|
|
297
|
+
axisParts,
|
|
298
|
+
orient: d.orient,
|
|
299
|
+
tickLineGenerator: d.tickLineGenerator,
|
|
300
|
+
className: axisClassname,
|
|
301
|
+
jaggedBase: d.jaggedBase,
|
|
302
|
+
scale: axisScale,
|
|
303
|
+
showOutboundTickLines: d.showOutboundTickLines
|
|
304
|
+
}),
|
|
305
|
+
d.baseline === "under" &&
|
|
306
|
+
(0, axis_1.baselineGenerator)(d.orient, adjustedSize, d.className)));
|
|
307
|
+
axesTickLines.push(axisTickLines);
|
|
308
|
+
return (React.createElement(Axis_1.default, { ...d, key: d.key || `axis-${i}`, annotationFunction: d.axisAnnotationFunction, axisParts: axisParts, size: axisSize, margin: margin, tickValues: tickValues, scale: axisScale, className: axisClassname, xyPoints: fullDataset }));
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
let legendSettings;
|
|
312
|
+
if (legend) {
|
|
313
|
+
legendSettings = legend === true ? {} : legend;
|
|
314
|
+
if (projectedLines && !legendSettings.legendGroups) {
|
|
315
|
+
const typeString = annotatedSettings.lineType.type;
|
|
316
|
+
const type = typeof typeString === "string" &&
|
|
317
|
+
["stackedarea", "stackedpercent", "bumparea"].indexOf(typeString) === -1
|
|
318
|
+
? "line"
|
|
319
|
+
: "fill";
|
|
320
|
+
const legendGroups = [
|
|
321
|
+
{
|
|
322
|
+
styleFn: currentProps.lineStyle,
|
|
323
|
+
type,
|
|
324
|
+
items: projectedLines.map((d) => Object.assign({ label: annotatedSettings.lineIDAccessor(d) }, d))
|
|
325
|
+
}
|
|
326
|
+
];
|
|
327
|
+
legendSettings.legendGroups = legendGroups;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
const areaAnnotations = [];
|
|
331
|
+
if (annotatedSettings.summaryType.label && projectedSummaries) {
|
|
332
|
+
projectedSummaries.forEach((d, i) => {
|
|
333
|
+
if (d.bounds) {
|
|
334
|
+
const bounds = Array.isArray(d.bounds) ? d.bounds : [d.bounds];
|
|
335
|
+
bounds.forEach((labelBounds) => {
|
|
336
|
+
const label = typeof annotatedSettings.summaryType.label === "function"
|
|
337
|
+
? annotatedSettings.summaryType.label(d)
|
|
338
|
+
: annotatedSettings.summaryType.label;
|
|
339
|
+
if (label && label !== null) {
|
|
340
|
+
const labelPosition = label.position || "center";
|
|
341
|
+
const labelCenter = [
|
|
342
|
+
xScale(labelBounds[labelPosition][0]),
|
|
343
|
+
yScale(labelBounds[labelPosition][1])
|
|
344
|
+
];
|
|
345
|
+
const labelContent = label.content || ((p) => p.value || p.id || i);
|
|
346
|
+
areaAnnotations.push({
|
|
347
|
+
x: labelCenter[0],
|
|
348
|
+
y: labelCenter[1],
|
|
349
|
+
dx: label.dx,
|
|
350
|
+
dy: label.dy,
|
|
351
|
+
className: label.className,
|
|
352
|
+
type: label.type || "callout",
|
|
353
|
+
note: label.note || { title: labelContent(d) },
|
|
354
|
+
subject: label.subject || { text: labelContent(d) },
|
|
355
|
+
connector: label.connector
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
else if (annotatedSettings.summaryType.showSlope &&
|
|
363
|
+
projectedSummaries &&
|
|
364
|
+
projectedSummaries[0]) {
|
|
365
|
+
const firstSummary = projectedSummaries[0];
|
|
366
|
+
const firstPoint = firstSummary._xyfCoordinates[0];
|
|
367
|
+
const finalPoint = firstSummary._xyfCoordinates[firstSummary._xyfCoordinates.length - 1];
|
|
368
|
+
areaAnnotations.push({
|
|
369
|
+
x: firstPoint[0],
|
|
370
|
+
y: firstPoint[1],
|
|
371
|
+
x1: finalPoint[0],
|
|
372
|
+
x2: finalPoint[1],
|
|
373
|
+
type: "trendline-annotation",
|
|
374
|
+
value: firstSummary.value,
|
|
375
|
+
r2: firstSummary.r2
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
const lineAriaLabel = annotatedSettings.lineType.type !== undefined &&
|
|
379
|
+
typeof annotatedSettings.lineType.type === "string" &&
|
|
380
|
+
naturalLanguageLineType[annotatedSettings.lineType.type];
|
|
381
|
+
const xyFrameRender = {
|
|
382
|
+
lines: {
|
|
383
|
+
accessibleTransform: (data, i) => ({
|
|
384
|
+
...data[i].data[data[i].data.length - 1],
|
|
385
|
+
type: "frame-hover"
|
|
386
|
+
}),
|
|
387
|
+
data: projectedLines,
|
|
388
|
+
...cache.lineStyleFns(lineStyle, lineClass, lineRenderMode, canvasLines),
|
|
389
|
+
customMark: customLineMark,
|
|
390
|
+
type: annotatedSettings.lineType,
|
|
391
|
+
defined: defined,
|
|
392
|
+
renderKeyFn: annotatedSettings.renderKeyFn,
|
|
393
|
+
ariaLabel: lineAriaLabel,
|
|
394
|
+
axesData: generatedAxes,
|
|
395
|
+
behavior: general_1.createLines
|
|
396
|
+
},
|
|
397
|
+
summaries: {
|
|
398
|
+
accessibleTransform: (data, i) => ({ ...data[i], type: "frame-hover" }),
|
|
399
|
+
data: projectedSummaries,
|
|
400
|
+
styleFn: summaryStyleFn,
|
|
401
|
+
classFn: summaryClassFn,
|
|
402
|
+
renderMode: summaryRenderModeFn,
|
|
403
|
+
canvasRender: cache.summaryCanvasRender(canvasSummaries),
|
|
404
|
+
customMark: customSummaryMark,
|
|
405
|
+
type: annotatedSettings.summaryType,
|
|
406
|
+
renderKeyFn: annotatedSettings.renderKeyFn,
|
|
407
|
+
behavior: general_1.createSummaries
|
|
408
|
+
},
|
|
409
|
+
points: {
|
|
410
|
+
accessibleTransform: (data, i) => ({
|
|
411
|
+
type: "frame-hover",
|
|
412
|
+
...(data[i].data || data[i])
|
|
413
|
+
}),
|
|
414
|
+
data: projectedPoints,
|
|
415
|
+
...cache.pointStyleFns(pointStyle, pointClass, pointRenderMode, canvasPoints),
|
|
416
|
+
customMark: customPointMark,
|
|
417
|
+
renderKeyFn: annotatedSettings.renderKeyFn,
|
|
418
|
+
showLinePoints,
|
|
419
|
+
behavior: general_1.createPoints
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
if (xExtentSettings.onChange &&
|
|
423
|
+
prevState.calculatedXExtent.join(",") !== calculatedXExtent.join(",")) {
|
|
424
|
+
xExtentSettings.onChange(calculatedXExtent);
|
|
425
|
+
}
|
|
426
|
+
if (yExtentSettings.onChange &&
|
|
427
|
+
prevState.calculatedYExtent.join(",") !== calculatedYExtent.join(",")) {
|
|
428
|
+
yExtentSettings.onChange(calculatedYExtent);
|
|
429
|
+
}
|
|
430
|
+
let overlay = undefined;
|
|
431
|
+
if (useSummariesAsInteractionLayer && projectedSummaries) {
|
|
432
|
+
overlay = (0, general_1.createSummaries)({
|
|
433
|
+
xScale,
|
|
434
|
+
yScale,
|
|
435
|
+
data: projectedSummaries
|
|
436
|
+
}).map((m, i) => ({
|
|
437
|
+
...m.props,
|
|
438
|
+
style: { fillOpacity: 0 },
|
|
439
|
+
overlayData: projectedSummaries && projectedSummaries[i] // luckily createSummaries is a map fn
|
|
440
|
+
}));
|
|
441
|
+
}
|
|
442
|
+
return {
|
|
443
|
+
lineData: currentProps.lines,
|
|
444
|
+
pointData: currentProps.points,
|
|
445
|
+
summaryData: currentProps.summaries,
|
|
446
|
+
dataVersion: currentProps.dataVersion,
|
|
447
|
+
projectedLines,
|
|
448
|
+
projectedPoints,
|
|
449
|
+
projectedSummaries,
|
|
450
|
+
canvasDrawing,
|
|
451
|
+
fullDataset,
|
|
452
|
+
adjustedPosition,
|
|
453
|
+
adjustedSize,
|
|
454
|
+
backgroundGraphics: currentProps.backgroundGraphics,
|
|
455
|
+
foregroundGraphics: currentProps.foregroundGraphics,
|
|
456
|
+
axesData: generatedAxes,
|
|
457
|
+
axes,
|
|
458
|
+
axesTickLines,
|
|
459
|
+
renderNumber: prevState.renderNumber + 1,
|
|
460
|
+
xScale,
|
|
461
|
+
yScale,
|
|
462
|
+
xAccessor: annotatedSettings.xAccessor,
|
|
463
|
+
yAccessor: annotatedSettings.yAccessor,
|
|
464
|
+
xExtent: [
|
|
465
|
+
xExtent[0] === undefined ? calculatedXExtent[0] : xExtent[0],
|
|
466
|
+
xExtent[1] === undefined ? calculatedXExtent[1] : xExtent[1]
|
|
467
|
+
],
|
|
468
|
+
yExtent: [
|
|
469
|
+
yExtent[0] === undefined ? calculatedYExtent[0] : yExtent[0],
|
|
470
|
+
yExtent[1] === undefined ? calculatedYExtent[1] : yExtent[1]
|
|
471
|
+
],
|
|
472
|
+
calculatedXExtent,
|
|
473
|
+
calculatedYExtent,
|
|
474
|
+
margin,
|
|
475
|
+
legendSettings,
|
|
476
|
+
areaAnnotations,
|
|
477
|
+
xyFrameRender,
|
|
478
|
+
size,
|
|
479
|
+
annotatedSettings,
|
|
480
|
+
overlay,
|
|
481
|
+
props: currentProps
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
exports.calculateXYFrame = calculateXYFrame;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeBins = computeBins;
|
|
4
|
+
exports.computeBinExtent = computeBinExtent;
|
|
5
|
+
function computeBins(data, getTime, getValue, binSize, getCategory) {
|
|
6
|
+
const bins = new Map();
|
|
7
|
+
for (const d of data) {
|
|
8
|
+
const t = getTime(d);
|
|
9
|
+
const v = getValue(d);
|
|
10
|
+
if (t == null || v == null || Number.isNaN(t) || Number.isNaN(v))
|
|
11
|
+
continue;
|
|
12
|
+
const binStart = Math.floor(t / binSize) * binSize;
|
|
13
|
+
let bin = bins.get(binStart);
|
|
14
|
+
if (!bin) {
|
|
15
|
+
bin = { start: binStart, end: binStart + binSize, total: 0, categories: new Map() };
|
|
16
|
+
bins.set(binStart, bin);
|
|
17
|
+
}
|
|
18
|
+
bin.total += v;
|
|
19
|
+
if (getCategory) {
|
|
20
|
+
const cat = getCategory(d);
|
|
21
|
+
bin.categories.set(cat, (bin.categories.get(cat) || 0) + v);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return bins;
|
|
25
|
+
}
|
|
26
|
+
function computeBinExtent(data, getTime, getValue, binSize, getCategory) {
|
|
27
|
+
const bins = computeBins(data, getTime, getValue, binSize, getCategory);
|
|
28
|
+
if (bins.size === 0)
|
|
29
|
+
return [0, 0];
|
|
30
|
+
let maxTotal = 0;
|
|
31
|
+
for (const bin of bins.values()) {
|
|
32
|
+
if (bin.total > maxTotal)
|
|
33
|
+
maxTotal = bin.total;
|
|
34
|
+
}
|
|
35
|
+
return [0, maxTotal];
|
|
36
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IncrementalExtent = void 0;
|
|
4
|
+
class IncrementalExtent {
|
|
5
|
+
constructor() {
|
|
6
|
+
this._min = Infinity;
|
|
7
|
+
this._max = -Infinity;
|
|
8
|
+
this._dirty = false;
|
|
9
|
+
}
|
|
10
|
+
push(value) {
|
|
11
|
+
if (Number.isNaN(value))
|
|
12
|
+
return;
|
|
13
|
+
if (value < this._min)
|
|
14
|
+
this._min = value;
|
|
15
|
+
if (value > this._max)
|
|
16
|
+
this._max = value;
|
|
17
|
+
}
|
|
18
|
+
evict(value) {
|
|
19
|
+
if (value === this._min || value === this._max) {
|
|
20
|
+
this._dirty = true;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
recalculate(values, accessor) {
|
|
24
|
+
this._min = Infinity;
|
|
25
|
+
this._max = -Infinity;
|
|
26
|
+
for (const v of values) {
|
|
27
|
+
const n = accessor ? accessor(v) : v;
|
|
28
|
+
if (Number.isNaN(n))
|
|
29
|
+
continue;
|
|
30
|
+
if (n < this._min)
|
|
31
|
+
this._min = n;
|
|
32
|
+
if (n > this._max)
|
|
33
|
+
this._max = n;
|
|
34
|
+
}
|
|
35
|
+
this._dirty = false;
|
|
36
|
+
}
|
|
37
|
+
clear() {
|
|
38
|
+
this._min = Infinity;
|
|
39
|
+
this._max = -Infinity;
|
|
40
|
+
this._dirty = false;
|
|
41
|
+
}
|
|
42
|
+
get extent() {
|
|
43
|
+
return [this._min, this._max];
|
|
44
|
+
}
|
|
45
|
+
get min() {
|
|
46
|
+
return this._min;
|
|
47
|
+
}
|
|
48
|
+
get max() {
|
|
49
|
+
return this._max;
|
|
50
|
+
}
|
|
51
|
+
get dirty() {
|
|
52
|
+
return this._dirty;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.IncrementalExtent = IncrementalExtent;
|