@pie-lib/charting 7.0.3 → 7.0.4-next.0
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/dist/_virtual/_rolldown/runtime.js +23 -0
- package/dist/actions-button.d.ts +26 -0
- package/dist/actions-button.js +84 -0
- package/dist/axes.d.ts +84 -0
- package/dist/axes.js +376 -0
- package/dist/bars/bar.d.ts +47 -0
- package/dist/bars/bar.js +27 -0
- package/dist/bars/common/bars.d.ts +98 -0
- package/dist/bars/common/bars.js +174 -0
- package/dist/bars/common/correct-check-icon.d.ts +18 -0
- package/dist/bars/common/correct-check-icon.js +50 -0
- package/dist/bars/histogram.d.ts +47 -0
- package/dist/bars/histogram.js +28 -0
- package/dist/chart-setup.d.ts +29 -0
- package/dist/chart-setup.js +231 -0
- package/dist/chart-type.d.ts +32 -0
- package/dist/chart-type.js +68 -0
- package/dist/chart-types.d.ts +41 -0
- package/dist/chart-types.js +17 -0
- package/dist/chart.d.ts +88 -0
- package/dist/chart.js +250 -0
- package/dist/common/correctness-indicators.d.ts +70 -0
- package/dist/common/correctness-indicators.js +106 -0
- package/dist/common/drag-handle.d.ts +129 -0
- package/dist/common/drag-handle.js +120 -0
- package/dist/common/drag-icon.d.ts +23 -0
- package/dist/common/drag-icon.js +45 -0
- package/dist/common/styles.d.ts +23 -0
- package/dist/common/styles.js +17 -0
- package/dist/grid.d.ts +45 -0
- package/dist/grid.js +56 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +6 -0
- package/dist/key-legend.d.ts +19 -0
- package/dist/key-legend.js +46 -0
- package/dist/line/common/drag-handle.d.ts +120 -0
- package/dist/line/common/drag-handle.js +92 -0
- package/dist/line/common/line.d.ts +96 -0
- package/dist/line/common/line.js +114 -0
- package/dist/line/line-cross.d.ts +47 -0
- package/dist/line/line-cross.js +133 -0
- package/dist/line/line-dot.d.ts +47 -0
- package/dist/line/line-dot.js +101 -0
- package/dist/mark-label.d.ts +55 -0
- package/dist/mark-label.js +139 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Axis.js +100 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisBottom.js +45 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisLeft.js +46 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisRenderer.js +61 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Ticks.js +42 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/constants/orientation.js +9 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/createPoint.js +14 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getAxisRangePaddingConfig.js +21 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getLabelTransform.js +16 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickFormatter.js +8 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickPosition.js +15 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridColumns.js +79 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridRows.js +79 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/utils/getScaleBandwidth.js +6 -0
- package/dist/node_modules/.bun/@visx_group@3.12.0_f4eacebf2041cd4f/node_modules/@visx/group/esm/Group.js +49 -0
- package/dist/node_modules/.bun/@visx_point@3.12.0/node_modules/@visx/point/esm/Point.js +18 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/align.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/base.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/clamp.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/constant.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/domain.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/exponent.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/interpolate.js +10 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/nice.js +37 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/padding.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/range.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/reverse.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/round.js +7 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/scaleOperator.js +58 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/unknown.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/zero.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/scales/band.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/scales/point.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/coerceNumber.js +10 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/createColorInterpolator.js +29 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/getTicks.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/isUtcScale.js +7 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/toString.js +6 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Bar.js +28 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Circle.js +28 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Line.js +46 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/LinePath.js +49 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/D3ShapeFactories.js +9 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/setNumberOrNumberAccessor.js +6 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/lib/shapes/Line.js +52 -0
- package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/Text.js +57 -0
- package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/hooks/useText.js +91 -0
- package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/util/getStringWidth.js +21 -0
- package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-interpolate.js +8 -0
- package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-scale.js +8 -0
- package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-time.js +8 -0
- package/dist/node_modules/.bun/balanced-match@0.4.2/node_modules/balanced-match/index.js +32 -0
- package/dist/node_modules/.bun/balanced-match@1.0.2/node_modules/balanced-match/index.js +33 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Hash.js +21 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_ListCache.js +21 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Map.js +10 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_MapCache.js +21 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Symbol.js +9 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_assocIndexOf.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseGetTag.js +15 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseIsNative.js +16 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_coreJsData.js +9 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_freeGlobal.js +8 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getMapData.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getNative.js +15 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getRawTag.js +19 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getValue.js +11 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashClear.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashDelete.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashGet.js +18 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashHas.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isKeyable.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isMasked.js +16 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheClear.js +11 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheDelete.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheGet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheHas.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheClear.js +19 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheDelete.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheGet.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheHas.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_nativeCreate.js +9 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_objectToString.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_root.js +10 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_toSource.js +20 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/eq.js +11 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isFunction.js +16 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isObject.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/memoize.js +20 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/formula_evaluator.js +37 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/lexer.js +509 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/math_function.js +108 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix.js +31 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix_evaluator.js +45 -0
- package/dist/node_modules/.bun/react-input-autosize@2.2.2_f4eacebf2041cd4f/node_modules/react-input-autosize/lib/AutosizeInput.js +216 -0
- package/dist/node_modules/.bun/reduce-css-calc@1.3.0/node_modules/reduce-css-calc/index.js +49 -0
- package/dist/node_modules/.bun/reduce-function-call@1.0.3/node_modules/reduce-function-call/index.js +34 -0
- package/dist/plot/common/plot.d.ts +103 -0
- package/dist/plot/common/plot.js +227 -0
- package/dist/plot/dot.d.ts +47 -0
- package/dist/plot/dot.js +62 -0
- package/dist/plot/line.d.ts +47 -0
- package/dist/plot/line.js +84 -0
- package/dist/tool-menu.d.ts +31 -0
- package/dist/utils.d.ts +39 -0
- package/dist/utils.js +101 -0
- package/package.json +35 -25
- package/CHANGELOG.json +0 -17
- package/CHANGELOG.md +0 -1116
- package/LICENSE.md +0 -5
- package/lib/actions-button.js +0 -145
- package/lib/actions-button.js.map +0 -1
- package/lib/axes.js +0 -643
- package/lib/axes.js.map +0 -1
- package/lib/bars/bar.js +0 -58
- package/lib/bars/bar.js.map +0 -1
- package/lib/bars/common/bars.js +0 -277
- package/lib/bars/common/bars.js.map +0 -1
- package/lib/bars/common/correct-check-icon.js +0 -54
- package/lib/bars/common/correct-check-icon.js.map +0 -1
- package/lib/bars/histogram.js +0 -59
- package/lib/bars/histogram.js.map +0 -1
- package/lib/chart-setup.js +0 -382
- package/lib/chart-setup.js.map +0 -1
- package/lib/chart-type.js +0 -80
- package/lib/chart-type.js.map +0 -1
- package/lib/chart-types.js +0 -22
- package/lib/chart-types.js.map +0 -1
- package/lib/chart.js +0 -384
- package/lib/chart.js.map +0 -1
- package/lib/common/correctness-indicators.js +0 -156
- package/lib/common/correctness-indicators.js.map +0 -1
- package/lib/common/drag-handle.js +0 -160
- package/lib/common/drag-handle.js.map +0 -1
- package/lib/common/drag-icon.js +0 -52
- package/lib/common/drag-icon.js.map +0 -1
- package/lib/common/styles.js +0 -22
- package/lib/common/styles.js.map +0 -1
- package/lib/grid.js +0 -112
- package/lib/grid.js.map +0 -1
- package/lib/index.js +0 -42
- package/lib/index.js.map +0 -1
- package/lib/key-legend.js +0 -87
- package/lib/key-legend.js.map +0 -1
- package/lib/line/common/drag-handle.js +0 -146
- package/lib/line/common/drag-handle.js.map +0 -1
- package/lib/line/common/line.js +0 -214
- package/lib/line/common/line.js.map +0 -1
- package/lib/line/line-cross.js +0 -214
- package/lib/line/line-cross.js.map +0 -1
- package/lib/line/line-dot.js +0 -158
- package/lib/line/line-dot.js.map +0 -1
- package/lib/mark-label.js +0 -237
- package/lib/mark-label.js.map +0 -1
- package/lib/plot/common/plot.js +0 -349
- package/lib/plot/common/plot.js.map +0 -1
- package/lib/plot/dot.js +0 -110
- package/lib/plot/dot.js.map +0 -1
- package/lib/plot/line.js +0 -140
- package/lib/plot/line.js.map +0 -1
- package/lib/tool-menu.js +0 -106
- package/lib/tool-menu.js.map +0 -1
- package/lib/utils.js +0 -189
- package/lib/utils.js.map +0 -1
- package/src/__tests__/actions-button.test.jsx +0 -280
- package/src/__tests__/axes.test.jsx +0 -667
- package/src/__tests__/chart-setup.test.jsx +0 -532
- package/src/__tests__/chart-type.test.jsx +0 -23
- package/src/__tests__/chart.test.jsx +0 -86
- package/src/__tests__/grid.test.jsx +0 -37
- package/src/__tests__/key-legend.test.jsx +0 -223
- package/src/__tests__/mark-label.test.jsx +0 -33
- package/src/__tests__/tool-menu.test.jsx +0 -522
- package/src/__tests__/utils.js +0 -36
- package/src/__tests__/utils.test.js +0 -100
- package/src/actions-button.jsx +0 -115
- package/src/axes.jsx +0 -594
- package/src/bars/__tests__/bar.test.jsx +0 -45
- package/src/bars/__tests__/histogram.test.jsx +0 -45
- package/src/bars/__tests__/utils.js +0 -30
- package/src/bars/bar.js +0 -28
- package/src/bars/common/__tests__/bars.test.jsx +0 -68
- package/src/bars/common/__tests__/utils.js +0 -30
- package/src/bars/common/bars.jsx +0 -249
- package/src/bars/common/correct-check-icon.jsx +0 -25
- package/src/bars/histogram.js +0 -28
- package/src/chart-setup.jsx +0 -356
- package/src/chart-type.js +0 -59
- package/src/chart-types.js +0 -8
- package/src/chart.jsx +0 -357
- package/src/common/__tests__/correctness-indicators.test.jsx +0 -720
- package/src/common/__tests__/drag-handle.test.jsx +0 -58
- package/src/common/__tests__/utils.js +0 -30
- package/src/common/correctness-indicators.jsx +0 -128
- package/src/common/drag-handle.jsx +0 -125
- package/src/common/drag-icon.jsx +0 -36
- package/src/common/styles.js +0 -19
- package/src/grid.jsx +0 -80
- package/src/index.js +0 -7
- package/src/key-legend.jsx +0 -77
- package/src/line/__tests__/line-cross.test.jsx +0 -463
- package/src/line/__tests__/line-dot.test.jsx +0 -41
- package/src/line/__tests__/utils.js +0 -36
- package/src/line/common/__tests__/drag-handle.test.jsx +0 -62
- package/src/line/common/__tests__/line.test.jsx +0 -79
- package/src/line/common/__tests__/utils.js +0 -30
- package/src/line/common/drag-handle.jsx +0 -114
- package/src/line/common/line.jsx +0 -171
- package/src/line/line-cross.js +0 -144
- package/src/line/line-dot.js +0 -111
- package/src/mark-label.jsx +0 -238
- package/src/plot/__tests__/dot.test.jsx +0 -344
- package/src/plot/__tests__/line.test.jsx +0 -375
- package/src/plot/__tests__/utils.js +0 -30
- package/src/plot/common/__tests__/plot.test.jsx +0 -69
- package/src/plot/common/__tests__/utils.js +0 -30
- package/src/plot/common/plot.jsx +0 -358
- package/src/plot/dot.js +0 -74
- package/src/plot/line.js +0 -98
- package/src/tool-menu.jsx +0 -85
- package/src/utils.js +0 -201
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@pie-lib/test-utils';
|
|
3
|
-
import { createTheme, ThemeProvider } from '@mui/material/styles';
|
|
4
|
-
import Line, { LinePlot } from '../line';
|
|
5
|
-
import { graphProps } from './utils';
|
|
6
|
-
|
|
7
|
-
jest.mock('@mui/icons-material/Check', () => {
|
|
8
|
-
return function Check(props) {
|
|
9
|
-
return <div data-testid="check-icon" {...props} />;
|
|
10
|
-
};
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
jest.mock('@visx/shape', () => ({
|
|
14
|
-
LinePath: ({ data, x, y, ...rest }) => (
|
|
15
|
-
<path d={data.map((d, i) => `${i === 0 ? 'M' : 'L'}${x(d)},${y(d)}`).join(' ')} {...rest} />
|
|
16
|
-
),
|
|
17
|
-
}));
|
|
18
|
-
|
|
19
|
-
jest.mock('@visx/group', () => ({
|
|
20
|
-
Group: ({ children }) => <g className="visx-group">{children}</g>,
|
|
21
|
-
}));
|
|
22
|
-
|
|
23
|
-
let theme;
|
|
24
|
-
|
|
25
|
-
beforeAll(() => {
|
|
26
|
-
theme = createTheme();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
describe('LinePlot', () => {
|
|
30
|
-
const renderComponent = (extras) => {
|
|
31
|
-
const defaults = {
|
|
32
|
-
classes: {},
|
|
33
|
-
className: 'className',
|
|
34
|
-
graphProps: graphProps(),
|
|
35
|
-
xBand: () => {
|
|
36
|
-
return {
|
|
37
|
-
bandwidth: () => {},
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
const props = { ...defaults, ...extras };
|
|
42
|
-
return render(
|
|
43
|
-
<ThemeProvider theme={theme}>
|
|
44
|
-
<svg>
|
|
45
|
-
<LinePlot {...props} />
|
|
46
|
-
</svg>
|
|
47
|
-
</ThemeProvider>,
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
describe('rendering', () => {
|
|
52
|
-
it('renders line plot', () => {
|
|
53
|
-
const { container } = renderComponent();
|
|
54
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('renders without graphProps', () => {
|
|
58
|
-
const { container } = renderComponent({ graphProps: undefined });
|
|
59
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('renders with data array', () => {
|
|
63
|
-
const data = [
|
|
64
|
-
{ value: 1, label: 'A' },
|
|
65
|
-
{ value: 2, label: 'B' },
|
|
66
|
-
{ value: 3, label: 'C' },
|
|
67
|
-
];
|
|
68
|
-
const { container } = renderComponent({ data });
|
|
69
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('renders with empty data array', () => {
|
|
73
|
-
const { container } = renderComponent({ data: [] });
|
|
74
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('renders with null data', () => {
|
|
78
|
-
const { container } = renderComponent({ data: null });
|
|
79
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('renders with undefined data', () => {
|
|
83
|
-
const { container } = renderComponent({ data: undefined });
|
|
84
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('renders with custom className', () => {
|
|
88
|
-
const { container } = renderComponent({ className: 'custom-line-plot' });
|
|
89
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('renders with onChange handler', () => {
|
|
93
|
-
const onChange = jest.fn();
|
|
94
|
-
const { container } = renderComponent({ onChange });
|
|
95
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('renders in defineChart mode', () => {
|
|
99
|
-
const { container } = renderComponent({ defineChart: true });
|
|
100
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('renders with correctData', () => {
|
|
104
|
-
const data = [{ value: 2, label: 'A' }];
|
|
105
|
-
const correctData = [{ value: 3, label: 'A' }];
|
|
106
|
-
const { container } = renderComponent({ data, correctData });
|
|
107
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
describe('graphProps handling', () => {
|
|
112
|
-
it('handles graphProps with missing scale', () => {
|
|
113
|
-
const props = graphProps();
|
|
114
|
-
delete props.scale;
|
|
115
|
-
const { container } = renderComponent({ graphProps: props });
|
|
116
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
it('handles graphProps with missing size', () => {
|
|
120
|
-
const props = graphProps();
|
|
121
|
-
delete props.size;
|
|
122
|
-
const { container } = renderComponent({ graphProps: props });
|
|
123
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('handles graphProps with empty scale object', () => {
|
|
127
|
-
const props = graphProps();
|
|
128
|
-
props.scale = {};
|
|
129
|
-
const { container } = renderComponent({ graphProps: props });
|
|
130
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it('handles graphProps with empty size object', () => {
|
|
134
|
-
const props = graphProps();
|
|
135
|
-
props.size = {};
|
|
136
|
-
const { container } = renderComponent({ graphProps: props });
|
|
137
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
describe('data variations', () => {
|
|
142
|
-
it('renders with single data point', () => {
|
|
143
|
-
const data = [{ value: 1, label: 'A' }];
|
|
144
|
-
const { container } = renderComponent({ data });
|
|
145
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('renders with multiple data points', () => {
|
|
149
|
-
const data = [
|
|
150
|
-
{ value: 1, label: 'A' },
|
|
151
|
-
{ value: 2, label: 'B' },
|
|
152
|
-
{ value: 3, label: 'C' },
|
|
153
|
-
{ value: 4, label: 'D' },
|
|
154
|
-
];
|
|
155
|
-
const { container } = renderComponent({ data });
|
|
156
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it('renders with zero values', () => {
|
|
160
|
-
const data = [
|
|
161
|
-
{ value: 0, label: 'A' },
|
|
162
|
-
{ value: 0, label: 'B' },
|
|
163
|
-
];
|
|
164
|
-
const { container } = renderComponent({ data });
|
|
165
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it('renders with mixed values', () => {
|
|
169
|
-
const data = [
|
|
170
|
-
{ value: 0, label: 'A' },
|
|
171
|
-
{ value: 5, label: 'B' },
|
|
172
|
-
{ value: 1, label: 'C' },
|
|
173
|
-
];
|
|
174
|
-
const { container } = renderComponent({ data });
|
|
175
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
it('renders with large values', () => {
|
|
179
|
-
const data = [
|
|
180
|
-
{ value: 100, label: 'A' },
|
|
181
|
-
{ value: 200, label: 'B' },
|
|
182
|
-
];
|
|
183
|
-
const { container } = renderComponent({ data });
|
|
184
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
it('renders with correctness data', () => {
|
|
188
|
-
const data = [
|
|
189
|
-
{ value: 2, label: 'A', correctness: { value: 'correct', label: 'Correct' } },
|
|
190
|
-
{ value: 3, label: 'B', correctness: { value: 'correct', label: 'Correct' } },
|
|
191
|
-
];
|
|
192
|
-
const { container } = renderComponent({ data });
|
|
193
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
it('renders with incorrect correctness and correctData', () => {
|
|
197
|
-
const data = [
|
|
198
|
-
{ value: 2, label: 'A', correctness: { value: 'incorrect', label: 'Incorrect' } },
|
|
199
|
-
{ value: 3, label: 'B', correctness: { value: 'incorrect', label: 'Incorrect' } },
|
|
200
|
-
];
|
|
201
|
-
const correctData = [
|
|
202
|
-
{ value: 3, label: 'A' },
|
|
203
|
-
{ value: 4, label: 'B' },
|
|
204
|
-
];
|
|
205
|
-
const { container } = renderComponent({ data, correctData });
|
|
206
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
it('renders with interactive data points', () => {
|
|
210
|
-
const data = [
|
|
211
|
-
{ value: 2, label: 'A', interactive: true },
|
|
212
|
-
{ value: 3, label: 'B', interactive: false },
|
|
213
|
-
];
|
|
214
|
-
const { container } = renderComponent({ data });
|
|
215
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
describe('callbacks', () => {
|
|
220
|
-
it('passes onChange handler to Plot component', () => {
|
|
221
|
-
const onChange = jest.fn();
|
|
222
|
-
const data = [{ value: 1, label: 'A' }];
|
|
223
|
-
const { container } = renderComponent({ data, onChange });
|
|
224
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
it('handles onChangeCategory callback', () => {
|
|
228
|
-
const onChangeCategory = jest.fn();
|
|
229
|
-
const data = [{ value: 1, label: 'A' }];
|
|
230
|
-
const { container } = renderComponent({ data, onChangeCategory });
|
|
231
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
describe('component', () => {
|
|
236
|
-
it('returns correct chart object', () => {
|
|
237
|
-
const chart = Line();
|
|
238
|
-
|
|
239
|
-
expect(chart).toEqual({
|
|
240
|
-
type: 'linePlot',
|
|
241
|
-
Component: LinePlot,
|
|
242
|
-
name: 'Line Plot',
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
it('returns object with Component that can be rendered', () => {
|
|
247
|
-
const chart = Line();
|
|
248
|
-
const { Component } = chart;
|
|
249
|
-
|
|
250
|
-
const { container } = render(<Component graphProps={graphProps()} />);
|
|
251
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
describe('CustomBarElement (Line)', () => {
|
|
257
|
-
const renderLinePlot = (props) =>
|
|
258
|
-
render(
|
|
259
|
-
<ThemeProvider theme={theme}>
|
|
260
|
-
<svg>
|
|
261
|
-
<LinePlot {...props} />
|
|
262
|
-
</svg>
|
|
263
|
-
</ThemeProvider>,
|
|
264
|
-
);
|
|
265
|
-
|
|
266
|
-
it('renders line elements', () => {
|
|
267
|
-
const data = [{ value: 1, label: 'A' }];
|
|
268
|
-
const { container } = renderLinePlot({
|
|
269
|
-
data,
|
|
270
|
-
graphProps: graphProps(),
|
|
271
|
-
});
|
|
272
|
-
expect(container).toBeInTheDocument();
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
it('renders with dottedOverline prop', () => {
|
|
276
|
-
const data = [{ value: 2, label: 'A', correctness: { value: 'incorrect' } }];
|
|
277
|
-
const correctData = [{ value: 3, label: 'A' }];
|
|
278
|
-
const { container } = renderLinePlot({
|
|
279
|
-
data,
|
|
280
|
-
graphProps: graphProps(),
|
|
281
|
-
correctData,
|
|
282
|
-
});
|
|
283
|
-
expect(container).toBeInTheDocument();
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
it('renders without dottedOverline prop', () => {
|
|
287
|
-
const data = [{ value: 2, label: 'A' }];
|
|
288
|
-
const { container } = renderLinePlot({
|
|
289
|
-
data,
|
|
290
|
-
graphProps: graphProps(),
|
|
291
|
-
});
|
|
292
|
-
expect(container).toBeInTheDocument();
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
it('renders two LinePath elements for X shape when not dotted', () => {
|
|
296
|
-
const data = [{ value: 3, label: 'A' }];
|
|
297
|
-
const { container } = renderLinePlot({
|
|
298
|
-
data,
|
|
299
|
-
graphProps: graphProps(),
|
|
300
|
-
});
|
|
301
|
-
expect(container).toBeInTheDocument();
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
it('renders rect with dashed stroke when dottedOverline is true', () => {
|
|
305
|
-
const data = [{ value: 2, label: 'A', correctness: { value: 'incorrect' } }];
|
|
306
|
-
const correctData = [{ value: 3, label: 'A' }];
|
|
307
|
-
const { container } = renderLinePlot({
|
|
308
|
-
data,
|
|
309
|
-
graphProps: graphProps(),
|
|
310
|
-
correctData,
|
|
311
|
-
});
|
|
312
|
-
expect(container).toBeInTheDocument();
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
it('calculates correct line positions', () => {
|
|
316
|
-
const data = [{ value: 2, label: 'A' }];
|
|
317
|
-
const { container } = renderLinePlot({
|
|
318
|
-
data,
|
|
319
|
-
graphProps: graphProps(),
|
|
320
|
-
});
|
|
321
|
-
expect(container).toBeInTheDocument();
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
it('handles zero pointDiameter', () => {
|
|
325
|
-
const props = graphProps();
|
|
326
|
-
props.size = { width: 0, height: 0 };
|
|
327
|
-
const data = [{ value: 1, label: 'A' }];
|
|
328
|
-
const { container } = renderLinePlot({
|
|
329
|
-
data,
|
|
330
|
-
graphProps: props,
|
|
331
|
-
});
|
|
332
|
-
expect(container).toBeInTheDocument();
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
it('handles large pointDiameter values', () => {
|
|
336
|
-
const props = graphProps();
|
|
337
|
-
props.size = { width: 1000, height: 1000 };
|
|
338
|
-
const data = [{ value: 1, label: 'A' }];
|
|
339
|
-
const { container } = renderLinePlot({
|
|
340
|
-
data,
|
|
341
|
-
graphProps: props,
|
|
342
|
-
});
|
|
343
|
-
expect(container).toBeInTheDocument();
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
it('applies correct strokeWidth based on pointDiameter', () => {
|
|
347
|
-
const data = [{ value: 2, label: 'A' }];
|
|
348
|
-
const { container } = renderLinePlot({
|
|
349
|
-
data,
|
|
350
|
-
graphProps: graphProps(),
|
|
351
|
-
});
|
|
352
|
-
// strokeWidth should be pointDiameter / 5
|
|
353
|
-
expect(container).toBeInTheDocument();
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
it('renders Group component wrapping LinePaths', () => {
|
|
357
|
-
const data = [{ value: 1, label: 'A' }];
|
|
358
|
-
const { container } = renderLinePlot({
|
|
359
|
-
data,
|
|
360
|
-
graphProps: graphProps(),
|
|
361
|
-
});
|
|
362
|
-
expect(container).toBeInTheDocument();
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
it('handles rect with extra padding when dotted', () => {
|
|
366
|
-
const data = [{ value: 2, label: 'A', correctness: { value: 'incorrect' } }];
|
|
367
|
-
const correctData = [{ value: 3, label: 'A' }];
|
|
368
|
-
const { container } = renderLinePlot({
|
|
369
|
-
data,
|
|
370
|
-
graphProps: graphProps(),
|
|
371
|
-
correctData,
|
|
372
|
-
});
|
|
373
|
-
expect(container).toBeInTheDocument();
|
|
374
|
-
});
|
|
375
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export const scaleMock = () => {
|
|
2
|
-
const fn = jest.fn((n) => n);
|
|
3
|
-
fn.invert = jest.fn((n) => n);
|
|
4
|
-
return fn;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const graphProps = (dmin = 0, dmax = 1, rmin = 0, rmax = 1) => ({
|
|
8
|
-
scale: {
|
|
9
|
-
x: scaleMock(),
|
|
10
|
-
y: scaleMock(),
|
|
11
|
-
},
|
|
12
|
-
snap: {
|
|
13
|
-
x: jest.fn((n) => n),
|
|
14
|
-
y: jest.fn((n) => n),
|
|
15
|
-
},
|
|
16
|
-
domain: {
|
|
17
|
-
min: dmin,
|
|
18
|
-
max: dmax,
|
|
19
|
-
step: 1,
|
|
20
|
-
},
|
|
21
|
-
range: {
|
|
22
|
-
min: rmin,
|
|
23
|
-
max: rmax,
|
|
24
|
-
step: 1,
|
|
25
|
-
},
|
|
26
|
-
size: {
|
|
27
|
-
width: 400,
|
|
28
|
-
height: 400,
|
|
29
|
-
},
|
|
30
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import Plot, { RawPlot } from '../plot';
|
|
4
|
-
import { graphProps } from './utils';
|
|
5
|
-
|
|
6
|
-
describe('Plot', () => {
|
|
7
|
-
const xBand = () => {};
|
|
8
|
-
xBand.bandwidth = () => {};
|
|
9
|
-
const onChange = jest.fn();
|
|
10
|
-
|
|
11
|
-
const renderComponent = (extras) => {
|
|
12
|
-
const defaults = {
|
|
13
|
-
classes: {},
|
|
14
|
-
className: 'className',
|
|
15
|
-
graphProps: graphProps(),
|
|
16
|
-
xBand,
|
|
17
|
-
onChange,
|
|
18
|
-
data: [{ value: 0, label: '0' }],
|
|
19
|
-
};
|
|
20
|
-
const props = { ...defaults, ...extras };
|
|
21
|
-
return render(<Plot {...props} />);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
describe('rendering', () => {
|
|
25
|
-
it('renders without crashing', () => {
|
|
26
|
-
const { container } = renderComponent();
|
|
27
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe('RawPlot', () => {
|
|
33
|
-
const xBand = () => {};
|
|
34
|
-
xBand.bandwidth = () => {};
|
|
35
|
-
const onChangeCategory = jest.fn();
|
|
36
|
-
|
|
37
|
-
const renderComponent = (extras) => {
|
|
38
|
-
const defaults = {
|
|
39
|
-
classes: {},
|
|
40
|
-
className: 'className',
|
|
41
|
-
graphProps: graphProps(),
|
|
42
|
-
xBand,
|
|
43
|
-
onChangeCategory,
|
|
44
|
-
data: [],
|
|
45
|
-
label: 'label',
|
|
46
|
-
CustomBarElement: () => <div />,
|
|
47
|
-
};
|
|
48
|
-
const props = { ...defaults, ...extras };
|
|
49
|
-
return render(<RawPlot {...props} />);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
describe('rendering', () => {
|
|
53
|
-
it('renders without crashing', () => {
|
|
54
|
-
const { container } = renderComponent();
|
|
55
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
describe('functionality', () => {
|
|
60
|
-
it('calls onChangeCategory when drag completes with a value', () => {
|
|
61
|
-
const { container } = renderComponent();
|
|
62
|
-
// Testing drag functionality requires interaction - the component should
|
|
63
|
-
// call onChangeCategory when a drag operation completes with a new value
|
|
64
|
-
// This would typically be tested through user interactions rather than
|
|
65
|
-
// directly calling instance methods
|
|
66
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export const scaleMock = () => {
|
|
2
|
-
const fn = jest.fn((n) => n);
|
|
3
|
-
fn.invert = jest.fn((n) => n);
|
|
4
|
-
return fn;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const graphProps = (dmin = 0, dmax = 1, rmin = 0, rmax = 1) => ({
|
|
8
|
-
scale: {
|
|
9
|
-
x: scaleMock(),
|
|
10
|
-
y: scaleMock(),
|
|
11
|
-
},
|
|
12
|
-
snap: {
|
|
13
|
-
x: jest.fn((n) => n),
|
|
14
|
-
y: jest.fn((n) => n),
|
|
15
|
-
},
|
|
16
|
-
domain: {
|
|
17
|
-
min: dmin,
|
|
18
|
-
max: dmax,
|
|
19
|
-
step: 1,
|
|
20
|
-
},
|
|
21
|
-
range: {
|
|
22
|
-
min: rmin,
|
|
23
|
-
max: rmax,
|
|
24
|
-
step: 1,
|
|
25
|
-
},
|
|
26
|
-
size: {
|
|
27
|
-
width: 400,
|
|
28
|
-
height: 400,
|
|
29
|
-
},
|
|
30
|
-
});
|