layerchart 2.0.0-next.6 → 2.0.0-next.60
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/LICENSE +1 -1
- package/dist/bench/ComposableLineChart.svelte +56 -0
- package/dist/bench/ComposableLineChart.svelte.d.ts +16 -0
- package/dist/bench/GeoBench.svelte +24 -0
- package/dist/bench/GeoBench.svelte.d.ts +11 -0
- package/dist/bench/PrimitiveBench.svelte +66 -0
- package/dist/bench/PrimitiveBench.svelte.d.ts +10 -0
- package/dist/bench/composable-vs-linechart.svelte.bench.d.ts +1 -0
- package/dist/bench/composable-vs-linechart.svelte.bench.js +100 -0
- package/dist/bench/generateData.d.ts +29 -0
- package/dist/bench/generateData.js +93 -0
- package/dist/bench/primitives.svelte.bench.d.ts +1 -0
- package/dist/bench/primitives.svelte.bench.js +42 -0
- package/dist/bench/svg-vs-canvas.svelte.bench.d.ts +1 -0
- package/dist/bench/svg-vs-canvas.svelte.bench.js +431 -0
- package/dist/components/AnnotationLine.svelte +126 -69
- package/dist/components/AnnotationLine.svelte.d.ts +10 -2
- package/dist/components/AnnotationPoint.svelte +122 -36
- package/dist/components/AnnotationPoint.svelte.d.ts +8 -1
- package/dist/components/AnnotationRange.svelte +45 -17
- package/dist/components/Arc.svelte +42 -35
- package/dist/components/Arc.svelte.d.ts +9 -6
- package/dist/components/Arc.svelte.test.d.ts +1 -0
- package/dist/components/Arc.svelte.test.js +858 -0
- package/dist/components/ArcLabel.svelte +259 -0
- package/dist/components/ArcLabel.svelte.d.ts +73 -0
- package/dist/components/ArcLabel.svelte.test.d.ts +1 -0
- package/dist/components/ArcLabel.svelte.test.js +235 -0
- package/dist/components/Area.svelte +95 -100
- package/dist/components/Area.svelte.d.ts +7 -3
- package/dist/components/Axis.svelte +254 -60
- package/dist/components/Axis.svelte.d.ts +42 -8
- package/dist/components/Bar.svelte +174 -53
- package/dist/components/Bar.svelte.d.ts +22 -2
- package/dist/components/Bars.svelte +33 -7
- package/dist/components/Bars.svelte.d.ts +9 -1
- package/dist/components/Blur.svelte +10 -9
- package/dist/components/Blur.svelte.d.ts +2 -5
- package/dist/components/Bounds.svelte +1 -1
- package/dist/components/BoxPlot.svelte +389 -0
- package/dist/components/BoxPlot.svelte.d.ts +40 -0
- package/dist/components/BrushContext.svelte +149 -329
- package/dist/components/BrushContext.svelte.d.ts +17 -45
- package/dist/components/BrushContext.svelte.test.d.ts +1 -0
- package/dist/components/BrushContext.svelte.test.js +308 -0
- package/dist/components/Calendar.svelte +45 -20
- package/dist/components/Calendar.svelte.d.ts +4 -4
- package/dist/components/Cell.svelte +64 -0
- package/dist/components/Cell.svelte.d.ts +25 -0
- package/dist/components/Chart.svelte +580 -767
- package/dist/components/Chart.svelte.d.ts +127 -101
- package/dist/components/ChartChildren.svelte +334 -0
- package/dist/components/ChartChildren.svelte.d.ts +147 -0
- package/dist/components/ChartClipPath.svelte +2 -2
- package/dist/components/Circle.svelte +392 -72
- package/dist/components/Circle.svelte.d.ts +40 -9
- package/dist/components/Circle.svelte.test.d.ts +1 -0
- package/dist/components/Circle.svelte.test.js +141 -0
- package/dist/components/CircleClipPath.svelte +13 -15
- package/dist/components/CircleClipPath.svelte.d.ts +7 -1
- package/dist/components/CircleLegend.svelte +389 -0
- package/dist/components/CircleLegend.svelte.d.ts +114 -0
- package/dist/components/ClipPath.svelte +77 -10
- package/dist/components/ClipPath.svelte.d.ts +21 -2
- package/dist/components/ColorRamp.svelte +1 -1
- package/dist/components/ComputedStyles.svelte +10 -3
- package/dist/components/Contour.svelte +301 -0
- package/dist/components/Contour.svelte.d.ts +48 -0
- package/dist/components/Density.svelte +146 -0
- package/dist/components/Density.svelte.d.ts +21 -0
- package/dist/components/Ellipse.svelte +485 -0
- package/dist/components/Ellipse.svelte.d.ts +89 -0
- package/dist/components/Ellipse.svelte.test.d.ts +1 -0
- package/dist/components/Ellipse.svelte.test.js +126 -0
- package/dist/components/Frame.svelte +2 -2
- package/dist/components/Grid.svelte +106 -77
- package/dist/components/Grid.svelte.d.ts +19 -4
- package/dist/components/Group.svelte +188 -65
- package/dist/components/Group.svelte.d.ts +34 -9
- package/dist/components/Group.svelte.test.d.ts +1 -0
- package/dist/components/Group.svelte.test.js +63 -0
- package/dist/components/Highlight.svelte +393 -165
- package/dist/components/Highlight.svelte.d.ts +13 -1
- package/dist/components/Hull.svelte +42 -14
- package/dist/components/Hull.svelte.d.ts +2 -2
- package/dist/components/Image.svelte +558 -0
- package/dist/components/Image.svelte.d.ts +127 -0
- package/dist/components/Image.svelte.test.d.ts +1 -0
- package/dist/components/Image.svelte.test.js +220 -0
- package/dist/components/Labels.svelte +144 -31
- package/dist/components/Labels.svelte.d.ts +24 -8
- package/dist/components/Legend.svelte +296 -84
- package/dist/components/Legend.svelte.d.ts +30 -12
- package/dist/components/Line.svelte +389 -84
- package/dist/components/Line.svelte.d.ts +46 -14
- package/dist/components/Line.svelte.test.d.ts +1 -0
- package/dist/components/Line.svelte.test.js +121 -0
- package/dist/components/LinearGradient.svelte +47 -13
- package/dist/components/Link.svelte +269 -70
- package/dist/components/Link.svelte.d.ts +69 -26
- package/dist/components/Marker.svelte +51 -27
- package/dist/components/Marker.svelte.d.ts +1 -1
- package/dist/components/Month.svelte +273 -0
- package/dist/components/Month.svelte.d.ts +70 -0
- package/dist/components/MonthPath.svelte +32 -18
- package/dist/components/MonthPath.svelte.d.ts +8 -3
- package/dist/components/MotionPath.svelte +1 -1
- package/dist/components/Path.svelte +381 -0
- package/dist/components/Path.svelte.d.ts +72 -0
- package/dist/components/Pattern.svelte +112 -15
- package/dist/components/Pattern.svelte.d.ts +3 -1
- package/dist/components/Pie.svelte +10 -10
- package/dist/components/Pie.svelte.d.ts +2 -3
- package/dist/components/Point.svelte +1 -1
- package/dist/components/Points.svelte +76 -84
- package/dist/components/Points.svelte.d.ts +7 -8
- package/dist/components/Polygon.svelte +538 -0
- package/dist/components/Polygon.svelte.d.ts +136 -0
- package/dist/components/Polygon.svelte.test.d.ts +1 -0
- package/dist/components/Polygon.svelte.test.js +121 -0
- package/dist/components/RadialGradient.svelte +16 -16
- package/dist/components/Raster.svelte +335 -0
- package/dist/components/Raster.svelte.d.ts +48 -0
- package/dist/components/Rect.svelte +659 -89
- package/dist/components/Rect.svelte.d.ts +94 -8
- package/dist/components/Rect.svelte.test.d.ts +1 -0
- package/dist/components/Rect.svelte.test.js +179 -0
- package/dist/components/RectClipPath.svelte +17 -9
- package/dist/components/RectClipPath.svelte.d.ts +8 -2
- package/dist/components/Rule.svelte +170 -78
- package/dist/components/Rule.svelte.d.ts +7 -2
- package/dist/components/Spline.svelte +189 -269
- package/dist/components/Spline.svelte.d.ts +28 -56
- package/dist/components/Text.svelte +633 -211
- package/dist/components/Text.svelte.d.ts +62 -12
- package/dist/components/Text.svelte.test.d.ts +1 -0
- package/dist/components/Text.svelte.test.js +152 -0
- package/dist/components/Threshold.svelte +6 -3
- package/dist/components/Trail.svelte +268 -0
- package/dist/components/Trail.svelte.d.ts +88 -0
- package/dist/components/TransformContext.svelte +132 -428
- package/dist/components/TransformContext.svelte.d.ts +22 -0
- package/dist/components/TransformContext.svelte.test.d.ts +1 -0
- package/dist/components/TransformContext.svelte.test.js +166 -0
- package/dist/components/Vector.svelte +399 -0
- package/dist/components/Vector.svelte.d.ts +109 -0
- package/dist/components/Violin.svelte +318 -0
- package/dist/components/Violin.svelte.d.ts +47 -0
- package/dist/components/Voronoi.svelte +53 -25
- package/dist/components/Voronoi.svelte.d.ts +9 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-full-circle--360-degree-range--1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-full-circle--360-degree-range--2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-innerRadius-of-0--pie-slice--1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-innerRadius-of-0--pie-slice--2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-negative-domain-values-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-negative-domain-values-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-partial-arc--e-g---180-degrees--1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-partial-arc--e-g---180-degrees--2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-value-at-max-domain-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-value-at-max-domain-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-value-below-domain-min-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-value-below-domain-min-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-value-exceeding-domain-max-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-value-exceeding-domain-max-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-value-of-0-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-edge-cases-should-handle-value-of-0-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-events-should-handle-pointer-enter-events-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-events-should-handle-pointer-enter-events-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-events-should-handle-pointer-move-events-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-events-should-handle-pointer-move-events-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-apply-offset-to-arc-position-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-apply-offset-to-arc-position-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-call-tooltip-hide-on-pointer-leave-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-call-tooltip-hide-on-pointer-leave-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-call-tooltip-show-on-pointer-enter-with-data-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-call-tooltip-show-on-pointer-enter-with-data-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-handle-custom-start-angle-in-range-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-handle-custom-start-angle-in-range-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-an-arc-path-with-value-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-an-arc-path-with-value-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-track-when-track-prop-is-provided-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-track-when-track-prop-is-provided-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-track-with-trackEndAngle-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-track-with-trackEndAngle-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-track-with-trackInnerRadius-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-track-with-trackInnerRadius-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-track-with-trackPadAngle-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-track-with-trackPadAngle-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-track-with-trackStartAngle-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-track-with-trackStartAngle-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-track-with-trackStartAngle-and-trackEndAngle-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-track-with-trackStartAngle-and-trackEndAngle-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-both-startAngle-and-endAngle-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-both-startAngle-and-endAngle-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-cornerRadius-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-cornerRadius-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-custom-domain-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-custom-domain-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-custom-domain-and-range-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-custom-domain-and-range-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-custom-range-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-custom-range-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-endAngle-in-radians-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-endAngle-in-radians-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-innerRadius-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-innerRadius-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-padAngle-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-padAngle-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-startAngle-in-radians-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-props-should-render-with-startAngle-in-radians-2.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-snippets-should-render-text-inner--middle--outer-Text-children-1.png +0 -0
- package/dist/components/__screenshots__/Arc.svelte.test.ts/Arc-snippets-should-render-text-inner--middle--outer-Text-children-2.png +0 -0
- package/dist/components/__screenshots__/ArcLabel.svelte.test.ts/ArcLabel-defaults-placement-to-centroid--x-y-at-the-centroid--middle-anchors--1.png +0 -0
- package/dist/components/__screenshots__/ArcLabel.svelte.test.ts/ArcLabel-defaults-placement-to-centroid--x-y-at-the-centroid--middle-anchors--2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-clear-brush-when-x-prop-changes-to--null--null--1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-clear-brush-when-x-prop-changes-to--null--null--2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-not-show-brush-when-x-prop-is-null-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-not-show-brush-when-x-prop-is-null-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-not-show-brush-when-x-prop-matches-full-domain-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-not-show-brush-when-x-prop-matches-full-domain-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-show-brush-when-x-prop-is-provided-with-a-sub-domain-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-show-brush-when-x-prop-is-provided-with-a-sub-domain-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-update-brush-width-when-x-prop-changes-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-update-brush-width-when-x-prop-changes-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-clear-brush-when-reset-programmatically-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-clear-brush-when-reset-programmatically-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-compute-correct-pixel-width-for-brush-move---1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-compute-correct-pixel-width-for-brush-move---2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-move-only-y-when-x-is-not-specified-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-move-only-y-when-x-is-not-specified-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-select-full-domain-with-selectAll-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-select-full-domain-with-selectAll-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-show-brush-when-moved-programmatically-via-context-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-show-brush-when-moved-programmatically-via-context-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-update-width-when-brush-move---is-called-again-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-update-width-when-brush-move---is-called-again-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-rendering-should-not-render-brush-UI-when-brush-is-disabled-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-rendering-should-not-render-brush-UI-when-brush-is-disabled-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-rendering-should-not-render-range-or-handles-initially-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-rendering-should-not-render-range-or-handles-initially-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-rendering-should-render-brush-context-when-brush-is-enabled-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-rendering-should-render-brush-context-when-brush-is-enabled-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-zoomOnBrush-with-onBrushEnd-should-pass-brush-domain-values-to-onBrushEnd-before-resetting-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-zoomOnBrush-with-onBrushEnd-should-pass-brush-domain-values-to-onBrushEnd-before-resetting-2.png +0 -0
- package/dist/components/__screenshots__/Circle.svelte.test.ts/Circle-data-mode-should-pass-literal-CSS-colors-through-unchanged-in-data-mode-1.png +0 -0
- package/dist/components/__screenshots__/Circle.svelte.test.ts/Circle-data-mode-should-pass-literal-CSS-colors-through-unchanged-in-data-mode-2.png +0 -0
- package/dist/components/__screenshots__/Circle.svelte.test.ts/Circle-data-mode-should-render-one-circle-per-data-item-with-string-accessors-1.png +0 -0
- package/dist/components/__screenshots__/Circle.svelte.test.ts/Circle-data-mode-should-render-one-circle-per-data-item-with-string-accessors-2.png +0 -0
- package/dist/components/__screenshots__/Circle.svelte.test.ts/Circle-data-mode-should-render-with-function-accessors-1.png +0 -0
- package/dist/components/__screenshots__/Circle.svelte.test.ts/Circle-data-mode-should-render-with-function-accessors-2.png +0 -0
- package/dist/components/__screenshots__/Circle.svelte.test.ts/Circle-data-mode-should-resolve-data-driven-fill-through-cScale-1.png +0 -0
- package/dist/components/__screenshots__/Circle.svelte.test.ts/Circle-data-mode-should-resolve-data-driven-fill-through-cScale-2.png +0 -0
- package/dist/components/__screenshots__/Circle.svelte.test.ts/Circle-data-mode-should-use-explicit-data-prop-over-chart-context-data-1.png +0 -0
- package/dist/components/__screenshots__/Circle.svelte.test.ts/Circle-data-mode-should-use-explicit-data-prop-over-chart-context-data-2.png +0 -0
- package/dist/components/__screenshots__/Circle.svelte.test.ts/Circle-pixel-mode-should-render-a-circle-with-pixel-values-1.png +0 -0
- package/dist/components/__screenshots__/Circle.svelte.test.ts/Circle-pixel-mode-should-render-a-circle-with-pixel-values-2.png +0 -0
- package/dist/components/__screenshots__/Ellipse.svelte.test.ts/Ellipse-data-mode-should-pass-literal-CSS-colors-through-unchanged-in-data-mode-1.png +0 -0
- package/dist/components/__screenshots__/Ellipse.svelte.test.ts/Ellipse-data-mode-should-pass-literal-CSS-colors-through-unchanged-in-data-mode-2.png +0 -0
- package/dist/components/__screenshots__/Ellipse.svelte.test.ts/Ellipse-data-mode-should-render-one-ellipse-per-data-item-with-string-accessors-1.png +0 -0
- package/dist/components/__screenshots__/Ellipse.svelte.test.ts/Ellipse-data-mode-should-render-one-ellipse-per-data-item-with-string-accessors-2.png +0 -0
- package/dist/components/__screenshots__/Ellipse.svelte.test.ts/Ellipse-data-mode-should-resolve-data-driven-fill-through-cScale-1.png +0 -0
- package/dist/components/__screenshots__/Ellipse.svelte.test.ts/Ellipse-data-mode-should-resolve-data-driven-fill-through-cScale-2.png +0 -0
- package/dist/components/__screenshots__/Ellipse.svelte.test.ts/Ellipse-data-mode-should-use-explicit-data-prop-over-chart-context-data-1.png +0 -0
- package/dist/components/__screenshots__/Ellipse.svelte.test.ts/Ellipse-data-mode-should-use-explicit-data-prop-over-chart-context-data-2.png +0 -0
- package/dist/components/__screenshots__/Ellipse.svelte.test.ts/Ellipse-pixel-mode-should-render-an-ellipse-with-pixel-values-1.png +0 -0
- package/dist/components/__screenshots__/Ellipse.svelte.test.ts/Ellipse-pixel-mode-should-render-an-ellipse-with-pixel-values-2.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-data-mode-should-apply-circular-clipping-in-data-mode-1.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-data-mode-should-apply-circular-clipping-in-data-mode-2.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-data-mode-should-pass-literal-URL-through-unchanged-in-data-mode-1.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-data-mode-should-pass-literal-URL-through-unchanged-in-data-mode-2.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-data-mode-should-render-one-image-per-data-item-with-string-accessors-1.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-data-mode-should-render-one-image-per-data-item-with-string-accessors-2.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-data-mode-should-render-with-function-accessors-1.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-data-mode-should-render-with-function-accessors-2.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-data-mode-should-resolve-data-driven-href-from-data-property-1.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-data-mode-should-resolve-data-driven-href-from-data-property-2.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-data-mode-should-use-explicit-data-prop-over-chart-context-data-1.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-data-mode-should-use-explicit-data-prop-over-chart-context-data-2.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-pixel-mode-should-apply-circular-clipping-when-r-is-set-1.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-pixel-mode-should-apply-circular-clipping-when-r-is-set-2.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-pixel-mode-should-apply-preserveAspectRatio-1.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-pixel-mode-should-apply-preserveAspectRatio-2.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-pixel-mode-should-apply-rotation-1.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-pixel-mode-should-apply-rotation-2.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-pixel-mode-should-default-width-and-height-to-16-1.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-pixel-mode-should-default-width-and-height-to-16-2.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-pixel-mode-should-render-an-image-with-pixel-values-1.png +0 -0
- package/dist/components/__screenshots__/Image.svelte.test.ts/Image-pixel-mode-should-render-an-image-with-pixel-values-2.png +0 -0
- package/dist/components/__screenshots__/Line.svelte.test.ts/Line-data-mode-should-pass-literal-CSS-colors-through-unchanged-in-data-mode-1.png +0 -0
- package/dist/components/__screenshots__/Line.svelte.test.ts/Line-data-mode-should-pass-literal-CSS-colors-through-unchanged-in-data-mode-2.png +0 -0
- package/dist/components/__screenshots__/Line.svelte.test.ts/Line-data-mode-should-render-one-line-per-data-item-with-string-accessors-1.png +0 -0
- package/dist/components/__screenshots__/Line.svelte.test.ts/Line-data-mode-should-render-one-line-per-data-item-with-string-accessors-2.png +0 -0
- package/dist/components/__screenshots__/Line.svelte.test.ts/Line-data-mode-should-resolve-data-driven-stroke-through-cScale-1.png +0 -0
- package/dist/components/__screenshots__/Line.svelte.test.ts/Line-data-mode-should-resolve-data-driven-stroke-through-cScale-2.png +0 -0
- package/dist/components/__screenshots__/Line.svelte.test.ts/Line-data-mode-should-use-explicit-data-prop-over-chart-context-data-1.png +0 -0
- package/dist/components/__screenshots__/Line.svelte.test.ts/Line-data-mode-should-use-explicit-data-prop-over-chart-context-data-2.png +0 -0
- package/dist/components/__screenshots__/Line.svelte.test.ts/Line-pixel-mode-should-render-a-line-with-pixel-values-1.png +0 -0
- package/dist/components/__screenshots__/Line.svelte.test.ts/Line-pixel-mode-should-render-a-line-with-pixel-values-2.png +0 -0
- package/dist/components/__screenshots__/Polygon.svelte.test.ts/Polygon-data-mode-should-pass-literal-CSS-colors-through-unchanged-in-data-mode-1.png +0 -0
- package/dist/components/__screenshots__/Polygon.svelte.test.ts/Polygon-data-mode-should-pass-literal-CSS-colors-through-unchanged-in-data-mode-2.png +0 -0
- package/dist/components/__screenshots__/Polygon.svelte.test.ts/Polygon-data-mode-should-render-one-polygon-per-data-item-with-string-accessors-1.png +0 -0
- package/dist/components/__screenshots__/Polygon.svelte.test.ts/Polygon-data-mode-should-render-one-polygon-per-data-item-with-string-accessors-2.png +0 -0
- package/dist/components/__screenshots__/Polygon.svelte.test.ts/Polygon-data-mode-should-resolve-data-driven-fill-through-cScale-1.png +0 -0
- package/dist/components/__screenshots__/Polygon.svelte.test.ts/Polygon-data-mode-should-resolve-data-driven-fill-through-cScale-2.png +0 -0
- package/dist/components/__screenshots__/Polygon.svelte.test.ts/Polygon-data-mode-should-use-explicit-data-prop-over-chart-context-data-1.png +0 -0
- package/dist/components/__screenshots__/Polygon.svelte.test.ts/Polygon-data-mode-should-use-explicit-data-prop-over-chart-context-data-2.png +0 -0
- package/dist/components/__screenshots__/Polygon.svelte.test.ts/Polygon-pixel-mode-should-render-a-polygon-with-pixel-values-1.png +0 -0
- package/dist/components/__screenshots__/Polygon.svelte.test.ts/Polygon-pixel-mode-should-render-a-polygon-with-pixel-values-2.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-data-mode---colors-should-pass-literal-CSS-colors-through-unchanged-in-data-mode-1.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-data-mode---colors-should-pass-literal-CSS-colors-through-unchanged-in-data-mode-2.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-data-mode---colors-should-resolve-data-driven-fill-through-cScale-1.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-data-mode---colors-should-resolve-data-driven-fill-through-cScale-2.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-data-mode---edge-based-should-render-rects-from-edge-props-1.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-data-mode---edge-based-should-render-rects-from-edge-props-2.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-data-mode---edge-based-should-render-rects-with-insets-1.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-data-mode---edge-based-should-render-rects-with-insets-2.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-data-mode---edge-based-should-use-explicit-data-prop-over-chart-context-data-1.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-data-mode---edge-based-should-use-explicit-data-prop-over-chart-context-data-2.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-data-mode---standard-should-render-one-rect-per-data-item-with-string-accessors-1.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-data-mode---standard-should-render-one-rect-per-data-item-with-string-accessors-2.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-pixel-mode-should-render-a-rect-with-pixel-values-1.png +0 -0
- package/dist/components/__screenshots__/Rect.svelte.test.ts/Rect-pixel-mode-should-render-a-rect-with-pixel-values-2.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-data-mode-should-pass-literal-CSS-colors-through-unchanged-in-data-mode-1.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-data-mode-should-pass-literal-CSS-colors-through-unchanged-in-data-mode-2.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-data-mode-should-render-one-text-per-data-item-with-string-accessors-1.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-data-mode-should-render-one-text-per-data-item-with-string-accessors-2.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-data-mode-should-resolve-data-driven-fill-through-cScale-1.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-data-mode-should-resolve-data-driven-fill-through-cScale-2.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-data-mode-should-resolve-value-as-data-property-name-in-data-mode-1.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-data-mode-should-resolve-value-as-data-property-name-in-data-mode-2.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-data-mode-should-use-explicit-data-prop-over-chart-context-data-1.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-data-mode-should-use-explicit-data-prop-over-chart-context-data-2.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-pixel-mode-should-preserve-CSS-like-string-values-as-SVG-values-1.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-pixel-mode-should-preserve-CSS-like-string-values-as-SVG-values-2.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-pixel-mode-should-render-text-with-pixel-values-1.png +0 -0
- package/dist/components/__screenshots__/Text.svelte.test.ts/Text-pixel-mode-should-render-text-with-pixel-values-2.png +0 -0
- package/dist/components/charts/ArcChart.svelte +192 -225
- package/dist/components/charts/ArcChart.svelte.d.ts +55 -18
- package/dist/components/charts/ArcChart.svelte.test.d.ts +1 -0
- package/dist/components/charts/ArcChart.svelte.test.js +24 -0
- package/dist/components/charts/AreaChart.svelte +88 -526
- package/dist/components/charts/AreaChart.svelte.d.ts +36 -37
- package/dist/components/charts/AreaChart.svelte.test.d.ts +1 -0
- package/dist/components/charts/AreaChart.svelte.test.js +154 -0
- package/dist/components/charts/BarChart.svelte +130 -507
- package/dist/components/charts/BarChart.svelte.d.ts +39 -32
- package/dist/components/charts/BarChart.svelte.test.d.ts +1 -0
- package/dist/components/charts/BarChart.svelte.test.js +454 -0
- package/dist/components/charts/BarChartFixedWidthTest.svelte +47 -0
- package/dist/components/charts/BarChartFixedWidthTest.svelte.d.ts +11 -0
- package/dist/components/charts/ChartAnnotations.svelte +8 -7
- package/dist/components/charts/ChartAnnotations.svelte.d.ts +1 -3
- package/dist/components/charts/DefaultTooltip.svelte +109 -35
- package/dist/components/charts/DefaultTooltip.svelte.d.ts +2 -4
- package/dist/components/charts/DefaultTooltip.svelte.test.d.ts +1 -0
- package/dist/components/charts/DefaultTooltip.svelte.test.js +242 -0
- package/dist/components/charts/LineChart.svelte +96 -430
- package/dist/components/charts/LineChart.svelte.bench.d.ts +1 -0
- package/dist/components/charts/LineChart.svelte.bench.js +189 -0
- package/dist/components/charts/LineChart.svelte.d.ts +36 -31
- package/dist/components/charts/LineChart.svelte.test.d.ts +1 -0
- package/dist/components/charts/LineChart.svelte.test.js +48 -0
- package/dist/components/charts/PieChart.svelte +337 -362
- package/dist/components/charts/PieChart.svelte.d.ts +72 -33
- package/dist/components/charts/PieChart.svelte.test.d.ts +1 -0
- package/dist/components/charts/PieChart.svelte.test.js +36 -0
- package/dist/components/charts/ScatterChart.svelte +53 -376
- package/dist/components/charts/ScatterChart.svelte.d.ts +27 -23
- package/dist/components/charts/__fixtures__/ArcChartTooltip.svelte +39 -0
- package/dist/{docs/Blockquote.svelte.d.ts → components/charts/__fixtures__/ArcChartTooltip.svelte.d.ts} +4 -6
- package/dist/components/charts/__screenshots__/AreaChart.svelte.test.ts/AreaChart-basic-should-render-multiple-area-paths-for-each-series-1.png +0 -0
- package/dist/components/charts/__screenshots__/AreaChart.svelte.test.ts/AreaChart-basic-should-render-multiple-area-paths-for-each-series-2.png +0 -0
- package/dist/components/charts/__screenshots__/AreaChart.svelte.test.ts/AreaChart-basic-should-render-multiple-area-paths-for-each-series-with-separate-data-1.png +0 -0
- package/dist/components/charts/__screenshots__/AreaChart.svelte.test.ts/AreaChart-basic-should-render-multiple-area-paths-for-each-series-with-separate-data-2.png +0 -0
- package/dist/components/charts/__screenshots__/AreaChart.svelte.test.ts/AreaChart-basic-should-render-multiple-area-paths-for-each-series-with-separate-data-and-stack-layout-1.png +0 -0
- package/dist/components/charts/__screenshots__/AreaChart.svelte.test.ts/AreaChart-basic-should-render-multiple-area-paths-for-each-series-with-separate-data-and-stack-layout-2.png +0 -0
- package/dist/components/charts/__screenshots__/AreaChart.svelte.test.ts/AreaChart-basic-should-render-with-single-series-when-no-series-prop-provided-1.png +0 -0
- package/dist/components/charts/__screenshots__/AreaChart.svelte.test.ts/AreaChart-basic-should-render-with-single-series-when-no-series-prop-provided-2.png +0 -0
- package/dist/components/charts/__screenshots__/AreaChart.svelte.test.ts/AreaChart-series-layout-should-render-with-overlap-layout-1.png +0 -0
- package/dist/components/charts/__screenshots__/AreaChart.svelte.test.ts/AreaChart-series-layout-should-render-with-overlap-layout-2.png +0 -0
- package/dist/components/charts/__screenshots__/AreaChart.svelte.test.ts/AreaChart-series-layout-should-render-with-stack-layout-1.png +0 -0
- package/dist/components/charts/__screenshots__/AreaChart.svelte.test.ts/AreaChart-series-layout-should-render-with-stack-layout-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-basic-should-render-horizontal-bars-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-basic-should-render-horizontal-bars-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-basic-should-render-vertical-bars-without-NaN-attributes-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-basic-should-render-vertical-bars-without-NaN-attributes-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-basic-should-render-with-default-series-when-no-series-prop-provided-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-basic-should-render-with-default-series-when-no-series-prop-provided-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-fixed-width-height-should-center-fixed-width-bars-within-their-band-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-fixed-width-height-should-center-fixed-width-bars-within-their-band-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-fixed-width-height-should-render-horizontal-bars-with-fixed-height-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-fixed-width-height-should-render-horizontal-bars-with-fixed-height-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-fixed-width-height-should-render-vertical-bars-with-fixed-width-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-fixed-width-height-should-render-vertical-bars-with-fixed-width-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-legend-series-toggle-adjusts-group-scale-should-adjust-grouped-bar-widths-when-series-are-toggled-via-legend-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-legend-series-toggle-adjusts-group-scale-should-adjust-grouped-bar-widths-when-series-are-toggled-via-legend-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-no-series-prop--transition-example-pattern--should-render-without-series-prop-and-not-produce-NaN-rect-attributes-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-no-series-prop--transition-example-pattern--should-render-without-series-prop-and-not-produce-NaN-rect-attributes-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-separate-data-per-series-should-render-overlapping-series-with-separate-data-arrays-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-separate-data-per-series-should-render-overlapping-series-with-separate-data-arrays-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-separate-data-per-series-should-render-stacked-series-with-separate-data-arrays-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-separate-data-per-series-should-render-stacked-series-with-separate-data-arrays-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-should-render-grouped-series-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-should-render-grouped-series-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-should-render-multiple-Bars-groups-for-each-series-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-should-render-multiple-Bars-groups-for-each-series-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-should-render-stackDiverging-series-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-should-render-stackDiverging-series-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-should-render-stackExpand-series-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-should-render-stackExpand-series-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-should-render-stacked-series-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-should-render-stacked-series-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-should-render-stacked-series-horizontally-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-should-render-stacked-series-horizontally-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-stackDiverging-edge-rounding-should-round-both-tips-when-there-is-one-positive-and-one-negative-series-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-stackDiverging-edge-rounding-should-round-both-tips-when-there-is-one-positive-and-one-negative-series-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-stackDiverging-edge-rounding-should-round-the-tip-of-each-direction--not-inner-layers-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-stackDiverging-edge-rounding-should-round-the-tip-of-each-direction--not-inner-layers-2.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-tooltip-should-use-explicit-series-colors--not-color-scale-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-series-tooltip-should-use-explicit-series-colors--not-color-scale-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-fade-non-highlighted-tooltip-series-items-on-hover-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-fade-non-highlighted-tooltip-series-items-on-hover-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-show-header-and-all-series-items-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-show-header-and-all-series-items-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-show-series-colors-in-tooltip-items-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-show-series-colors-in-tooltip-items-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-show-single-series-without-total-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-show-single-series-without-total-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-LineChart--multi-series--quadtree-x-mode--should-show-header-and-all-series-items-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-LineChart--multi-series--quadtree-x-mode--should-show-header-and-all-series-items-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-ScatterChart--single-point--quadtree-mode--should-show-series-header-for-multi-series-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-ScatterChart--single-point--quadtree-mode--should-show-series-header-for-multi-series-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-ScatterChart--single-point--quadtree-mode--should-show-x--y--and-r-items-when-r-is-configured-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-ScatterChart--single-point--quadtree-mode--should-show-x--y--and-r-items-when-r-is-configured-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-ScatterChart--single-point--quadtree-mode--should-show-x-and-y-items-in-tooltip-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-ScatterChart--single-point--quadtree-mode--should-show-x-and-y-items-in-tooltip-2.png +0 -0
- package/dist/components/charts/__screenshots__/LineChart.svelte.test.ts/LineChart-tooltip-should-prefer-cScale-color-over-default-series-color-when-cScale-is-explicitly-provided-1.png +0 -0
- package/dist/components/charts/__screenshots__/LineChart.svelte.test.ts/LineChart-tooltip-should-prefer-cScale-color-over-default-series-color-when-cScale-is-explicitly-provided-2.png +0 -0
- package/dist/components/charts/__screenshots__/PieChart.svelte.test.ts/PieChart-uses-hovered-slice-identity-for-implicit-tooltip-series-1.png +0 -0
- package/dist/components/charts/__screenshots__/PieChart.svelte.test.ts/PieChart-uses-hovered-slice-identity-for-implicit-tooltip-series-2.png +0 -0
- package/dist/components/charts/types.d.ts +6 -211
- package/dist/components/{ForceSimulation.svelte → force/ForceSimulation.svelte} +184 -50
- package/dist/components/force/ForceSimulation.svelte.d.ts +158 -0
- package/dist/components/force/index.d.ts +2 -0
- package/dist/components/force/index.js +2 -0
- package/dist/components/{GeoCircle.svelte → geo/GeoCircle.svelte} +3 -3
- package/dist/components/{GeoCircle.svelte.d.ts → geo/GeoCircle.svelte.d.ts} +1 -1
- package/dist/components/geo/GeoClipPath.svelte +72 -0
- package/dist/components/geo/GeoClipPath.svelte.d.ts +35 -0
- package/dist/components/{GeoEdgeFade.svelte → geo/GeoEdgeFade.svelte} +7 -8
- package/dist/components/{GeoEdgeFade.svelte.d.ts → geo/GeoEdgeFade.svelte.d.ts} +2 -2
- package/dist/components/geo/GeoLegend.svelte +433 -0
- package/dist/components/geo/GeoLegend.svelte.d.ts +117 -0
- package/dist/components/geo/GeoPath.svelte +161 -0
- package/dist/components/{GeoPath.svelte.d.ts → geo/GeoPath.svelte.d.ts} +7 -7
- package/dist/components/geo/GeoPoint.svelte +105 -0
- package/dist/components/{GeoPoint.svelte.d.ts → geo/GeoPoint.svelte.d.ts} +2 -2
- package/dist/components/geo/GeoProjection.svelte +30 -0
- package/dist/components/geo/GeoProjection.svelte.d.ts +8 -0
- package/dist/components/geo/GeoRaster.svelte +311 -0
- package/dist/components/geo/GeoRaster.svelte.d.ts +61 -0
- package/dist/components/geo/GeoSpline.svelte +78 -0
- package/dist/components/{GeoSpline.svelte.d.ts → geo/GeoSpline.svelte.d.ts} +4 -4
- package/dist/components/{GeoTile.svelte → geo/GeoTile.svelte} +18 -15
- package/dist/components/{GeoTile.svelte.d.ts → geo/GeoTile.svelte.d.ts} +1 -1
- package/dist/components/{GeoVisible.svelte → geo/GeoVisible.svelte} +4 -4
- package/dist/components/{Graticule.svelte → geo/Graticule.svelte} +11 -14
- package/dist/components/{Graticule.svelte.d.ts → geo/Graticule.svelte.d.ts} +3 -2
- package/dist/components/{TileImage.svelte → geo/TileImage.svelte} +22 -7
- package/dist/components/{TileImage.svelte.d.ts → geo/TileImage.svelte.d.ts} +1 -1
- package/dist/components/geo/index.d.ts +26 -0
- package/dist/components/geo/index.js +26 -0
- package/dist/components/graph/Chord.svelte +114 -0
- package/dist/components/graph/Chord.svelte.d.ts +53 -0
- package/dist/components/{Dagre.svelte → graph/Dagre.svelte} +6 -1
- package/dist/components/graph/Ribbon.svelte +141 -0
- package/dist/components/graph/Ribbon.svelte.d.ts +51 -0
- package/dist/components/{Sankey.svelte → graph/Sankey.svelte} +1 -3
- package/dist/components/graph/index.d.ts +8 -0
- package/dist/components/graph/index.js +8 -0
- package/dist/components/{Pack.svelte → hierarchy/Pack.svelte} +4 -6
- package/dist/components/{Pack.svelte.d.ts → hierarchy/Pack.svelte.d.ts} +12 -7
- package/dist/components/{Partition.svelte → hierarchy/Partition.svelte} +4 -3
- package/dist/components/{Partition.svelte.d.ts → hierarchy/Partition.svelte.d.ts} +12 -4
- package/dist/components/{Tree.svelte → hierarchy/Tree.svelte} +11 -6
- package/dist/components/{Tree.svelte.d.ts → hierarchy/Tree.svelte.d.ts} +12 -4
- package/dist/components/hierarchy/Treemap.svelte +203 -0
- package/dist/components/{Treemap.svelte.d.ts → hierarchy/Treemap.svelte.d.ts} +23 -15
- package/dist/components/hierarchy/index.d.ts +8 -0
- package/dist/components/hierarchy/index.js +8 -0
- package/dist/components/index.d.ts +41 -47
- package/dist/components/index.js +41 -48
- package/dist/components/layers/Canvas.svelte +502 -0
- package/dist/components/{layout → layers}/Canvas.svelte.d.ts +17 -37
- package/dist/components/{layout → layers}/Html.svelte +34 -16
- package/dist/components/{layout → layers}/Html.svelte.d.ts +7 -0
- package/dist/components/layers/Layer.svelte +85 -0
- package/dist/components/layers/Layer.svelte.d.ts +23 -0
- package/dist/components/{layout → layers}/Svg.svelte +38 -18
- package/dist/components/{layout → layers}/Svg.svelte.d.ts +7 -0
- package/dist/components/{layout → layers}/WebGL.svelte +27 -7
- package/dist/components/{layout → layers}/WebGL.svelte.d.ts +8 -5
- package/dist/components/tests/BrushTestHarness.svelte +27 -0
- package/dist/components/tests/BrushTestHarness.svelte.d.ts +8 -0
- package/dist/components/tests/TestHarness.svelte +87 -0
- package/dist/components/tests/TestHarness.svelte.d.ts +21 -0
- package/dist/components/tests/TransformTestHarness.svelte +27 -0
- package/dist/components/tests/TransformTestHarness.svelte.d.ts +8 -0
- package/dist/components/tooltip/Tooltip.svelte +239 -93
- package/dist/components/tooltip/Tooltip.svelte.d.ts +28 -14
- package/dist/components/tooltip/Tooltip.svelte.test.d.ts +1 -0
- package/dist/components/tooltip/Tooltip.svelte.test.js +294 -0
- package/dist/components/tooltip/TooltipContext.svelte +440 -243
- package/dist/components/tooltip/TooltipContext.svelte.d.ts +37 -21
- package/dist/components/tooltip/TooltipHeader.svelte +32 -18
- package/dist/components/tooltip/TooltipHeader.svelte.d.ts +3 -3
- package/dist/components/tooltip/TooltipItem.svelte +57 -37
- package/dist/components/tooltip/TooltipItem.svelte.d.ts +3 -3
- package/dist/components/tooltip/TooltipList.svelte +12 -10
- package/dist/components/tooltip/TooltipSeparator.svelte +18 -10
- package/dist/components/tooltip/__screenshots__/Tooltip.svelte.test.ts/Tooltip-portal-should-portal-tooltip-to-a-custom-selector-target-1.png +0 -0
- package/dist/components/tooltip/__screenshots__/Tooltip.svelte.test.ts/Tooltip-portal-should-portal-tooltip-to-a-custom-selector-target-2.png +0 -0
- package/dist/components/tooltip/__screenshots__/Tooltip.svelte.test.ts/Tooltip-portal-should-render-tooltip-inline-when-portal-is-false-1.png +0 -0
- package/dist/components/tooltip/__screenshots__/Tooltip.svelte.test.ts/Tooltip-portal-should-render-tooltip-inline-when-portal-is-false-2.png +0 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/contexts/canvas.d.ts +34 -0
- package/dist/contexts/canvas.js +14 -0
- package/dist/contexts/chart.d.ts +6 -0
- package/dist/contexts/chart.js +50 -0
- package/dist/contexts/componentTree.test.d.ts +1 -0
- package/dist/contexts/componentTree.test.js +83 -0
- package/dist/contexts/geo.d.ts +4 -0
- package/dist/contexts/geo.js +11 -0
- package/dist/contexts/index.d.ts +5 -0
- package/dist/contexts/index.js +5 -0
- package/dist/contexts/layer.d.ts +3 -0
- package/dist/contexts/layer.js +8 -0
- package/dist/contexts/settings.d.ts +4 -0
- package/dist/contexts/settings.js +10 -0
- package/dist/contexts/transform.d.ts +96 -0
- package/dist/contexts/transform.js +10 -0
- package/dist/force.d.ts +1 -0
- package/dist/force.js +1 -0
- package/dist/geo.d.ts +1 -0
- package/dist/geo.js +1 -0
- package/dist/graph.d.ts +1 -0
- package/dist/graph.js +1 -0
- package/dist/hierarchy.d.ts +1 -0
- package/dist/hierarchy.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/server/ContextCapture.svelte +30 -0
- package/dist/server/ContextCapture.svelte.d.ts +8 -0
- package/dist/server/ServerChart.svelte +26 -0
- package/dist/server/ServerChart.svelte.d.ts +11 -0
- package/dist/server/TestBarChart.svelte +35 -0
- package/dist/server/TestBarChart.svelte.d.ts +14 -0
- package/dist/server/TestLineChart.svelte +35 -0
- package/dist/server/TestLineChart.svelte.d.ts +14 -0
- package/dist/server/captureStore.d.ts +8 -0
- package/dist/server/captureStore.js +18 -0
- package/dist/server/index.d.ts +137 -0
- package/dist/server/index.js +141 -0
- package/dist/server/renderChart.ssr.test.d.ts +1 -0
- package/dist/server/renderChart.ssr.test.js +205 -0
- package/dist/server/renderTree.d.ts +8 -0
- package/dist/server/renderTree.js +29 -0
- package/dist/states/__fixtures__/ComponentNodeLifecycleChild.svelte +13 -0
- package/dist/{docs/Json.svelte.d.ts → states/__fixtures__/ComponentNodeLifecycleChild.svelte.d.ts} +4 -8
- package/dist/states/__fixtures__/ComponentNodeLifecycleHarness.svelte +48 -0
- package/dist/states/__fixtures__/ComponentNodeLifecycleHarness.svelte.d.ts +8 -0
- package/dist/states/__fixtures__/ComponentNodeLifecycleParent.svelte +26 -0
- package/dist/states/__fixtures__/ComponentNodeLifecycleParent.svelte.d.ts +9 -0
- package/dist/states/__screenshots__/chart.component-node.svelte.test.ts/ChartState-registerComponent-cleans-up-child-nodes-and-mark-registrations-when-components-unmount-1.png +0 -0
- package/dist/states/__screenshots__/chart.component-node.svelte.test.ts/ChartState-registerComponent-cleans-up-child-nodes-and-mark-registrations-when-components-unmount-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-baseline-domain-multi-series-should-work-without-baseline--no-forced-0--1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-baseline-domain-multi-series-should-work-without-baseline--no-forced-0--2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-degenerate-domain-should-expand-degenerate-y-domain--5--5--to--5--6--1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-degenerate-domain-should-expand-degenerate-y-domain--5--5--to--5--6--2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-geo-projection-skips-markInfo-should-not-derive-x-y-accessors-from-marks-when-geo-projection-is-active-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-geo-projection-skips-markInfo-should-not-derive-x-y-accessors-from-marks-when-geo-projection-is-active-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-implicit-series-domain-update-on-visibility-toggle-should-update-y-domain-when-hiding-an-explicit-series-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-implicit-series-domain-update-on-visibility-toggle-should-update-y-domain-when-hiding-an-explicit-series-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-implicit-series-domain-update-on-visibility-toggle-should-update-y-domain-when-hiding-an-implicit-series-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-implicit-series-domain-update-on-visibility-toggle-should-update-y-domain-when-hiding-an-implicit-series-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-implicit-x-y-from-marks--no-x-y-on-Chart--should-deduplicate-repeated-mark-x-keys-into-a-single-accessor-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-implicit-x-y-from-marks--no-x-y-on-Chart--should-deduplicate-repeated-mark-x-keys-into-a-single-accessor-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-implicit-x-y-from-marks--no-x-y-on-Chart--should-derive-correct-y-domain-across-two-marks-with-different-data-and-no-y-prop-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-implicit-x-y-from-marks--no-x-y-on-Chart--should-derive-correct-y-domain-across-two-marks-with-different-data-and-no-y-prop-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-implicit-x-y-from-marks--no-x-y-on-Chart--should-derive-x-accessor-from-marks-when-x-prop-is-absent-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-implicit-x-y-from-marks--no-x-y-on-Chart--should-derive-x-accessor-from-marks-when-x-prop-is-absent-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-aggregate-y-accessor-from-implicit-series-into-resolveAccessor-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-aggregate-y-accessor-from-implicit-series-into-resolveAccessor-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-calculate-correct-y-domain-from-two-marks-with-same-y-accessor-but-different-data-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-calculate-correct-y-domain-from-two-marks-with-same-y-accessor-but-different-data-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-deduplicate-implicit-series-with-the-same-key-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-deduplicate-implicit-series-with-the-same-key-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-generate-implicit-series-from-marks-with-seriesKey-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-generate-implicit-series-from-marks-with-seriesKey-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-generate-implicit-series-from-marks-with-string-y-accessors-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-generate-implicit-series-from-marks-with-string-y-accessors-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-generate-implicit-series-from-x-accessor-for-vertical-charts--valueAxis-x--1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-generate-implicit-series-from-x-accessor-for-vertical-charts--valueAxis-x--2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-include-data-from-two-marks-with-same-y-accessor-but-different-data-arrays-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-include-data-from-two-marks-with-same-y-accessor-but-different-data-arrays-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-include-implicit-series-label-when-provided-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-include-implicit-series-label-when-provided-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-include-mark-data-in-flatData-for-domain-calculation-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-include-mark-data-in-flatData-for-domain-calculation-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-include-per-mark-data-in-domain-via-implicit-series-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-include-per-mark-data-in-domain-via-implicit-series-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-not-double-include-data-when-mark-data-matches-series-data-reference-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-not-double-include-data-when-mark-data-matches-series-data-reference-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-register-and-unregister-marks-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-register-and-unregister-marks-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-revert-flatData-after-all-marks-unregister-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-revert-flatData-after-all-marks-unregister-2.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-skip-marks-without-a-derivable-key-for-implicit-series-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-mark-registration-should-skip-marks-without-a-derivable-key-for-implicit-series-2.png +0 -0
- package/dist/states/__screenshots__/series.svelte.test.ts/SeriesState-visibility-should-allow-toggling-after-initial-selected--false-1.png +0 -0
- package/dist/states/__screenshots__/series.svelte.test.ts/SeriesState-visibility-should-allow-toggling-after-initial-selected--false-2.png +0 -0
- package/dist/states/__screenshots__/series.svelte.test.ts/SeriesState-visibility-should-respect-selected--false-on-series-items-1.png +0 -0
- package/dist/states/__screenshots__/series.svelte.test.ts/SeriesState-visibility-should-respect-selected--false-on-series-items-2.png +0 -0
- package/dist/states/brush.svelte.d.ts +99 -0
- package/dist/states/brush.svelte.js +249 -0
- package/dist/states/brush.svelte.test.d.ts +1 -0
- package/dist/states/brush.svelte.test.js +417 -0
- package/dist/states/chart.component-node.svelte.test.d.ts +1 -0
- package/dist/states/chart.component-node.svelte.test.js +28 -0
- package/dist/states/chart.svelte.d.ts +264 -0
- package/dist/states/chart.svelte.js +1092 -0
- package/dist/states/chart.svelte.test.d.ts +1 -0
- package/dist/states/chart.svelte.test.js +1635 -0
- package/dist/states/geo.svelte.d.ts +49 -0
- package/dist/states/geo.svelte.js +97 -0
- package/dist/states/series.svelte.d.ts +83 -0
- package/dist/states/series.svelte.js +248 -0
- package/dist/states/series.svelte.test.d.ts +1 -0
- package/dist/states/series.svelte.test.js +333 -0
- package/dist/states/settings.svelte.d.ts +12 -0
- package/dist/states/settings.svelte.js +10 -0
- package/dist/states/tooltip.svelte.d.ts +22 -0
- package/dist/states/tooltip.svelte.js +16 -0
- package/dist/states/transform.svelte.d.ts +175 -0
- package/dist/states/transform.svelte.js +408 -0
- package/dist/styles/daisyui-5.css +6 -0
- package/dist/styles/shadcn-svelte.css +11 -0
- package/dist/styles/skeleton-3.css +15 -0
- package/dist/styles/skeleton-4.css +15 -0
- package/dist/utils/__screenshots__/canvas.svelte.test.ts/clearCanvasContext-clears-with-zero-padding--no-offset--1.png +0 -0
- package/dist/utils/__screenshots__/canvas.svelte.test.ts/clearCanvasContext-clears-with-zero-padding--no-offset--2.png +0 -0
- package/dist/utils/__screenshots__/canvas.svelte.test.ts/renderPathData-composes-element-opacity-with-inherited-globalAlpha--Group-opacity--1.png +0 -0
- package/dist/utils/__screenshots__/canvas.svelte.test.ts/renderPathData-composes-element-opacity-with-inherited-globalAlpha--Group-opacity--2.png +0 -0
- package/dist/utils/__screenshots__/canvas.svelte.test.ts/renderPathData-inline-style-overrides-styles-object-1.png +0 -0
- package/dist/utils/__screenshots__/canvas.svelte.test.ts/renderPathData-inline-style-overrides-styles-object-2.png +0 -0
- package/dist/utils/arcText.svelte.d.ts +8 -2
- package/dist/utils/arcText.svelte.js +12 -8
- package/dist/utils/array.d.ts +11 -0
- package/dist/utils/array.js +23 -0
- package/dist/utils/array.test.d.ts +1 -0
- package/dist/utils/array.test.js +200 -0
- package/dist/utils/attributes.d.ts +3 -13
- package/dist/utils/attributes.js +4 -18
- package/dist/utils/canvas.d.ts +85 -0
- package/dist/utils/canvas.js +238 -56
- package/dist/utils/canvas.svelte.test.d.ts +1 -0
- package/dist/utils/canvas.svelte.test.js +758 -0
- package/dist/utils/chart.js +8 -0
- package/dist/utils/color.js +11 -8
- package/dist/utils/common.d.ts +19 -3
- package/dist/utils/common.js +29 -10
- package/dist/utils/common.test.js +35 -1
- package/dist/utils/dataProp.d.ts +112 -0
- package/dist/utils/dataProp.js +125 -0
- package/dist/utils/dataProp.test.d.ts +1 -0
- package/dist/utils/dataProp.test.js +128 -0
- package/dist/utils/download.d.ts +98 -0
- package/dist/utils/download.js +250 -0
- package/dist/utils/genData.d.ts +22 -8
- package/dist/utils/genData.js +34 -14
- package/dist/utils/graph/dagre.js +6 -8
- package/dist/utils/graph/sankey.js +9 -7
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/linkUtils.d.ts +42 -0
- package/dist/utils/linkUtils.js +280 -0
- package/dist/utils/math.d.ts +17 -0
- package/dist/utils/math.js +17 -0
- package/dist/utils/motion.svelte.d.ts +26 -2
- package/dist/utils/motion.svelte.js +99 -2
- package/dist/utils/motion.test.js +49 -1
- package/dist/utils/path.d.ts +73 -1
- package/dist/utils/path.js +219 -17
- package/dist/utils/rasterBounds.d.ts +18 -0
- package/dist/utils/rasterBounds.js +98 -0
- package/dist/utils/rasterBounds.test.d.ts +1 -0
- package/dist/utils/rasterBounds.test.js +63 -0
- package/dist/utils/rasterInterpolate.d.ts +11 -0
- package/dist/utils/rasterInterpolate.js +103 -0
- package/dist/utils/rect.svelte.d.ts +29 -4
- package/dist/utils/rect.svelte.js +120 -7
- package/dist/utils/scales.svelte.d.ts +10 -4
- package/dist/utils/scales.svelte.js +60 -13
- package/dist/utils/scales.svelte.test.d.ts +1 -0
- package/dist/utils/scales.svelte.test.js +67 -0
- package/dist/utils/shape.d.ts +43 -0
- package/dist/utils/shape.js +59 -0
- package/dist/utils/stack.js +1 -1
- package/dist/utils/stats.d.ts +33 -0
- package/dist/utils/stats.js +79 -0
- package/dist/utils/string.d.ts +51 -0
- package/dist/utils/string.js +4 -2
- package/dist/utils/ticks.d.ts +15 -4
- package/dist/utils/ticks.js +147 -162
- package/dist/utils/ticks.test.js +26 -26
- package/dist/utils/trail.d.ts +36 -0
- package/dist/utils/trail.js +340 -0
- package/dist/utils/treemap.d.ts +1 -1
- package/dist/utils/types.d.ts +28 -2
- package/package.json +78 -57
- package/README.md +0 -41
- package/dist/components/Connector.svelte +0 -149
- package/dist/components/Connector.svelte.d.ts +0 -51
- package/dist/components/ForceSimulation.svelte.d.ts +0 -84
- package/dist/components/GeoContext.svelte +0 -176
- package/dist/components/GeoContext.svelte.d.ts +0 -52
- package/dist/components/GeoPath.svelte +0 -197
- package/dist/components/GeoPoint.svelte +0 -74
- package/dist/components/GeoSpline.svelte +0 -85
- package/dist/components/TransformControls.svelte +0 -179
- package/dist/components/TransformControls.svelte.d.ts +0 -28
- package/dist/components/Treemap.svelte +0 -165
- package/dist/components/charts/utils.svelte.d.ts +0 -30
- package/dist/components/charts/utils.svelte.js +0 -59
- package/dist/components/layout/Canvas.svelte +0 -505
- package/dist/components/layout/Layer.svelte +0 -39
- package/dist/components/layout/Layer.svelte.d.ts +0 -17
- package/dist/components/tooltip/tooltipMetaContext.d.ts +0 -79
- package/dist/components/tooltip/tooltipMetaContext.js +0 -139
- package/dist/docs/Blockquote.svelte +0 -15
- package/dist/docs/Code.svelte +0 -38
- package/dist/docs/Code.svelte.d.ts +0 -29
- package/dist/docs/ConnectorSweepMenuField.svelte +0 -17
- package/dist/docs/ConnectorSweepMenuField.svelte.d.ts +0 -7
- package/dist/docs/ConnectorTypeMenuField.svelte +0 -17
- package/dist/docs/ConnectorTypeMenuField.svelte.d.ts +0 -7
- package/dist/docs/CurveMenuField.svelte +0 -44
- package/dist/docs/CurveMenuField.svelte.d.ts +0 -9
- package/dist/docs/GeoDebug.svelte +0 -60
- package/dist/docs/GeoDebug.svelte.d.ts +0 -4
- package/dist/docs/Header1.svelte +0 -14
- package/dist/docs/Header1.svelte.d.ts +0 -29
- package/dist/docs/Json.svelte +0 -28
- package/dist/docs/Layout.svelte +0 -18
- package/dist/docs/Layout.svelte.d.ts +0 -23
- package/dist/docs/Link.svelte +0 -5
- package/dist/docs/Link.svelte.d.ts +0 -39
- package/dist/docs/PathDataMenuField.svelte +0 -78
- package/dist/docs/PathDataMenuField.svelte.d.ts +0 -9
- package/dist/docs/Preview.svelte +0 -105
- package/dist/docs/Preview.svelte.d.ts +0 -14
- package/dist/docs/TilesetField.svelte +0 -135
- package/dist/docs/TilesetField.svelte.d.ts +0 -23
- package/dist/docs/TransformDebug.svelte +0 -22
- package/dist/docs/TransformDebug.svelte.d.ts +0 -20
- package/dist/docs/ViewSourceButton.svelte +0 -50
- package/dist/docs/ViewSourceButton.svelte.d.ts +0 -25
- package/dist/utils/connectorUtils.d.ts +0 -21
- package/dist/utils/connectorUtils.js +0 -111
- package/dist/utils/graph/dagre.d.ts +0 -34
- package/dist/utils/object.js +0 -2
- /package/dist/components/{GeoVisible.svelte.d.ts → geo/GeoVisible.svelte.d.ts} +0 -0
- /package/dist/components/{Dagre.svelte.d.ts → graph/Dagre.svelte.d.ts} +0 -0
- /package/dist/components/{Sankey.svelte.d.ts → graph/Sankey.svelte.d.ts} +0 -0
- /package/dist/{utils → contexts}/legendPayload.d.ts +0 -0
- /package/dist/{utils → contexts}/legendPayload.js +0 -0
|
@@ -0,0 +1,1635 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { flushSync } from 'svelte';
|
|
3
|
+
import { scaleBand } from 'd3-scale';
|
|
4
|
+
import { geoAlbersUsa } from 'd3-geo';
|
|
5
|
+
import { timeDay } from 'd3-time';
|
|
6
|
+
import { ChartState } from './chart.svelte.js';
|
|
7
|
+
import { isScaleBand, isScaleTime } from '../utils/scales.svelte.js';
|
|
8
|
+
function createChartState(props) {
|
|
9
|
+
let cleanup;
|
|
10
|
+
let state;
|
|
11
|
+
cleanup = $effect.root(() => {
|
|
12
|
+
state = new ChartState(() => props);
|
|
13
|
+
});
|
|
14
|
+
// Access derived values after reactive graph is set up
|
|
15
|
+
flushSync();
|
|
16
|
+
return { state: state, cleanup };
|
|
17
|
+
}
|
|
18
|
+
describe('ChartState baseline domain', () => {
|
|
19
|
+
describe('single series (default)', () => {
|
|
20
|
+
it('should include yBaseline=0 in y domain when all values are positive', () => {
|
|
21
|
+
const data = [
|
|
22
|
+
{ date: '2024-01', value: 10 },
|
|
23
|
+
{ date: '2024-02', value: 20 },
|
|
24
|
+
{ date: '2024-03', value: 30 },
|
|
25
|
+
];
|
|
26
|
+
const { state, cleanup } = createChartState({
|
|
27
|
+
data,
|
|
28
|
+
x: 'date',
|
|
29
|
+
y: 'value',
|
|
30
|
+
yBaseline: 0,
|
|
31
|
+
});
|
|
32
|
+
try {
|
|
33
|
+
expect(state._yDomain).toEqual([0, 30]);
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
cleanup();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
it('should include yBaseline=0 in y domain when all values are negative', () => {
|
|
40
|
+
const data = [
|
|
41
|
+
{ date: '2024-01', value: -30 },
|
|
42
|
+
{ date: '2024-02', value: -20 },
|
|
43
|
+
{ date: '2024-03', value: -10 },
|
|
44
|
+
];
|
|
45
|
+
const { state, cleanup } = createChartState({
|
|
46
|
+
data,
|
|
47
|
+
x: 'date',
|
|
48
|
+
y: 'value',
|
|
49
|
+
yBaseline: 0,
|
|
50
|
+
});
|
|
51
|
+
try {
|
|
52
|
+
expect(state._yDomain).toEqual([-30, 0]);
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
cleanup();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
it('should not alter domain when baseline is within data range', () => {
|
|
59
|
+
const data = [
|
|
60
|
+
{ date: '2024-01', value: -10 },
|
|
61
|
+
{ date: '2024-02', value: 20 },
|
|
62
|
+
];
|
|
63
|
+
const { state, cleanup } = createChartState({
|
|
64
|
+
data,
|
|
65
|
+
x: 'date',
|
|
66
|
+
y: 'value',
|
|
67
|
+
yBaseline: 0,
|
|
68
|
+
});
|
|
69
|
+
try {
|
|
70
|
+
expect(state._yDomain).toEqual([-10, 20]);
|
|
71
|
+
}
|
|
72
|
+
finally {
|
|
73
|
+
cleanup();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
it('should include xBaseline=0 in x domain for horizontal charts', () => {
|
|
77
|
+
const data = [
|
|
78
|
+
{ date: '2024-01', value: 10 },
|
|
79
|
+
{ date: '2024-02', value: 20 },
|
|
80
|
+
];
|
|
81
|
+
const { state, cleanup } = createChartState({
|
|
82
|
+
data,
|
|
83
|
+
x: 'value',
|
|
84
|
+
y: 'date',
|
|
85
|
+
xBaseline: 0,
|
|
86
|
+
});
|
|
87
|
+
try {
|
|
88
|
+
expect(state._xDomain).toEqual([0, 20]);
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
cleanup();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
describe('multi-series', () => {
|
|
96
|
+
it('should include yBaseline=0 in y domain for multi-series', () => {
|
|
97
|
+
const data = [
|
|
98
|
+
{ date: '2024-01', apples: 10, bananas: 15 },
|
|
99
|
+
{ date: '2024-02', apples: 20, bananas: 25 },
|
|
100
|
+
];
|
|
101
|
+
const { state, cleanup } = createChartState({
|
|
102
|
+
data,
|
|
103
|
+
x: 'date',
|
|
104
|
+
yBaseline: 0,
|
|
105
|
+
valueAxis: 'y',
|
|
106
|
+
series: [{ key: 'apples' }, { key: 'bananas' }],
|
|
107
|
+
});
|
|
108
|
+
try {
|
|
109
|
+
expect(state._yDomain).toEqual([0, 25]);
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
cleanup();
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
it('should include yBaseline=0 when all multi-series values are positive and above 0', () => {
|
|
116
|
+
const data = [
|
|
117
|
+
{ date: '2024-01', apples: 50, bananas: 60 },
|
|
118
|
+
{ date: '2024-02', apples: 70, bananas: 80 },
|
|
119
|
+
];
|
|
120
|
+
const { state, cleanup } = createChartState({
|
|
121
|
+
data,
|
|
122
|
+
x: 'date',
|
|
123
|
+
yBaseline: 0,
|
|
124
|
+
valueAxis: 'y',
|
|
125
|
+
series: [{ key: 'apples' }, { key: 'bananas' }],
|
|
126
|
+
});
|
|
127
|
+
try {
|
|
128
|
+
// Without the fix, this would be [50, 80] (missing baseline)
|
|
129
|
+
expect(state._yDomain).toEqual([0, 80]);
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
cleanup();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
it('should include yBaseline=0 when all multi-series values are negative', () => {
|
|
136
|
+
const data = [
|
|
137
|
+
{ date: '2024-01', apples: -30, bananas: -20 },
|
|
138
|
+
{ date: '2024-02', apples: -10, bananas: -5 },
|
|
139
|
+
];
|
|
140
|
+
const { state, cleanup } = createChartState({
|
|
141
|
+
data,
|
|
142
|
+
x: 'date',
|
|
143
|
+
yBaseline: 0,
|
|
144
|
+
valueAxis: 'y',
|
|
145
|
+
series: [{ key: 'apples' }, { key: 'bananas' }],
|
|
146
|
+
});
|
|
147
|
+
try {
|
|
148
|
+
expect(state._yDomain).toEqual([-30, 0]);
|
|
149
|
+
}
|
|
150
|
+
finally {
|
|
151
|
+
cleanup();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
it('should include xBaseline=0 for horizontal multi-series', () => {
|
|
155
|
+
const data = [
|
|
156
|
+
{ date: '2024-01', apples: 10, bananas: 15 },
|
|
157
|
+
{ date: '2024-02', apples: 20, bananas: 25 },
|
|
158
|
+
];
|
|
159
|
+
const { state, cleanup } = createChartState({
|
|
160
|
+
data,
|
|
161
|
+
y: 'date',
|
|
162
|
+
xBaseline: 0,
|
|
163
|
+
valueAxis: 'x',
|
|
164
|
+
series: [{ key: 'apples' }, { key: 'bananas' }],
|
|
165
|
+
});
|
|
166
|
+
try {
|
|
167
|
+
expect(state._xDomain).toEqual([0, 25]);
|
|
168
|
+
}
|
|
169
|
+
finally {
|
|
170
|
+
cleanup();
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
it('should work without baseline (no forced 0)', () => {
|
|
174
|
+
const data = [
|
|
175
|
+
{ date: '2024-01', apples: 50, bananas: 60 },
|
|
176
|
+
{ date: '2024-02', apples: 70, bananas: 80 },
|
|
177
|
+
];
|
|
178
|
+
const { state, cleanup } = createChartState({
|
|
179
|
+
data,
|
|
180
|
+
x: 'date',
|
|
181
|
+
valueAxis: 'y',
|
|
182
|
+
series: [{ key: 'apples' }, { key: 'bananas' }],
|
|
183
|
+
});
|
|
184
|
+
try {
|
|
185
|
+
// Without baseline, domain should just be extent of data
|
|
186
|
+
expect(state._yDomain).toEqual([50, 80]);
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
cleanup();
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
describe('ChartState mark registration', () => {
|
|
195
|
+
it('should register and unregister marks', () => {
|
|
196
|
+
const { state, cleanup } = createChartState({
|
|
197
|
+
data: [{ date: '2024-01', value: 10 }],
|
|
198
|
+
x: 'date',
|
|
199
|
+
});
|
|
200
|
+
try {
|
|
201
|
+
expect(state.seriesState.isDefaultSeries).toBe(true);
|
|
202
|
+
const unregister = state.registerMark({ y: 'value', color: 'red' });
|
|
203
|
+
flushSync();
|
|
204
|
+
// After registration, implicit series should be created
|
|
205
|
+
expect(state.seriesState.isDefaultSeries).toBe(false);
|
|
206
|
+
expect(state.seriesState.series).toHaveLength(1);
|
|
207
|
+
expect(state.seriesState.series[0].key).toBe('value');
|
|
208
|
+
expect(state.seriesState.series[0].color).toBe('red');
|
|
209
|
+
unregister();
|
|
210
|
+
flushSync();
|
|
211
|
+
// After unregistration, should revert to default
|
|
212
|
+
expect(state.seriesState.isDefaultSeries).toBe(true);
|
|
213
|
+
}
|
|
214
|
+
finally {
|
|
215
|
+
cleanup();
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
it('should not create implicit series when mark accessor matches chart accessor', () => {
|
|
219
|
+
const { state, cleanup } = createChartState({
|
|
220
|
+
data: [{ date: '2024-01', value: 10 }],
|
|
221
|
+
x: 'date',
|
|
222
|
+
y: 'value',
|
|
223
|
+
});
|
|
224
|
+
try {
|
|
225
|
+
// Mark with same y as chart — not a new series, just using chart's axis
|
|
226
|
+
state.registerMark({ y: 'value', color: 'red' });
|
|
227
|
+
flushSync();
|
|
228
|
+
expect(state.seriesState.isDefaultSeries).toBe(true);
|
|
229
|
+
}
|
|
230
|
+
finally {
|
|
231
|
+
cleanup();
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
it('should generate implicit series from marks with string y accessors', () => {
|
|
235
|
+
const data = [
|
|
236
|
+
{ date: '2024-01', apples: 10, bananas: 15 },
|
|
237
|
+
{ date: '2024-02', apples: 20, bananas: 25 },
|
|
238
|
+
];
|
|
239
|
+
const { state, cleanup } = createChartState({
|
|
240
|
+
data,
|
|
241
|
+
x: 'date',
|
|
242
|
+
});
|
|
243
|
+
try {
|
|
244
|
+
state.registerMark({ y: 'apples', color: 'red' });
|
|
245
|
+
state.registerMark({ y: 'bananas', color: 'yellow' });
|
|
246
|
+
flushSync();
|
|
247
|
+
expect(state.seriesState.isDefaultSeries).toBe(false);
|
|
248
|
+
expect(state.seriesState.series).toHaveLength(2);
|
|
249
|
+
expect(state.seriesState.series[0]).toMatchObject({ key: 'apples', color: 'red' });
|
|
250
|
+
expect(state.seriesState.series[1]).toMatchObject({ key: 'bananas', color: 'yellow' });
|
|
251
|
+
}
|
|
252
|
+
finally {
|
|
253
|
+
cleanup();
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
it('should generate implicit series from marks with seriesKey', () => {
|
|
257
|
+
const { state, cleanup } = createChartState({
|
|
258
|
+
data: [{ date: '2024-01', value: 10 }],
|
|
259
|
+
x: 'date',
|
|
260
|
+
y: 'value',
|
|
261
|
+
});
|
|
262
|
+
try {
|
|
263
|
+
state.registerMark({ seriesKey: 'temp', color: 'blue' });
|
|
264
|
+
state.registerMark({ seriesKey: 'humidity', color: 'green' });
|
|
265
|
+
flushSync();
|
|
266
|
+
expect(state.seriesState.series).toHaveLength(2);
|
|
267
|
+
expect(state.seriesState.series[0].key).toBe('temp');
|
|
268
|
+
expect(state.seriesState.series[1].key).toBe('humidity');
|
|
269
|
+
}
|
|
270
|
+
finally {
|
|
271
|
+
cleanup();
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
it('should generate implicit series from x accessor for vertical charts (valueAxis=x)', () => {
|
|
275
|
+
const data = [
|
|
276
|
+
{ date: '2024-01', apples: 10, bananas: 15 },
|
|
277
|
+
{ date: '2024-02', apples: 20, bananas: 25 },
|
|
278
|
+
];
|
|
279
|
+
const { state, cleanup } = createChartState({
|
|
280
|
+
data,
|
|
281
|
+
y: 'date',
|
|
282
|
+
valueAxis: 'x',
|
|
283
|
+
});
|
|
284
|
+
try {
|
|
285
|
+
state.registerMark({ x: 'apples', color: 'red' });
|
|
286
|
+
state.registerMark({ x: 'bananas', color: 'yellow' });
|
|
287
|
+
flushSync();
|
|
288
|
+
expect(state.seriesState.isDefaultSeries).toBe(false);
|
|
289
|
+
expect(state.seriesState.series).toHaveLength(2);
|
|
290
|
+
expect(state.seriesState.series[0]).toMatchObject({
|
|
291
|
+
key: 'apples',
|
|
292
|
+
color: 'red',
|
|
293
|
+
value: 'apples',
|
|
294
|
+
});
|
|
295
|
+
expect(state.seriesState.series[1]).toMatchObject({
|
|
296
|
+
key: 'bananas',
|
|
297
|
+
color: 'yellow',
|
|
298
|
+
value: 'bananas',
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
finally {
|
|
302
|
+
cleanup();
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
it('should not generate implicit series when explicit series are provided', () => {
|
|
306
|
+
const data = [{ date: '2024-01', apples: 10, bananas: 15 }];
|
|
307
|
+
const { state, cleanup } = createChartState({
|
|
308
|
+
data,
|
|
309
|
+
x: 'date',
|
|
310
|
+
series: [{ key: 'apples' }, { key: 'bananas' }],
|
|
311
|
+
});
|
|
312
|
+
try {
|
|
313
|
+
// Register marks that would normally create implicit series
|
|
314
|
+
state.registerMark({ y: 'apples', color: 'red' });
|
|
315
|
+
state.registerMark({ y: 'bananas', color: 'yellow' });
|
|
316
|
+
flushSync();
|
|
317
|
+
// Explicit series should take precedence
|
|
318
|
+
expect(state.seriesState.series).toHaveLength(2);
|
|
319
|
+
expect(state.seriesState.series[0].color).toBeUndefined(); // explicit series has no color
|
|
320
|
+
}
|
|
321
|
+
finally {
|
|
322
|
+
cleanup();
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
it('should deduplicate implicit series with the same key', () => {
|
|
326
|
+
const { state, cleanup } = createChartState({
|
|
327
|
+
data: [{ date: '2024-01', value: 10 }],
|
|
328
|
+
x: 'date',
|
|
329
|
+
});
|
|
330
|
+
try {
|
|
331
|
+
// Two marks referencing the same y accessor
|
|
332
|
+
state.registerMark({ y: 'value', color: 'red' });
|
|
333
|
+
state.registerMark({ y: 'value', color: 'blue' });
|
|
334
|
+
flushSync();
|
|
335
|
+
// Should only create one series (first wins)
|
|
336
|
+
expect(state.seriesState.series).toHaveLength(1);
|
|
337
|
+
expect(state.seriesState.series[0].key).toBe('value');
|
|
338
|
+
}
|
|
339
|
+
finally {
|
|
340
|
+
cleanup();
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
it('should include mark data in flatData for domain calculation', () => {
|
|
344
|
+
const markData = [
|
|
345
|
+
{ date: '2024-01', value: 100 },
|
|
346
|
+
{ date: '2024-02', value: 200 },
|
|
347
|
+
];
|
|
348
|
+
const { state, cleanup } = createChartState({
|
|
349
|
+
x: 'date',
|
|
350
|
+
y: 'value',
|
|
351
|
+
});
|
|
352
|
+
try {
|
|
353
|
+
state.registerMark({ data: markData });
|
|
354
|
+
flushSync();
|
|
355
|
+
expect(state.flatData).toHaveLength(2);
|
|
356
|
+
expect(state.flatData).toEqual(markData);
|
|
357
|
+
}
|
|
358
|
+
finally {
|
|
359
|
+
cleanup();
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
it('should skip marks without a derivable key for implicit series', () => {
|
|
363
|
+
const { state, cleanup } = createChartState({
|
|
364
|
+
x: 'date',
|
|
365
|
+
y: 'value',
|
|
366
|
+
});
|
|
367
|
+
try {
|
|
368
|
+
// Mark with data but no string y or seriesKey — no implicit series
|
|
369
|
+
state.registerMark({ data: [{ date: '2024-01', value: 10 }] });
|
|
370
|
+
flushSync();
|
|
371
|
+
expect(state.seriesState.isDefaultSeries).toBe(true);
|
|
372
|
+
// But data should still be in flatData
|
|
373
|
+
expect(state.flatData).toHaveLength(1);
|
|
374
|
+
}
|
|
375
|
+
finally {
|
|
376
|
+
cleanup();
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
it('should aggregate y accessor from implicit series into resolveAccessor', () => {
|
|
380
|
+
const data = [
|
|
381
|
+
{ date: '2024-01', apples: 10, bananas: 50 },
|
|
382
|
+
{ date: '2024-02', apples: 20, bananas: 80 },
|
|
383
|
+
];
|
|
384
|
+
const { state, cleanup } = createChartState({
|
|
385
|
+
data,
|
|
386
|
+
x: 'date',
|
|
387
|
+
// No y prop — should be derived from marks
|
|
388
|
+
});
|
|
389
|
+
try {
|
|
390
|
+
state.registerMark({ y: 'apples', color: 'red' });
|
|
391
|
+
state.registerMark({ y: 'bananas', color: 'yellow' });
|
|
392
|
+
flushSync();
|
|
393
|
+
// y accessor should return both values
|
|
394
|
+
const result = state.y(data[0]);
|
|
395
|
+
expect(result).toEqual([10, 50]);
|
|
396
|
+
}
|
|
397
|
+
finally {
|
|
398
|
+
cleanup();
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
it('should include per-mark data in domain via implicit series', () => {
|
|
402
|
+
const markData1 = [
|
|
403
|
+
{ date: '2024-01', value: 10 },
|
|
404
|
+
{ date: '2024-02', value: 20 },
|
|
405
|
+
];
|
|
406
|
+
const markData2 = [
|
|
407
|
+
{ date: '2024-01', value: 50 },
|
|
408
|
+
{ date: '2024-02', value: 80 },
|
|
409
|
+
];
|
|
410
|
+
const { state, cleanup } = createChartState({
|
|
411
|
+
x: 'date',
|
|
412
|
+
});
|
|
413
|
+
try {
|
|
414
|
+
state.registerMark({ y: 'value', data: markData1, color: 'red' });
|
|
415
|
+
state.registerMark({ y: 'value', data: markData2, color: 'blue' });
|
|
416
|
+
flushSync();
|
|
417
|
+
// Both marks have the same y='value' key so they deduplicate to one series,
|
|
418
|
+
// but the first mark's data should be on the series
|
|
419
|
+
expect(state.seriesState.series).toHaveLength(1);
|
|
420
|
+
expect(state.seriesState.series[0].data).toBe(markData1);
|
|
421
|
+
}
|
|
422
|
+
finally {
|
|
423
|
+
cleanup();
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
it('should include data from two marks with same y accessor but different data arrays', () => {
|
|
427
|
+
const data1 = [
|
|
428
|
+
{ date: '2024-01', value: 30 },
|
|
429
|
+
{ date: '2024-02', value: 40 },
|
|
430
|
+
];
|
|
431
|
+
const data2 = [
|
|
432
|
+
{ date: '2024-01', value: 60 },
|
|
433
|
+
{ date: '2024-02', value: 70 },
|
|
434
|
+
];
|
|
435
|
+
const { state, cleanup } = createChartState({
|
|
436
|
+
x: 'date',
|
|
437
|
+
y: 'value',
|
|
438
|
+
});
|
|
439
|
+
try {
|
|
440
|
+
state.registerMark({ y: 'value', data: data1, color: 'red' });
|
|
441
|
+
state.registerMark({ y: 'value', data: data2, color: 'blue' });
|
|
442
|
+
flushSync();
|
|
443
|
+
// Both datasets should appear in flatData for correct domain calculation.
|
|
444
|
+
// data1 is on the implicit series; data2 has a different reference so it's extra.
|
|
445
|
+
expect(state.flatData.length).toBeGreaterThanOrEqual(data1.length + data2.length);
|
|
446
|
+
}
|
|
447
|
+
finally {
|
|
448
|
+
cleanup();
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
it('should calculate correct y domain from two marks with same y accessor but different data', () => {
|
|
452
|
+
const data1 = [
|
|
453
|
+
{ date: '2024-01', value: 30 },
|
|
454
|
+
{ date: '2024-02', value: 40 },
|
|
455
|
+
];
|
|
456
|
+
const data2 = [
|
|
457
|
+
{ date: '2024-01', value: 60 },
|
|
458
|
+
{ date: '2024-02', value: 70 },
|
|
459
|
+
];
|
|
460
|
+
const { state, cleanup } = createChartState({
|
|
461
|
+
x: 'date',
|
|
462
|
+
y: 'value',
|
|
463
|
+
});
|
|
464
|
+
try {
|
|
465
|
+
state.registerMark({ y: 'value', data: data1, color: 'red' });
|
|
466
|
+
state.registerMark({ y: 'value', data: data2, color: 'blue' });
|
|
467
|
+
flushSync();
|
|
468
|
+
// Domain must span both datasets: [30, 70]
|
|
469
|
+
expect(state._yDomain).toEqual([30, 70]);
|
|
470
|
+
}
|
|
471
|
+
finally {
|
|
472
|
+
cleanup();
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
it('should not double-include data when mark data matches series data reference', () => {
|
|
476
|
+
const markData = [
|
|
477
|
+
{ date: '2024-01', value: 10 },
|
|
478
|
+
{ date: '2024-02', value: 20 },
|
|
479
|
+
];
|
|
480
|
+
const { state, cleanup } = createChartState({
|
|
481
|
+
x: 'date',
|
|
482
|
+
y: 'value',
|
|
483
|
+
});
|
|
484
|
+
try {
|
|
485
|
+
// Register the same data reference twice (should not double-count in flatData)
|
|
486
|
+
state.registerMark({ y: 'value', data: markData, color: 'red' });
|
|
487
|
+
state.registerMark({ y: 'value', data: markData, color: 'blue' });
|
|
488
|
+
flushSync();
|
|
489
|
+
// Only one series (deduplication by key), data1 is its data.
|
|
490
|
+
// The second mark shares the same reference, so flatData only includes markData once
|
|
491
|
+
// (via the series). Total items = markData.length.
|
|
492
|
+
expect(state.flatData).toHaveLength(markData.length);
|
|
493
|
+
}
|
|
494
|
+
finally {
|
|
495
|
+
cleanup();
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
it('should revert flatData after all marks unregister', () => {
|
|
499
|
+
const chartData = [{ date: '2024-01', value: 5 }];
|
|
500
|
+
const markData = [
|
|
501
|
+
{ date: '2024-01', value: 100 },
|
|
502
|
+
{ date: '2024-02', value: 200 },
|
|
503
|
+
];
|
|
504
|
+
const { state, cleanup } = createChartState({
|
|
505
|
+
data: chartData,
|
|
506
|
+
x: 'date',
|
|
507
|
+
y: 'value',
|
|
508
|
+
});
|
|
509
|
+
try {
|
|
510
|
+
const unregister = state.registerMark({ data: markData });
|
|
511
|
+
flushSync();
|
|
512
|
+
expect(state.flatData).toHaveLength(3); // 1 chart + 2 mark
|
|
513
|
+
unregister();
|
|
514
|
+
flushSync();
|
|
515
|
+
expect(state.flatData).toHaveLength(1); // back to chart data only
|
|
516
|
+
expect(state.flatData).toEqual(chartData);
|
|
517
|
+
}
|
|
518
|
+
finally {
|
|
519
|
+
cleanup();
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
it('should include implicit series label when provided', () => {
|
|
523
|
+
const { state, cleanup } = createChartState({
|
|
524
|
+
data: [{ date: '2024-01', value: 10 }],
|
|
525
|
+
x: 'date',
|
|
526
|
+
});
|
|
527
|
+
try {
|
|
528
|
+
state.registerMark({ y: 'value', color: 'red', label: 'Temperature' });
|
|
529
|
+
flushSync();
|
|
530
|
+
expect(state.seriesState.series[0].label).toBe('Temperature');
|
|
531
|
+
}
|
|
532
|
+
finally {
|
|
533
|
+
cleanup();
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
});
|
|
537
|
+
describe('ChartState data vs visibleSeriesData', () => {
|
|
538
|
+
it('should return props.data when explicit, even if a mark registers a filtered subset', () => {
|
|
539
|
+
const fullData = [
|
|
540
|
+
{ date: '2024-01', value: 10 },
|
|
541
|
+
{ date: '2024-02', value: 20 },
|
|
542
|
+
{ date: '2024-03', value: 30 },
|
|
543
|
+
];
|
|
544
|
+
const highlighted = [fullData[0]]; // filtered subset
|
|
545
|
+
const { state, cleanup } = createChartState({
|
|
546
|
+
data: fullData,
|
|
547
|
+
x: 'date',
|
|
548
|
+
y: 'value',
|
|
549
|
+
});
|
|
550
|
+
try {
|
|
551
|
+
// Simulate a decorative mark (e.g. <Text data={highlighted}>) registering
|
|
552
|
+
// its own filtered dataset with the same value accessor as the chart.
|
|
553
|
+
state.registerMark({ y: 'value', data: highlighted });
|
|
554
|
+
flushSync();
|
|
555
|
+
// ctx.data (used by sibling marks for iteration) should remain the full
|
|
556
|
+
// chart data, not be replaced by the filtered subset.
|
|
557
|
+
expect(state.data).toBe(fullData);
|
|
558
|
+
expect(state.data).toHaveLength(3);
|
|
559
|
+
}
|
|
560
|
+
finally {
|
|
561
|
+
cleanup();
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
it('should fall back to visibleSeriesData when props.data is not provided', () => {
|
|
565
|
+
const applesData = [
|
|
566
|
+
{ date: '2024-01', value: 10 },
|
|
567
|
+
{ date: '2024-02', value: 20 },
|
|
568
|
+
];
|
|
569
|
+
const bananasData = [
|
|
570
|
+
{ date: '2024-01', value: 15 },
|
|
571
|
+
{ date: '2024-02', value: 25 },
|
|
572
|
+
];
|
|
573
|
+
const { state, cleanup } = createChartState({
|
|
574
|
+
x: 'date',
|
|
575
|
+
y: 'value',
|
|
576
|
+
series: [
|
|
577
|
+
{ key: 'apples', data: applesData },
|
|
578
|
+
{ key: 'bananas', data: bananasData },
|
|
579
|
+
],
|
|
580
|
+
});
|
|
581
|
+
try {
|
|
582
|
+
// No props.data — ctx.data should flatten series data for iteration.
|
|
583
|
+
expect(state.data).toHaveLength(4);
|
|
584
|
+
}
|
|
585
|
+
finally {
|
|
586
|
+
cleanup();
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
it('should not create an implicit series for a decorative mark when chart has own data', () => {
|
|
590
|
+
// Scenario: <Chart data={full}> + <Text data={highlighted} y="value"> (labels)
|
|
591
|
+
// The Text mark shouldn't create an implicit series that narrows the domain.
|
|
592
|
+
const fullData = [
|
|
593
|
+
{ date: '2024-01', value: 10 },
|
|
594
|
+
{ date: '2024-02', value: 50 },
|
|
595
|
+
{ date: '2024-03', value: 100 },
|
|
596
|
+
];
|
|
597
|
+
const highlighted = [fullData[1]];
|
|
598
|
+
const { state, cleanup } = createChartState({
|
|
599
|
+
data: fullData,
|
|
600
|
+
x: 'date',
|
|
601
|
+
y: 'value',
|
|
602
|
+
});
|
|
603
|
+
try {
|
|
604
|
+
state.registerMark({ y: 'value', data: highlighted });
|
|
605
|
+
flushSync();
|
|
606
|
+
// Decorative mark shouldn't turn this into a multi-series chart.
|
|
607
|
+
expect(state.seriesState.isDefaultSeries).toBe(true);
|
|
608
|
+
}
|
|
609
|
+
finally {
|
|
610
|
+
cleanup();
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
it('should not create an implicit series when chart uses array y accessor matching the mark key', () => {
|
|
614
|
+
const fullData = [
|
|
615
|
+
{ date: '2024-01', v1: 10, v2: 20 },
|
|
616
|
+
{ date: '2024-02', v1: 30, v2: 40 },
|
|
617
|
+
];
|
|
618
|
+
const { state, cleanup } = createChartState({
|
|
619
|
+
data: fullData,
|
|
620
|
+
x: 'date',
|
|
621
|
+
y: ['v1', 'v2'],
|
|
622
|
+
});
|
|
623
|
+
try {
|
|
624
|
+
state.registerMark({ y: 'v2', data: [fullData[0]] });
|
|
625
|
+
flushSync();
|
|
626
|
+
expect(state.seriesState.isDefaultSeries).toBe(true);
|
|
627
|
+
}
|
|
628
|
+
finally {
|
|
629
|
+
cleanup();
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
it('should compute yDomain from full chart data when a decorative mark has a filtered subset', () => {
|
|
633
|
+
// Regression: Text labeling highlighted rows shouldn't narrow the y domain.
|
|
634
|
+
const fullData = [
|
|
635
|
+
{ date: '2024-01', value: 10 },
|
|
636
|
+
{ date: '2024-02', value: 50 },
|
|
637
|
+
{ date: '2024-03', value: 100 },
|
|
638
|
+
];
|
|
639
|
+
const highlighted = [fullData[1]]; // only value=50
|
|
640
|
+
const { state, cleanup } = createChartState({
|
|
641
|
+
data: fullData,
|
|
642
|
+
x: 'date',
|
|
643
|
+
y: 'value',
|
|
644
|
+
});
|
|
645
|
+
try {
|
|
646
|
+
state.registerMark({ y: 'value', data: highlighted });
|
|
647
|
+
flushSync();
|
|
648
|
+
// yDomain should reflect the full data extent [10, 100], not just [50, 50].
|
|
649
|
+
expect(state.yDomain).toEqual([10, 100]);
|
|
650
|
+
}
|
|
651
|
+
finally {
|
|
652
|
+
cleanup();
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
it('should compute yDomain across all array y accessors on Chart', () => {
|
|
656
|
+
const data = [
|
|
657
|
+
{ date: '2024-01', v1: 3, v2: 5 },
|
|
658
|
+
{ date: '2024-02', v1: 2, v2: 8 },
|
|
659
|
+
{ date: '2024-03', v1: 4, v2: 9 },
|
|
660
|
+
];
|
|
661
|
+
const { state, cleanup } = createChartState({
|
|
662
|
+
data,
|
|
663
|
+
x: 'date',
|
|
664
|
+
y: ['v1', 'v2'],
|
|
665
|
+
});
|
|
666
|
+
try {
|
|
667
|
+
// Domain should span min(v1) = 2 to max(v2) = 9
|
|
668
|
+
expect(state.yDomain).toEqual([2, 9]);
|
|
669
|
+
}
|
|
670
|
+
finally {
|
|
671
|
+
cleanup();
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
it('should keep full yDomain when decorative mark + array y both present', () => {
|
|
675
|
+
const data = [
|
|
676
|
+
{ date: '2024-01', v1: 3, v2: 5 },
|
|
677
|
+
{ date: '2024-02', v1: 2, v2: 8 },
|
|
678
|
+
{ date: '2024-03', v1: 4, v2: 9 },
|
|
679
|
+
];
|
|
680
|
+
const { state, cleanup } = createChartState({
|
|
681
|
+
data,
|
|
682
|
+
x: 'date',
|
|
683
|
+
y: ['v1', 'v2'],
|
|
684
|
+
});
|
|
685
|
+
try {
|
|
686
|
+
// Decorative Text mark with subset data and y matching one of chart's keys
|
|
687
|
+
state.registerMark({ y: 'v2', data: [data[0]] });
|
|
688
|
+
flushSync();
|
|
689
|
+
// Still the full range [2, 9], not narrowed to [5, 5]
|
|
690
|
+
expect(state.yDomain).toEqual([2, 9]);
|
|
691
|
+
expect(state.seriesState.isDefaultSeries).toBe(true);
|
|
692
|
+
}
|
|
693
|
+
finally {
|
|
694
|
+
cleanup();
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
it('should fall back to visibleSeriesData when props.data is an empty array', () => {
|
|
698
|
+
// Composite charts (BarChart, etc.) default `data = []` when not passed.
|
|
699
|
+
const applesData = [{ date: '2024-01', value: 10 }];
|
|
700
|
+
const bananasData = [{ date: '2024-01', value: 15 }];
|
|
701
|
+
const { state, cleanup } = createChartState({
|
|
702
|
+
data: [],
|
|
703
|
+
x: 'date',
|
|
704
|
+
y: 'value',
|
|
705
|
+
series: [
|
|
706
|
+
{ key: 'apples', data: applesData },
|
|
707
|
+
{ key: 'bananas', data: bananasData },
|
|
708
|
+
],
|
|
709
|
+
});
|
|
710
|
+
try {
|
|
711
|
+
expect(state.data).toHaveLength(2);
|
|
712
|
+
}
|
|
713
|
+
finally {
|
|
714
|
+
cleanup();
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
});
|
|
718
|
+
describe('ChartState geo projection skips markInfo', () => {
|
|
719
|
+
const geoData = [
|
|
720
|
+
{ name: 'New York', longitude: -74.006, latitude: 40.7128 },
|
|
721
|
+
{ name: 'Los Angeles', longitude: -118.2437, latitude: 34.0522 },
|
|
722
|
+
{ name: 'Chicago', longitude: -87.6298, latitude: 41.8781 },
|
|
723
|
+
];
|
|
724
|
+
it('should not create implicit series from marks when geo projection is active', () => {
|
|
725
|
+
const { state, cleanup } = createChartState({
|
|
726
|
+
data: geoData,
|
|
727
|
+
x: 'longitude',
|
|
728
|
+
y: 'latitude',
|
|
729
|
+
geo: { projection: geoAlbersUsa },
|
|
730
|
+
});
|
|
731
|
+
try {
|
|
732
|
+
// Register a mark with its own data (like a tooltip highlight Circle)
|
|
733
|
+
state.registerMark({ data: [geoData[0]], x: 'longitude', y: 'latitude' });
|
|
734
|
+
flushSync();
|
|
735
|
+
// Should remain default series — mark should not create implicit "latitude" series
|
|
736
|
+
expect(state.seriesState.isDefaultSeries).toBe(true);
|
|
737
|
+
}
|
|
738
|
+
finally {
|
|
739
|
+
cleanup();
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
it('should not add mark data to flatData when geo projection is active', () => {
|
|
743
|
+
const { state, cleanup } = createChartState({
|
|
744
|
+
data: geoData,
|
|
745
|
+
x: 'longitude',
|
|
746
|
+
y: 'latitude',
|
|
747
|
+
geo: { projection: geoAlbersUsa },
|
|
748
|
+
});
|
|
749
|
+
try {
|
|
750
|
+
state.registerMark({ data: [geoData[0]], x: 'longitude', y: 'latitude' });
|
|
751
|
+
flushSync();
|
|
752
|
+
// flatData should only contain chart data, not the mark's extra data
|
|
753
|
+
expect(state.flatData).toHaveLength(3);
|
|
754
|
+
expect(state.flatData).toBe(geoData);
|
|
755
|
+
}
|
|
756
|
+
finally {
|
|
757
|
+
cleanup();
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
it('should not derive x/y accessors from marks when geo projection is active', () => {
|
|
761
|
+
// Chart with geo but no explicit x/y — marks should not fill in the accessors
|
|
762
|
+
const { state: stateWithGeo, cleanup: cleanupGeo } = createChartState({
|
|
763
|
+
data: geoData,
|
|
764
|
+
geo: { projection: geoAlbersUsa },
|
|
765
|
+
});
|
|
766
|
+
const { state: stateWithoutGeo, cleanup: cleanupNoGeo } = createChartState({
|
|
767
|
+
data: geoData,
|
|
768
|
+
});
|
|
769
|
+
try {
|
|
770
|
+
// Both start with null x accessor (no x prop set)
|
|
771
|
+
expect(stateWithGeo.x).toBeNull();
|
|
772
|
+
expect(stateWithoutGeo.x).toBeNull();
|
|
773
|
+
stateWithGeo.registerMark({ x: 'longitude', y: 'latitude' });
|
|
774
|
+
stateWithoutGeo.registerMark({ x: 'longitude', y: 'latitude' });
|
|
775
|
+
flushSync();
|
|
776
|
+
// Without geo: mark should derive x accessor
|
|
777
|
+
expect(stateWithoutGeo.x).not.toBeNull();
|
|
778
|
+
expect(stateWithoutGeo.x(geoData[0])).toBe(geoData[0].longitude);
|
|
779
|
+
// With geo: mark should NOT derive x accessor
|
|
780
|
+
expect(stateWithGeo.x).toBeNull();
|
|
781
|
+
}
|
|
782
|
+
finally {
|
|
783
|
+
cleanupGeo();
|
|
784
|
+
cleanupNoGeo();
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
it('should preserve seriesKey/color/label from marks in geo mode for legends', () => {
|
|
788
|
+
const { state, cleanup } = createChartState({
|
|
789
|
+
data: geoData,
|
|
790
|
+
x: 'longitude',
|
|
791
|
+
y: 'latitude',
|
|
792
|
+
geo: { projection: geoAlbersUsa },
|
|
793
|
+
});
|
|
794
|
+
try {
|
|
795
|
+
state.registerMark({ seriesKey: 'earthquakes', color: 'red', label: 'Earthquakes' });
|
|
796
|
+
state.registerMark({ seriesKey: 'volcanos', color: 'orange', label: 'Volcanos' });
|
|
797
|
+
flushSync();
|
|
798
|
+
// seriesKey/color/label should still create implicit series for legends
|
|
799
|
+
expect(state.seriesState.isDefaultSeries).toBe(false);
|
|
800
|
+
expect(state.seriesState.series).toHaveLength(2);
|
|
801
|
+
expect(state.seriesState.series[0]).toMatchObject({
|
|
802
|
+
key: 'earthquakes',
|
|
803
|
+
color: 'red',
|
|
804
|
+
label: 'Earthquakes',
|
|
805
|
+
});
|
|
806
|
+
expect(state.seriesState.series[1]).toMatchObject({
|
|
807
|
+
key: 'volcanos',
|
|
808
|
+
color: 'orange',
|
|
809
|
+
label: 'Volcanos',
|
|
810
|
+
});
|
|
811
|
+
// But flatData should not include extra mark data
|
|
812
|
+
expect(state.flatData).toHaveLength(3);
|
|
813
|
+
}
|
|
814
|
+
finally {
|
|
815
|
+
cleanup();
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
it('should still process marks normally without geo projection', () => {
|
|
819
|
+
const { state, cleanup } = createChartState({
|
|
820
|
+
data: geoData,
|
|
821
|
+
x: 'name',
|
|
822
|
+
});
|
|
823
|
+
try {
|
|
824
|
+
state.registerMark({ y: 'latitude', color: 'blue' });
|
|
825
|
+
flushSync();
|
|
826
|
+
// Without geo, marks should create implicit series as normal
|
|
827
|
+
expect(state.seriesState.isDefaultSeries).toBe(false);
|
|
828
|
+
expect(state.seriesState.series[0].key).toBe('latitude');
|
|
829
|
+
}
|
|
830
|
+
finally {
|
|
831
|
+
cleanup();
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
});
|
|
835
|
+
describe('ChartState implicit series domain update on visibility toggle', () => {
|
|
836
|
+
it('should update y domain when hiding an implicit series', () => {
|
|
837
|
+
const data = [
|
|
838
|
+
{ date: '2024-01', apples: 10, bananas: 50 },
|
|
839
|
+
{ date: '2024-02', apples: 20, bananas: 80 },
|
|
840
|
+
];
|
|
841
|
+
const { state, cleanup } = createChartState({
|
|
842
|
+
data,
|
|
843
|
+
x: 'date',
|
|
844
|
+
// No y prop — will be derived from marks
|
|
845
|
+
});
|
|
846
|
+
try {
|
|
847
|
+
state.registerMark({ y: 'apples', color: 'red' });
|
|
848
|
+
state.registerMark({ y: 'bananas', color: 'yellow' });
|
|
849
|
+
flushSync();
|
|
850
|
+
// Both visible: domain should span all values
|
|
851
|
+
expect(state.seriesState.series).toHaveLength(2);
|
|
852
|
+
expect(state._yDomain).toEqual([10, 80]);
|
|
853
|
+
// Toggle "apples" — when selection is empty, toggling adds it,
|
|
854
|
+
// making only "apples" visible (bananas hidden)
|
|
855
|
+
state.seriesState.selectedKeys.toggle('apples');
|
|
856
|
+
flushSync();
|
|
857
|
+
// With only apples visible, domain should be [10, 20]
|
|
858
|
+
expect(state.seriesState.visibleSeries).toHaveLength(1);
|
|
859
|
+
expect(state.seriesState.visibleSeries[0].key).toBe('apples');
|
|
860
|
+
expect(state._yDomain).toEqual([10, 20]);
|
|
861
|
+
expect(state._baseYDomain).toEqual([10, 20]);
|
|
862
|
+
expect(state.yDomain).toEqual([10, 20]);
|
|
863
|
+
// Verify scale domain updated too
|
|
864
|
+
expect(state.yScale.domain()).toEqual([10, 20]);
|
|
865
|
+
}
|
|
866
|
+
finally {
|
|
867
|
+
cleanup();
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
it('should update y domain when hiding an explicit series', () => {
|
|
871
|
+
const data = [
|
|
872
|
+
{ date: '2024-01', apples: 10, bananas: 50 },
|
|
873
|
+
{ date: '2024-02', apples: 20, bananas: 80 },
|
|
874
|
+
];
|
|
875
|
+
const { state, cleanup } = createChartState({
|
|
876
|
+
data,
|
|
877
|
+
x: 'date',
|
|
878
|
+
valueAxis: 'y',
|
|
879
|
+
series: [{ key: 'apples' }, { key: 'bananas' }],
|
|
880
|
+
});
|
|
881
|
+
try {
|
|
882
|
+
expect(state._yDomain).toEqual([10, 80]);
|
|
883
|
+
// Select only apples (hides bananas)
|
|
884
|
+
state.seriesState.selectedKeys.toggle('apples');
|
|
885
|
+
flushSync();
|
|
886
|
+
expect(state.seriesState.visibleSeries).toHaveLength(1);
|
|
887
|
+
expect(state.seriesState.visibleSeries[0].key).toBe('apples');
|
|
888
|
+
expect(state._yDomain).toEqual([10, 20]);
|
|
889
|
+
expect(state._baseYDomain).toEqual([10, 20]);
|
|
890
|
+
}
|
|
891
|
+
finally {
|
|
892
|
+
cleanup();
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
});
|
|
896
|
+
describe('ChartState degenerate domain', () => {
|
|
897
|
+
it('should expand degenerate y domain [0, 0] to [0, 1]', () => {
|
|
898
|
+
const data = [
|
|
899
|
+
{ date: '2024-01', value: 0 },
|
|
900
|
+
{ date: '2024-02', value: 0 },
|
|
901
|
+
{ date: '2024-03', value: 0 },
|
|
902
|
+
];
|
|
903
|
+
const { state, cleanup } = createChartState({
|
|
904
|
+
data,
|
|
905
|
+
x: 'date',
|
|
906
|
+
y: 'value',
|
|
907
|
+
yBaseline: 0,
|
|
908
|
+
});
|
|
909
|
+
try {
|
|
910
|
+
// Domain from data+baseline is [0,0] — scale should expand to [0,1]
|
|
911
|
+
expect(state._yDomain).toEqual([0, 0]);
|
|
912
|
+
expect(state.yScale.domain()).toEqual([0, 1]);
|
|
913
|
+
// yScale(0) should be a valid number (not NaN)
|
|
914
|
+
expect(state.yScale(0)).not.toBeNaN();
|
|
915
|
+
}
|
|
916
|
+
finally {
|
|
917
|
+
cleanup();
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
it('should expand degenerate y domain [5, 5] to [5, 6]', () => {
|
|
921
|
+
const data = [
|
|
922
|
+
{ date: '2024-01', value: 5 },
|
|
923
|
+
{ date: '2024-02', value: 5 },
|
|
924
|
+
];
|
|
925
|
+
const { state, cleanup } = createChartState({
|
|
926
|
+
data,
|
|
927
|
+
x: 'date',
|
|
928
|
+
y: 'value',
|
|
929
|
+
});
|
|
930
|
+
try {
|
|
931
|
+
// _yDomain is undefined (no baseline/explicit domain), domain comes from extents
|
|
932
|
+
expect(state.yDomain).toEqual([5, 5]);
|
|
933
|
+
expect(state.yScale.domain()).toEqual([5, 6]);
|
|
934
|
+
expect(state.yScale(5)).not.toBeNaN();
|
|
935
|
+
}
|
|
936
|
+
finally {
|
|
937
|
+
cleanup();
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
it('should not expand a non-degenerate domain', () => {
|
|
941
|
+
const data = [
|
|
942
|
+
{ date: '2024-01', value: 10 },
|
|
943
|
+
{ date: '2024-02', value: 20 },
|
|
944
|
+
];
|
|
945
|
+
const { state, cleanup } = createChartState({
|
|
946
|
+
data,
|
|
947
|
+
x: 'date',
|
|
948
|
+
y: 'value',
|
|
949
|
+
});
|
|
950
|
+
try {
|
|
951
|
+
expect(state.yScale.domain()).toEqual([10, 20]);
|
|
952
|
+
}
|
|
953
|
+
finally {
|
|
954
|
+
cleanup();
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
});
|
|
958
|
+
describe('ChartState default padding', () => {
|
|
959
|
+
it('should apply default padding when using ChartChildren layout (no children snippet)', () => {
|
|
960
|
+
const { state, cleanup } = createChartState({
|
|
961
|
+
data: [{ date: '2024-01', value: 10 }],
|
|
962
|
+
x: 'date',
|
|
963
|
+
y: 'value',
|
|
964
|
+
// No children prop => ChartChildren renders with axis=true by default
|
|
965
|
+
});
|
|
966
|
+
try {
|
|
967
|
+
expect(state.padding.left).toBeGreaterThan(0);
|
|
968
|
+
expect(state.padding.bottom).toBeGreaterThan(0);
|
|
969
|
+
}
|
|
970
|
+
finally {
|
|
971
|
+
cleanup();
|
|
972
|
+
}
|
|
973
|
+
});
|
|
974
|
+
it('should not apply default padding when children snippet is provided', () => {
|
|
975
|
+
const { state, cleanup } = createChartState({
|
|
976
|
+
data: [{ date: '2024-01', value: 10 }],
|
|
977
|
+
x: 'date',
|
|
978
|
+
y: 'value',
|
|
979
|
+
children: (() => { }), // Simulates user providing children snippet (Treemap, Pack, etc.)
|
|
980
|
+
});
|
|
981
|
+
try {
|
|
982
|
+
expect(state.padding.left).toBe(0);
|
|
983
|
+
expect(state.padding.bottom).toBe(0);
|
|
984
|
+
}
|
|
985
|
+
finally {
|
|
986
|
+
cleanup();
|
|
987
|
+
}
|
|
988
|
+
});
|
|
989
|
+
it('should not apply default padding when axis is explicitly false', () => {
|
|
990
|
+
const { state, cleanup } = createChartState({
|
|
991
|
+
data: [{ date: '2024-01', value: 10 }],
|
|
992
|
+
x: 'date',
|
|
993
|
+
y: 'value',
|
|
994
|
+
axis: false,
|
|
995
|
+
});
|
|
996
|
+
try {
|
|
997
|
+
expect(state.padding.left).toBe(0);
|
|
998
|
+
expect(state.padding.bottom).toBe(0);
|
|
999
|
+
}
|
|
1000
|
+
finally {
|
|
1001
|
+
cleanup();
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
it('should use explicit padding over default', () => {
|
|
1005
|
+
const { state, cleanup } = createChartState({
|
|
1006
|
+
data: [{ date: '2024-01', value: 10 }],
|
|
1007
|
+
x: 'date',
|
|
1008
|
+
y: 'value',
|
|
1009
|
+
padding: { top: 10, right: 10, bottom: 10, left: 10 },
|
|
1010
|
+
});
|
|
1011
|
+
try {
|
|
1012
|
+
expect(state.padding).toEqual({ top: 10, right: 10, bottom: 10, left: 10 });
|
|
1013
|
+
}
|
|
1014
|
+
finally {
|
|
1015
|
+
cleanup();
|
|
1016
|
+
}
|
|
1017
|
+
});
|
|
1018
|
+
});
|
|
1019
|
+
describe('ChartState implicit x/y from marks (no x/y on Chart)', () => {
|
|
1020
|
+
it('should derive x accessor from marks when x prop is absent', () => {
|
|
1021
|
+
const data = [
|
|
1022
|
+
{ date: new Date(2024, 0, 1), value: 30 },
|
|
1023
|
+
{ date: new Date(2024, 1, 1), value: 40 },
|
|
1024
|
+
];
|
|
1025
|
+
const { state, cleanup } = createChartState({});
|
|
1026
|
+
try {
|
|
1027
|
+
state.registerMark({ x: 'date', y: 'value', data });
|
|
1028
|
+
flushSync();
|
|
1029
|
+
expect(state.x(data[0])).toEqual(new Date(2024, 0, 1));
|
|
1030
|
+
// y is derived from implicit series — returns array form (single-element for one series)
|
|
1031
|
+
expect(state.y(data[0])).toEqual([30]);
|
|
1032
|
+
}
|
|
1033
|
+
finally {
|
|
1034
|
+
cleanup();
|
|
1035
|
+
}
|
|
1036
|
+
});
|
|
1037
|
+
it('should derive correct y domain across two marks with different data and no y prop', () => {
|
|
1038
|
+
const temperatureData = [
|
|
1039
|
+
{ date: new Date(2024, 0, 1), value: 32 },
|
|
1040
|
+
{ date: new Date(2024, 1, 1), value: 28 },
|
|
1041
|
+
];
|
|
1042
|
+
const humidityData = [
|
|
1043
|
+
{ date: new Date(2024, 0, 1), value: 60 },
|
|
1044
|
+
{ date: new Date(2024, 1, 1), value: 70 },
|
|
1045
|
+
];
|
|
1046
|
+
const { state, cleanup } = createChartState({});
|
|
1047
|
+
try {
|
|
1048
|
+
state.registerMark({ x: 'date', y: 'value', data: temperatureData, color: 'red' });
|
|
1049
|
+
state.registerMark({ x: 'date', y: 'value', data: humidityData, color: 'blue' });
|
|
1050
|
+
flushSync();
|
|
1051
|
+
// y domain should span both datasets
|
|
1052
|
+
expect(state._yDomain).toEqual([28, 70]);
|
|
1053
|
+
}
|
|
1054
|
+
finally {
|
|
1055
|
+
cleanup();
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
it('should deduplicate repeated mark x keys into a single accessor', () => {
|
|
1059
|
+
const data = [{ date: new Date(2024, 0, 1), value: 10 }];
|
|
1060
|
+
const { state, cleanup } = createChartState({});
|
|
1061
|
+
try {
|
|
1062
|
+
// Two marks, same x='date' — should not create duplicate keys
|
|
1063
|
+
state.registerMark({ x: 'date', y: 'value', data });
|
|
1064
|
+
state.registerMark({ x: 'date', y: 'value', data });
|
|
1065
|
+
flushSync();
|
|
1066
|
+
// x accessor should work normally (not return array of duplicates)
|
|
1067
|
+
expect(state.x(data[0])).toEqual(new Date(2024, 0, 1));
|
|
1068
|
+
}
|
|
1069
|
+
finally {
|
|
1070
|
+
cleanup();
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
it('should use explicit x/y from Chart props over mark-derived values', () => {
|
|
1074
|
+
const data = [{ date: new Date(2024, 0, 1), value: 10 }];
|
|
1075
|
+
const { state, cleanup } = createChartState({
|
|
1076
|
+
x: 'value', // explicit — should override 'date' from marks
|
|
1077
|
+
y: 'value',
|
|
1078
|
+
});
|
|
1079
|
+
try {
|
|
1080
|
+
state.registerMark({ x: 'date', y: 'value', data });
|
|
1081
|
+
flushSync();
|
|
1082
|
+
// Chart props take precedence
|
|
1083
|
+
expect(state.x(data[0])).toEqual(10);
|
|
1084
|
+
}
|
|
1085
|
+
finally {
|
|
1086
|
+
cleanup();
|
|
1087
|
+
}
|
|
1088
|
+
});
|
|
1089
|
+
});
|
|
1090
|
+
describe('ChartState bandPadding auto-derives category axis scale', () => {
|
|
1091
|
+
const wideData = [
|
|
1092
|
+
{ year: '2016', apples: 480, bananas: 240, cherries: 120, grapes: 50 },
|
|
1093
|
+
{ year: '2017', apples: 960, bananas: 480, cherries: 240, grapes: 100 },
|
|
1094
|
+
{ year: '2018', apples: 1920, bananas: 960, cherries: 480, grapes: 200 },
|
|
1095
|
+
{ year: '2019', apples: 3840, bananas: 1920, cherries: 960, grapes: 400 },
|
|
1096
|
+
];
|
|
1097
|
+
it('should use scaleBand on x when bandPadding set and valueAxis=y', () => {
|
|
1098
|
+
const { state, cleanup } = createChartState({
|
|
1099
|
+
data: wideData,
|
|
1100
|
+
x: 'year',
|
|
1101
|
+
y: 'apples',
|
|
1102
|
+
valueAxis: 'y',
|
|
1103
|
+
bandPadding: 0.4,
|
|
1104
|
+
});
|
|
1105
|
+
try {
|
|
1106
|
+
expect(isScaleBand(state.xScale)).toBe(true);
|
|
1107
|
+
expect(state.xScale.bandwidth()).toBeGreaterThan(0);
|
|
1108
|
+
}
|
|
1109
|
+
finally {
|
|
1110
|
+
cleanup();
|
|
1111
|
+
}
|
|
1112
|
+
});
|
|
1113
|
+
it('should use scaleBand on y when bandPadding set and valueAxis=x', () => {
|
|
1114
|
+
const { state, cleanup } = createChartState({
|
|
1115
|
+
data: wideData,
|
|
1116
|
+
y: 'year',
|
|
1117
|
+
x: 'apples',
|
|
1118
|
+
valueAxis: 'x',
|
|
1119
|
+
bandPadding: 0.4,
|
|
1120
|
+
});
|
|
1121
|
+
try {
|
|
1122
|
+
expect(isScaleBand(state.yScale)).toBe(true);
|
|
1123
|
+
expect(state.yScale.bandwidth()).toBeGreaterThan(0);
|
|
1124
|
+
}
|
|
1125
|
+
finally {
|
|
1126
|
+
cleanup();
|
|
1127
|
+
}
|
|
1128
|
+
});
|
|
1129
|
+
it('should not use scaleBand when bandPadding is not set', () => {
|
|
1130
|
+
const data = [
|
|
1131
|
+
{ date: '2024-01', value: 10 },
|
|
1132
|
+
{ date: '2024-02', value: 20 },
|
|
1133
|
+
];
|
|
1134
|
+
const { state, cleanup } = createChartState({
|
|
1135
|
+
data,
|
|
1136
|
+
x: 'date',
|
|
1137
|
+
y: 'value',
|
|
1138
|
+
valueAxis: 'y',
|
|
1139
|
+
});
|
|
1140
|
+
try {
|
|
1141
|
+
// Without bandPadding, autoScale determines the scale from data type
|
|
1142
|
+
// String data should still get scaleBand via autoScale, but without custom padding
|
|
1143
|
+
expect(isScaleBand(state.xScale)).toBe(true);
|
|
1144
|
+
}
|
|
1145
|
+
finally {
|
|
1146
|
+
cleanup();
|
|
1147
|
+
}
|
|
1148
|
+
});
|
|
1149
|
+
});
|
|
1150
|
+
describe('ChartState xInterval forces scaleTime over scaleBand', () => {
|
|
1151
|
+
it('should use scaleTime when xInterval is set even with bandPadding', () => {
|
|
1152
|
+
const data = [
|
|
1153
|
+
{ date: new Date(2024, 0, 1), value: 40 },
|
|
1154
|
+
{ date: new Date(2024, 0, 5), value: 60 },
|
|
1155
|
+
];
|
|
1156
|
+
const { state, cleanup } = createChartState({
|
|
1157
|
+
data,
|
|
1158
|
+
x: 'date',
|
|
1159
|
+
y: 'value',
|
|
1160
|
+
valueAxis: 'y',
|
|
1161
|
+
bandPadding: 0.4,
|
|
1162
|
+
xInterval: timeDay,
|
|
1163
|
+
});
|
|
1164
|
+
try {
|
|
1165
|
+
expect(isScaleBand(state.xScale)).toBe(false);
|
|
1166
|
+
expect(isScaleTime(state.xScale)).toBe(true);
|
|
1167
|
+
}
|
|
1168
|
+
finally {
|
|
1169
|
+
cleanup();
|
|
1170
|
+
}
|
|
1171
|
+
});
|
|
1172
|
+
it('should use scaleBand when xInterval is not set with bandPadding', () => {
|
|
1173
|
+
const { state, cleanup } = createChartState({
|
|
1174
|
+
data: [{ year: '2016', apples: 480, bananas: 240, cherries: 120, grapes: 50 }],
|
|
1175
|
+
x: 'year',
|
|
1176
|
+
y: 'apples',
|
|
1177
|
+
valueAxis: 'y',
|
|
1178
|
+
bandPadding: 0.4,
|
|
1179
|
+
});
|
|
1180
|
+
try {
|
|
1181
|
+
expect(isScaleBand(state.xScale)).toBe(true);
|
|
1182
|
+
}
|
|
1183
|
+
finally {
|
|
1184
|
+
cleanup();
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1187
|
+
});
|
|
1188
|
+
describe('ChartState explicit baseline=null disables auto-baseline', () => {
|
|
1189
|
+
it('should not include baseline=0 in domain when xBaseline=null', () => {
|
|
1190
|
+
const data = [
|
|
1191
|
+
{ label: 'A', start: 15, end: 25 },
|
|
1192
|
+
{ label: 'B', start: 25, end: 35 },
|
|
1193
|
+
];
|
|
1194
|
+
const { state, cleanup } = createChartState({
|
|
1195
|
+
data,
|
|
1196
|
+
x: ['start', 'end'],
|
|
1197
|
+
y: (d) => 1,
|
|
1198
|
+
valueAxis: 'x',
|
|
1199
|
+
bandPadding: 0,
|
|
1200
|
+
xBaseline: null,
|
|
1201
|
+
xNice: false,
|
|
1202
|
+
});
|
|
1203
|
+
try {
|
|
1204
|
+
// Domain should be [15, 35], not [0, 35]
|
|
1205
|
+
const domain = state.xScale.domain();
|
|
1206
|
+
expect(domain[0]).toBe(15);
|
|
1207
|
+
expect(domain[1]).toBe(35);
|
|
1208
|
+
}
|
|
1209
|
+
finally {
|
|
1210
|
+
cleanup();
|
|
1211
|
+
}
|
|
1212
|
+
});
|
|
1213
|
+
it('should include auto-baseline=0 when xBaseline is not provided', () => {
|
|
1214
|
+
const data = [
|
|
1215
|
+
{ label: 'A', start: 15, end: 25 },
|
|
1216
|
+
{ label: 'B', start: 25, end: 35 },
|
|
1217
|
+
];
|
|
1218
|
+
const { state, cleanup } = createChartState({
|
|
1219
|
+
data,
|
|
1220
|
+
x: ['start', 'end'],
|
|
1221
|
+
y: (d) => 1,
|
|
1222
|
+
valueAxis: 'x',
|
|
1223
|
+
bandPadding: 0,
|
|
1224
|
+
xNice: false,
|
|
1225
|
+
// xBaseline not provided — auto-baseline should kick in
|
|
1226
|
+
});
|
|
1227
|
+
try {
|
|
1228
|
+
// Domain should be [0, 35] due to auto-baseline
|
|
1229
|
+
const domain = state.xScale.domain();
|
|
1230
|
+
expect(domain[0]).toBe(0);
|
|
1231
|
+
expect(domain[1]).toBe(35);
|
|
1232
|
+
}
|
|
1233
|
+
finally {
|
|
1234
|
+
cleanup();
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1237
|
+
});
|
|
1238
|
+
describe('ChartState yReverse with band scales', () => {
|
|
1239
|
+
it('should not reverse y when auto-derived scaleBand (horizontal bar chart)', () => {
|
|
1240
|
+
const data = [
|
|
1241
|
+
{ age: '0-4', male: 200, female: 190 },
|
|
1242
|
+
{ age: '5-9', male: 180, female: 175 },
|
|
1243
|
+
{ age: '85+', male: 20, female: 15 },
|
|
1244
|
+
];
|
|
1245
|
+
const { state, cleanup } = createChartState({
|
|
1246
|
+
data,
|
|
1247
|
+
y: 'age',
|
|
1248
|
+
valueAxis: 'x',
|
|
1249
|
+
bandPadding: 0.4,
|
|
1250
|
+
series: [{ key: 'male' }, { key: 'female' }],
|
|
1251
|
+
});
|
|
1252
|
+
try {
|
|
1253
|
+
expect(isScaleBand(state.yScale)).toBe(true);
|
|
1254
|
+
expect(state.yReverse).toBe(false);
|
|
1255
|
+
// Domain should preserve data order (0-4 first)
|
|
1256
|
+
expect(state.yScale.domain()).toEqual(['0-4', '5-9', '85+']);
|
|
1257
|
+
}
|
|
1258
|
+
finally {
|
|
1259
|
+
cleanup();
|
|
1260
|
+
}
|
|
1261
|
+
});
|
|
1262
|
+
it('should not reverse y when explicit scaleBand is provided', () => {
|
|
1263
|
+
const { state, cleanup } = createChartState({
|
|
1264
|
+
data: [
|
|
1265
|
+
{ date: '2024-01', value: 10 },
|
|
1266
|
+
{ date: '2024-02', value: 20 },
|
|
1267
|
+
],
|
|
1268
|
+
y: 'date',
|
|
1269
|
+
yScale: scaleBand().padding(0.4),
|
|
1270
|
+
});
|
|
1271
|
+
try {
|
|
1272
|
+
expect(state.yReverse).toBe(false);
|
|
1273
|
+
}
|
|
1274
|
+
finally {
|
|
1275
|
+
cleanup();
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1278
|
+
it('should reverse y for linear scales (default)', () => {
|
|
1279
|
+
const { state, cleanup } = createChartState({
|
|
1280
|
+
data: [
|
|
1281
|
+
{ date: '2024-01', value: 10 },
|
|
1282
|
+
{ date: '2024-02', value: 20 },
|
|
1283
|
+
],
|
|
1284
|
+
x: 'date',
|
|
1285
|
+
y: 'value',
|
|
1286
|
+
});
|
|
1287
|
+
try {
|
|
1288
|
+
expect(state.yReverse).toBe(true);
|
|
1289
|
+
}
|
|
1290
|
+
finally {
|
|
1291
|
+
cleanup();
|
|
1292
|
+
}
|
|
1293
|
+
});
|
|
1294
|
+
});
|
|
1295
|
+
describe('ChartState auto-baseline from bandPadding', () => {
|
|
1296
|
+
it('should auto-derive yBaseline=0 when bandPadding set and valueAxis=y', () => {
|
|
1297
|
+
const data = [
|
|
1298
|
+
{ date: '2024-01', apples: 50, bananas: 60 },
|
|
1299
|
+
{ date: '2024-02', apples: 70, bananas: 80 },
|
|
1300
|
+
];
|
|
1301
|
+
const { state, cleanup } = createChartState({
|
|
1302
|
+
data,
|
|
1303
|
+
x: 'date',
|
|
1304
|
+
valueAxis: 'y',
|
|
1305
|
+
bandPadding: 0.4,
|
|
1306
|
+
series: [{ key: 'apples' }, { key: 'bananas' }],
|
|
1307
|
+
});
|
|
1308
|
+
try {
|
|
1309
|
+
// With bandPadding, auto-baseline should include 0
|
|
1310
|
+
expect(state._yDomain).toEqual([0, 80]);
|
|
1311
|
+
}
|
|
1312
|
+
finally {
|
|
1313
|
+
cleanup();
|
|
1314
|
+
}
|
|
1315
|
+
});
|
|
1316
|
+
it('should auto-derive xBaseline=0 when bandPadding set and valueAxis=x', () => {
|
|
1317
|
+
const data = [
|
|
1318
|
+
{ date: '2024-01', apples: 50, bananas: 60 },
|
|
1319
|
+
{ date: '2024-02', apples: 70, bananas: 80 },
|
|
1320
|
+
];
|
|
1321
|
+
const { state, cleanup } = createChartState({
|
|
1322
|
+
data,
|
|
1323
|
+
y: 'date',
|
|
1324
|
+
valueAxis: 'x',
|
|
1325
|
+
bandPadding: 0.4,
|
|
1326
|
+
series: [{ key: 'apples' }, { key: 'bananas' }],
|
|
1327
|
+
});
|
|
1328
|
+
try {
|
|
1329
|
+
expect(state._xDomain).toEqual([0, 80]);
|
|
1330
|
+
}
|
|
1331
|
+
finally {
|
|
1332
|
+
cleanup();
|
|
1333
|
+
}
|
|
1334
|
+
});
|
|
1335
|
+
it('should not auto-derive baseline without bandPadding', () => {
|
|
1336
|
+
const data = [
|
|
1337
|
+
{ date: '2024-01', apples: 50, bananas: 60 },
|
|
1338
|
+
{ date: '2024-02', apples: 70, bananas: 80 },
|
|
1339
|
+
];
|
|
1340
|
+
const { state, cleanup } = createChartState({
|
|
1341
|
+
data,
|
|
1342
|
+
x: 'date',
|
|
1343
|
+
valueAxis: 'y',
|
|
1344
|
+
series: [{ key: 'apples' }, { key: 'bananas' }],
|
|
1345
|
+
});
|
|
1346
|
+
try {
|
|
1347
|
+
// Without bandPadding, no auto-baseline — domain is just extent
|
|
1348
|
+
expect(state._yDomain).toEqual([50, 80]);
|
|
1349
|
+
}
|
|
1350
|
+
finally {
|
|
1351
|
+
cleanup();
|
|
1352
|
+
}
|
|
1353
|
+
});
|
|
1354
|
+
it('should respect explicit baseline over auto-baseline', () => {
|
|
1355
|
+
const data = [
|
|
1356
|
+
{ date: '2024-01', apples: 50, bananas: 60 },
|
|
1357
|
+
{ date: '2024-02', apples: 70, bananas: 80 },
|
|
1358
|
+
];
|
|
1359
|
+
const { state, cleanup } = createChartState({
|
|
1360
|
+
data,
|
|
1361
|
+
x: 'date',
|
|
1362
|
+
valueAxis: 'y',
|
|
1363
|
+
bandPadding: 0.4,
|
|
1364
|
+
yBaseline: 10,
|
|
1365
|
+
series: [{ key: 'apples' }, { key: 'bananas' }],
|
|
1366
|
+
});
|
|
1367
|
+
try {
|
|
1368
|
+
// Explicit yBaseline=10 should take precedence over auto-baseline=0
|
|
1369
|
+
expect(state._yDomain).toEqual([10, 80]);
|
|
1370
|
+
}
|
|
1371
|
+
finally {
|
|
1372
|
+
cleanup();
|
|
1373
|
+
}
|
|
1374
|
+
});
|
|
1375
|
+
});
|
|
1376
|
+
describe('ChartState auto-nice from valueAxis', () => {
|
|
1377
|
+
it('should auto-nice the value axis when valueAxis is set', () => {
|
|
1378
|
+
const { state, cleanup } = createChartState({
|
|
1379
|
+
data: [{ date: '2024-01', value: 10 }],
|
|
1380
|
+
x: 'date',
|
|
1381
|
+
y: 'value',
|
|
1382
|
+
valueAxis: 'y',
|
|
1383
|
+
});
|
|
1384
|
+
try {
|
|
1385
|
+
expect(state.yNice).toBe(true);
|
|
1386
|
+
expect(state.xNice).toBe(false);
|
|
1387
|
+
}
|
|
1388
|
+
finally {
|
|
1389
|
+
cleanup();
|
|
1390
|
+
}
|
|
1391
|
+
});
|
|
1392
|
+
it('should auto-nice xNice when valueAxis=x', () => {
|
|
1393
|
+
const { state, cleanup } = createChartState({
|
|
1394
|
+
data: [{ date: '2024-01', value: 10 }],
|
|
1395
|
+
x: 'value',
|
|
1396
|
+
y: 'date',
|
|
1397
|
+
valueAxis: 'x',
|
|
1398
|
+
});
|
|
1399
|
+
try {
|
|
1400
|
+
expect(state.xNice).toBe(true);
|
|
1401
|
+
expect(state.yNice).toBe(false);
|
|
1402
|
+
}
|
|
1403
|
+
finally {
|
|
1404
|
+
cleanup();
|
|
1405
|
+
}
|
|
1406
|
+
});
|
|
1407
|
+
it('should not auto-nice when valueAxis is not set', () => {
|
|
1408
|
+
const { state, cleanup } = createChartState({
|
|
1409
|
+
data: [{ date: '2024-01', value: 10 }],
|
|
1410
|
+
x: 'date',
|
|
1411
|
+
y: 'value',
|
|
1412
|
+
});
|
|
1413
|
+
try {
|
|
1414
|
+
expect(state.xNice).toBe(false);
|
|
1415
|
+
expect(state.yNice).toBe(false);
|
|
1416
|
+
}
|
|
1417
|
+
finally {
|
|
1418
|
+
cleanup();
|
|
1419
|
+
}
|
|
1420
|
+
});
|
|
1421
|
+
it('should respect explicit xNice/yNice over auto-derived', () => {
|
|
1422
|
+
const { state, cleanup } = createChartState({
|
|
1423
|
+
data: [{ date: '2024-01', value: 10 }],
|
|
1424
|
+
x: 'date',
|
|
1425
|
+
y: 'value',
|
|
1426
|
+
valueAxis: 'y',
|
|
1427
|
+
yNice: false,
|
|
1428
|
+
xNice: true,
|
|
1429
|
+
});
|
|
1430
|
+
try {
|
|
1431
|
+
expect(state.yNice).toBe(false);
|
|
1432
|
+
expect(state.xNice).toBe(true);
|
|
1433
|
+
}
|
|
1434
|
+
finally {
|
|
1435
|
+
cleanup();
|
|
1436
|
+
}
|
|
1437
|
+
});
|
|
1438
|
+
});
|
|
1439
|
+
describe('ChartState group layout auto-derives x1/y1', () => {
|
|
1440
|
+
const wideData = [
|
|
1441
|
+
{ year: '2016', apples: 480, bananas: 240, cherries: 120, grapes: 50 },
|
|
1442
|
+
{ year: '2017', apples: 960, bananas: 480, cherries: 240, grapes: 100 },
|
|
1443
|
+
];
|
|
1444
|
+
const series = [{ key: 'apples' }, { key: 'bananas' }, { key: 'cherries' }, { key: 'grapes' }];
|
|
1445
|
+
it('should auto-derive x1Domain from series keys when seriesLayout=group and valueAxis=y', () => {
|
|
1446
|
+
const { state, cleanup } = createChartState({
|
|
1447
|
+
data: wideData,
|
|
1448
|
+
x: 'year',
|
|
1449
|
+
valueAxis: 'y',
|
|
1450
|
+
bandPadding: 0.4,
|
|
1451
|
+
seriesLayout: 'group',
|
|
1452
|
+
series,
|
|
1453
|
+
});
|
|
1454
|
+
try {
|
|
1455
|
+
expect(state.x1Domain).toEqual(['apples', 'bananas', 'cherries', 'grapes']);
|
|
1456
|
+
}
|
|
1457
|
+
finally {
|
|
1458
|
+
cleanup();
|
|
1459
|
+
}
|
|
1460
|
+
});
|
|
1461
|
+
it('should auto-derive y1Domain from series keys when seriesLayout=group and valueAxis=x', () => {
|
|
1462
|
+
const { state, cleanup } = createChartState({
|
|
1463
|
+
data: wideData,
|
|
1464
|
+
y: 'year',
|
|
1465
|
+
valueAxis: 'x',
|
|
1466
|
+
bandPadding: 0.4,
|
|
1467
|
+
seriesLayout: 'group',
|
|
1468
|
+
series,
|
|
1469
|
+
});
|
|
1470
|
+
try {
|
|
1471
|
+
expect(state.y1Domain).toEqual(['apples', 'bananas', 'cherries', 'grapes']);
|
|
1472
|
+
}
|
|
1473
|
+
finally {
|
|
1474
|
+
cleanup();
|
|
1475
|
+
}
|
|
1476
|
+
});
|
|
1477
|
+
it('should auto-create x1Scale as scaleBand for group layout', () => {
|
|
1478
|
+
const { state, cleanup } = createChartState({
|
|
1479
|
+
data: wideData,
|
|
1480
|
+
x: 'year',
|
|
1481
|
+
valueAxis: 'y',
|
|
1482
|
+
bandPadding: 0.4,
|
|
1483
|
+
seriesLayout: 'group',
|
|
1484
|
+
series,
|
|
1485
|
+
});
|
|
1486
|
+
try {
|
|
1487
|
+
expect(state.x1Scale).not.toBeNull();
|
|
1488
|
+
expect(isScaleBand(state.x1Scale)).toBe(true);
|
|
1489
|
+
expect(state.x1Scale.domain()).toEqual(['apples', 'bananas', 'cherries', 'grapes']);
|
|
1490
|
+
}
|
|
1491
|
+
finally {
|
|
1492
|
+
cleanup();
|
|
1493
|
+
}
|
|
1494
|
+
});
|
|
1495
|
+
it('should not auto-derive x1 when seriesLayout is not group', () => {
|
|
1496
|
+
const { state, cleanup } = createChartState({
|
|
1497
|
+
data: wideData,
|
|
1498
|
+
x: 'year',
|
|
1499
|
+
valueAxis: 'y',
|
|
1500
|
+
bandPadding: 0.4,
|
|
1501
|
+
seriesLayout: 'stack',
|
|
1502
|
+
series,
|
|
1503
|
+
});
|
|
1504
|
+
try {
|
|
1505
|
+
expect(state.x1Domain).toBeUndefined();
|
|
1506
|
+
expect(state.x1Scale).toBeNull();
|
|
1507
|
+
}
|
|
1508
|
+
finally {
|
|
1509
|
+
cleanup();
|
|
1510
|
+
}
|
|
1511
|
+
});
|
|
1512
|
+
it('should apply groupPadding to auto-derived x1Scale', () => {
|
|
1513
|
+
const { state: stateNoPad, cleanup: c1 } = createChartState({
|
|
1514
|
+
data: wideData,
|
|
1515
|
+
x: 'year',
|
|
1516
|
+
valueAxis: 'y',
|
|
1517
|
+
bandPadding: 0.4,
|
|
1518
|
+
groupPadding: 0,
|
|
1519
|
+
seriesLayout: 'group',
|
|
1520
|
+
series,
|
|
1521
|
+
});
|
|
1522
|
+
const { state: stateWithPad, cleanup: c2 } = createChartState({
|
|
1523
|
+
data: wideData,
|
|
1524
|
+
x: 'year',
|
|
1525
|
+
valueAxis: 'y',
|
|
1526
|
+
bandPadding: 0.4,
|
|
1527
|
+
groupPadding: 0.5,
|
|
1528
|
+
seriesLayout: 'group',
|
|
1529
|
+
series,
|
|
1530
|
+
});
|
|
1531
|
+
try {
|
|
1532
|
+
// With more padding, bandwidth should be smaller
|
|
1533
|
+
expect(stateWithPad.x1Scale.bandwidth()).toBeLessThan(stateNoPad.x1Scale.bandwidth());
|
|
1534
|
+
}
|
|
1535
|
+
finally {
|
|
1536
|
+
c1();
|
|
1537
|
+
c2();
|
|
1538
|
+
}
|
|
1539
|
+
});
|
|
1540
|
+
it('should update x1Domain to only visible series when toggling legend', () => {
|
|
1541
|
+
const { state, cleanup } = createChartState({
|
|
1542
|
+
data: wideData,
|
|
1543
|
+
x: 'year',
|
|
1544
|
+
valueAxis: 'y',
|
|
1545
|
+
bandPadding: 0.4,
|
|
1546
|
+
seriesLayout: 'group',
|
|
1547
|
+
series,
|
|
1548
|
+
});
|
|
1549
|
+
try {
|
|
1550
|
+
expect(state.x1Domain).toEqual(['apples', 'bananas', 'cherries', 'grapes']);
|
|
1551
|
+
// Select only 'apples' (hides the other 3)
|
|
1552
|
+
state.seriesState.selectedKeys.toggle('apples');
|
|
1553
|
+
flushSync();
|
|
1554
|
+
expect(state.seriesState.visibleSeries).toHaveLength(1);
|
|
1555
|
+
expect(state.x1Domain).toEqual(['apples']);
|
|
1556
|
+
// x1Scale domain should also update
|
|
1557
|
+
expect(state.x1Scale.domain()).toEqual(['apples']);
|
|
1558
|
+
// Deselect to show all again
|
|
1559
|
+
state.seriesState.selectedKeys.toggle('apples');
|
|
1560
|
+
flushSync();
|
|
1561
|
+
expect(state.x1Domain).toEqual(['apples', 'bananas', 'cherries', 'grapes']);
|
|
1562
|
+
}
|
|
1563
|
+
finally {
|
|
1564
|
+
cleanup();
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
it('should update x1Scale bandwidth when series visibility changes', () => {
|
|
1568
|
+
const { state, cleanup } = createChartState({
|
|
1569
|
+
data: wideData,
|
|
1570
|
+
x: 'year',
|
|
1571
|
+
valueAxis: 'y',
|
|
1572
|
+
bandPadding: 0.4,
|
|
1573
|
+
groupPadding: 0,
|
|
1574
|
+
seriesLayout: 'group',
|
|
1575
|
+
series,
|
|
1576
|
+
});
|
|
1577
|
+
try {
|
|
1578
|
+
const initialBandwidth = state.x1Scale.bandwidth();
|
|
1579
|
+
// Select only 'apples'
|
|
1580
|
+
state.seriesState.selectedKeys.toggle('apples');
|
|
1581
|
+
flushSync();
|
|
1582
|
+
// With only 1 series, bandwidth should be larger (full group band)
|
|
1583
|
+
expect(state.x1Scale.bandwidth()).toBeGreaterThan(initialBandwidth);
|
|
1584
|
+
}
|
|
1585
|
+
finally {
|
|
1586
|
+
cleanup();
|
|
1587
|
+
}
|
|
1588
|
+
});
|
|
1589
|
+
});
|
|
1590
|
+
describe('ChartState x1Domain/y1Domain without series', () => {
|
|
1591
|
+
const longData = [
|
|
1592
|
+
{ year: 2019, fruit: 'apples', value: 3840 },
|
|
1593
|
+
{ year: 2019, fruit: 'bananas', value: 1920 },
|
|
1594
|
+
{ year: 2018, fruit: 'apples', value: 1600 },
|
|
1595
|
+
{ year: 2018, fruit: 'bananas', value: 1440 },
|
|
1596
|
+
];
|
|
1597
|
+
it('should pass through explicit x1Domain when no series are configured', () => {
|
|
1598
|
+
const { state, cleanup } = createChartState({
|
|
1599
|
+
data: longData,
|
|
1600
|
+
x: 'year',
|
|
1601
|
+
xScale: scaleBand(),
|
|
1602
|
+
y: 'value',
|
|
1603
|
+
x1: 'fruit',
|
|
1604
|
+
x1Domain: ['apples', 'bananas'],
|
|
1605
|
+
x1Range: ({ xScale }) => [0, xScale.bandwidth()],
|
|
1606
|
+
});
|
|
1607
|
+
try {
|
|
1608
|
+
expect(state.seriesState.series).toHaveLength(0);
|
|
1609
|
+
expect(state.x1Domain).toEqual(['apples', 'bananas']);
|
|
1610
|
+
expect(state.x1Scale.domain()).toEqual(['apples', 'bananas']);
|
|
1611
|
+
}
|
|
1612
|
+
finally {
|
|
1613
|
+
cleanup();
|
|
1614
|
+
}
|
|
1615
|
+
});
|
|
1616
|
+
it('should pass through explicit y1Domain when no series are configured', () => {
|
|
1617
|
+
const { state, cleanup } = createChartState({
|
|
1618
|
+
data: longData,
|
|
1619
|
+
y: 'year',
|
|
1620
|
+
yScale: scaleBand(),
|
|
1621
|
+
x: 'value',
|
|
1622
|
+
y1: 'fruit',
|
|
1623
|
+
y1Domain: ['apples', 'bananas'],
|
|
1624
|
+
y1Range: ({ yScale }) => [0, yScale.bandwidth()],
|
|
1625
|
+
});
|
|
1626
|
+
try {
|
|
1627
|
+
expect(state.seriesState.series).toHaveLength(0);
|
|
1628
|
+
expect(state.y1Domain).toEqual(['apples', 'bananas']);
|
|
1629
|
+
expect(state.y1Scale.domain()).toEqual(['apples', 'bananas']);
|
|
1630
|
+
}
|
|
1631
|
+
finally {
|
|
1632
|
+
cleanup();
|
|
1633
|
+
}
|
|
1634
|
+
});
|
|
1635
|
+
});
|