@pie-lib/charting 7.1.0-beta.9 → 8.0.0-next.20261002100925
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 +20 -0
- package/dist/actions-button.d.ts +26 -0
- package/dist/actions-button.js +84 -0
- package/dist/autosize-input.d.ts +10 -0
- package/dist/autosize-input.js +66 -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 +143 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/axis/Axis.js +67 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/axis/AxisBottom.js +29 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/axis/AxisLeft.js +30 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/axis/AxisRenderer.js +66 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/axis/Ticks.js +39 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/constants/orientation.js +9 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/utils/createPoint.js +14 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/utils/getAxisRangePaddingConfig.js +13 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/utils/getLabelTransform.js +16 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/utils/getTickFormatter.js +8 -0
- package/dist/node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/utils/getTickPosition.js +14 -0
- package/dist/node_modules/.bun/@visx_grid@4.0.0_d84c32d47042070f/node_modules/@visx/grid/esm/grids/GridColumns.js +46 -0
- package/dist/node_modules/.bun/@visx_grid@4.0.0_d84c32d47042070f/node_modules/@visx/grid/esm/grids/GridRows.js +46 -0
- package/dist/node_modules/.bun/@visx_grid@4.0.0_d84c32d47042070f/node_modules/@visx/grid/esm/utils/getScaleBandwidth.js +6 -0
- package/dist/node_modules/.bun/@visx_group@4.0.0_d84c32d47042070f/node_modules/@visx/group/esm/Group.js +17 -0
- package/dist/node_modules/.bun/@visx_point@4.0.0/node_modules/@visx/point/esm/Point.js +20 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/align.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/base.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/clamp.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/constant.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/domain.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/exponent.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/interpolate.js +10 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/nice.js +37 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/padding.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/range.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/reverse.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/round.js +7 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/scaleOperator.js +56 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/unknown.js +6 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/operators/zero.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/scales/band.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/scales/point.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/utils/coerceNumber.js +10 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/utils/createColorInterpolator.js +29 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/utils/getTicks.js +7 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/utils/isUtcScale.js +7 -0
- package/dist/node_modules/.bun/@visx_scale@4.0.0/node_modules/@visx/scale/esm/utils/toString.js +6 -0
- package/dist/node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/shapes/Bar.js +15 -0
- package/dist/node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/shapes/Circle.js +15 -0
- package/dist/node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/shapes/Line.js +27 -0
- package/dist/node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/shapes/LinePath.js +24 -0
- package/dist/node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/util/D3ShapeFactories.js +9 -0
- package/dist/node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/util/setNumberOrNumberAccessor.js +6 -0
- package/dist/node_modules/.bun/@visx_text@4.0.0_d84c32d47042070f/node_modules/@visx/text/esm/Text.js +27 -0
- package/dist/node_modules/.bun/@visx_text@4.0.0_d84c32d47042070f/node_modules/@visx/text/esm/hooks/useText.js +68 -0
- package/dist/node_modules/.bun/@visx_text@4.0.0_d84c32d47042070f/node_modules/@visx/text/esm/util/getStringWidth.js +19 -0
- package/dist/node_modules/.bun/@visx_text@4.0.0_d84c32d47042070f/node_modules/@visx/text/esm/util/memoize.js +13 -0
- package/dist/node_modules/.bun/@visx_vendor@4.0.0/node_modules/@visx/vendor/esm/d3-interpolate.js +8 -0
- package/dist/node_modules/.bun/@visx_vendor@4.0.0/node_modules/@visx/vendor/esm/d3-scale.js +8 -0
- package/dist/node_modules/.bun/@visx_vendor@4.0.0/node_modules/@visx/vendor/esm/d3-shape.js +8 -0
- package/dist/node_modules/.bun/@visx_vendor@4.0.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/classnames@2.5.1/node_modules/classnames/index.js +32 -0
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -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/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/utils.d.ts +39 -0
- package/dist/utils.js +101 -0
- package/package.json +45 -36
- package/CHANGELOG.json +0 -17
- package/CHANGELOG.md +0 -1116
- 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/actions-button.jsx +0 -115
- package/src/axes.jsx +0 -594
- package/src/bars/bar.js +0 -28
- 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/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/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/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
package/src/common/drag-icon.jsx
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { getAdjustedX, getScale } from '../utils';
|
|
4
|
-
|
|
5
|
-
const DragIcon = ({ width, scaleValue, color }) => (
|
|
6
|
-
<svg
|
|
7
|
-
x={getAdjustedX(width, scaleValue)}
|
|
8
|
-
y={getScale(width)?.deltay}
|
|
9
|
-
color={color}
|
|
10
|
-
width={width}
|
|
11
|
-
height={width}
|
|
12
|
-
overflow="visible"
|
|
13
|
-
viewBox={`0 0 ${width} ${width}`}
|
|
14
|
-
style={{ overflow: 'visible !important' }}
|
|
15
|
-
>
|
|
16
|
-
<g xmlns="http://www.w3.org/2000/svg" fill="currentColor" stroke="currentColor" transform={`scale(${scaleValue})`}>
|
|
17
|
-
<circle cx="28.5" cy="23.5" r="22" fill="white" stroke="currentColor" />
|
|
18
|
-
<path
|
|
19
|
-
d="M33.5 21.25H23.4609C22.7578 21.25 22.4062 20.4297 22.9141 19.9219L27.9141 14.9219C28.2266 14.6094 28.7344 14.6094 29.0469 14.9219L34.0469 19.9219C34.5547 20.4297 34.2031 21.25 33.5 21.25Z"
|
|
20
|
-
fill="currentColor"
|
|
21
|
-
/>
|
|
22
|
-
<path
|
|
23
|
-
d="M23.5 25.75L33.5391 25.75C34.2422 25.75 34.5938 26.5703 34.0859 27.0781L29.0859 32.0781C28.7734 32.3906 28.2656 32.3906 27.9531 32.0781L22.9531 27.0781C22.4453 26.5703 22.7969 25.75 23.5 25.75Z"
|
|
24
|
-
fill="currentColor"
|
|
25
|
-
/>
|
|
26
|
-
</g>
|
|
27
|
-
</svg>
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
DragIcon.propTypes = {
|
|
31
|
-
width: PropTypes.number.isRequired,
|
|
32
|
-
scaleValue: PropTypes.number.isRequired,
|
|
33
|
-
color: PropTypes.string,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default DragIcon;
|
package/src/common/styles.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { color } from '@pie-lib/render-ui';
|
|
2
|
-
|
|
3
|
-
export const disabled = (key = 'fill') => ({
|
|
4
|
-
[key]: `var(--graph-disabled, ${color.disabled()})`,
|
|
5
|
-
pointerEvents: 'none',
|
|
6
|
-
border: 'none',
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export const correct = (key = 'fill') => ({
|
|
10
|
-
[key]: color.correct(),
|
|
11
|
-
pointerEvents: 'none',
|
|
12
|
-
border: `solid 1px ${color.correct()}`,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const incorrect = (key = 'fill') => ({
|
|
16
|
-
[key]: color.incorrect(),
|
|
17
|
-
pointerEvents: 'none',
|
|
18
|
-
border: `solid 1px ${color.incorrect()}`,
|
|
19
|
-
});
|
package/src/grid.jsx
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { styled } from '@mui/material/styles';
|
|
4
|
-
import { GridColumns, GridRows } from '@visx/grid';
|
|
5
|
-
|
|
6
|
-
import { types } from '@pie-lib/plot';
|
|
7
|
-
import { color } from '@pie-lib/render-ui';
|
|
8
|
-
|
|
9
|
-
const StyledGridGroup = styled('g')(() => ({
|
|
10
|
-
stroke: color.primaryLight(),
|
|
11
|
-
}));
|
|
12
|
-
|
|
13
|
-
export class Grid extends React.Component {
|
|
14
|
-
static propTypes = {
|
|
15
|
-
className: PropTypes.string,
|
|
16
|
-
graphProps: types.GraphPropsType.isRequired,
|
|
17
|
-
xBand: PropTypes.func,
|
|
18
|
-
columnTickValues: PropTypes.array,
|
|
19
|
-
rowTickValues: PropTypes.array,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
static defaultProps = {};
|
|
23
|
-
|
|
24
|
-
render() {
|
|
25
|
-
const { graphProps, xBand, rowTickValues, columnTickValues } = this.props;
|
|
26
|
-
const { scale = {}, size = {}, range = {} } = graphProps || {};
|
|
27
|
-
const { step = 0, labelStep = 0 } = range;
|
|
28
|
-
const highlightNonLabel = step && labelStep && step < labelStep;
|
|
29
|
-
|
|
30
|
-
// Avoid floating-point precision errors in the % operator.
|
|
31
|
-
// e.g. 0.6 % 0.2 = 0.19999999999999996, but safeModulo(0.6, 0.2) = 0
|
|
32
|
-
const safeModulo = (value, step) => {
|
|
33
|
-
const valueDecimals = (value.toString().split('.')[1] || '').length;
|
|
34
|
-
const stepDecimals =(step.toString().split('.')[1] || '').length
|
|
35
|
-
const decimals = Math.max(valueDecimals, stepDecimals);
|
|
36
|
-
const factor = Math.pow(10, decimals);
|
|
37
|
-
|
|
38
|
-
return ((value * factor) % (step * factor)) / factor;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// if highlightNonLabel is true, we need to separate the unlabeled lines in order to render them in a different color
|
|
42
|
-
const { unlabeledLines, labeledLines } = (rowTickValues || []).reduce(
|
|
43
|
-
(acc, value) => {
|
|
44
|
-
if (highlightNonLabel && safeModulo(value, labelStep) !== 0) {
|
|
45
|
-
acc.unlabeledLines.push(value);
|
|
46
|
-
} else {
|
|
47
|
-
acc.labeledLines.push(value);
|
|
48
|
-
}
|
|
49
|
-
return acc;
|
|
50
|
-
},
|
|
51
|
-
{ unlabeledLines: [], labeledLines: [] },
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<StyledGridGroup>
|
|
56
|
-
<GridRows
|
|
57
|
-
scale={scale.y}
|
|
58
|
-
width={size.width}
|
|
59
|
-
tickValues={unlabeledLines}
|
|
60
|
-
lineStyle={{
|
|
61
|
-
stroke: color.fadedPrimary(),
|
|
62
|
-
strokeWidth: 1,
|
|
63
|
-
}}
|
|
64
|
-
/>
|
|
65
|
-
<GridRows
|
|
66
|
-
scale={scale.y}
|
|
67
|
-
width={size.width}
|
|
68
|
-
tickValues={labeledLines}
|
|
69
|
-
lineStyle={{
|
|
70
|
-
stroke: unlabeledLines.length ? color.visualElementsColors.GRIDLINES_COLOR : color.fadedPrimary(),
|
|
71
|
-
strokeWidth: 1,
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
74
|
-
<GridColumns scale={xBand} height={size.height} offset={xBand.bandwidth() / 2} tickValues={columnTickValues} />
|
|
75
|
-
</StyledGridGroup>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export default Grid;
|
package/src/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import Chart from './chart';
|
|
2
|
-
import chartTypes from './chart-types';
|
|
3
|
-
import ConfigureChartPanel from './chart-setup';
|
|
4
|
-
import ChartType from './chart-type';
|
|
5
|
-
import KeyLegend from './key-legend';
|
|
6
|
-
|
|
7
|
-
export { Chart, chartTypes, ChartType, ConfigureChartPanel, KeyLegend };
|
package/src/key-legend.jsx
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { styled } from '@mui/material/styles';
|
|
4
|
-
import Check from '@mui/icons-material/Check';
|
|
5
|
-
import Close from '@mui/icons-material/Close';
|
|
6
|
-
import { color } from '@pie-lib/render-ui';
|
|
7
|
-
import Translator from '@pie-lib/translator';
|
|
8
|
-
|
|
9
|
-
const StyledContainer = styled('div')(({ theme }) => ({
|
|
10
|
-
backgroundColor: color.defaults.WHITE,
|
|
11
|
-
padding: theme.spacing(2),
|
|
12
|
-
width: '355px',
|
|
13
|
-
boxShadow: 'inset 0px 1px 5px 0px #9297A6',
|
|
14
|
-
display: 'flex',
|
|
15
|
-
flexDirection: 'column',
|
|
16
|
-
gap: '16px',
|
|
17
|
-
}));
|
|
18
|
-
|
|
19
|
-
const StyledRow = styled('div')(() => ({
|
|
20
|
-
display: 'flex',
|
|
21
|
-
alignItems: 'center',
|
|
22
|
-
gap: '12px',
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
const StyledTitle = styled('div')(({ theme }) => ({
|
|
26
|
-
fontSize: theme.typography.h6.fontSize,
|
|
27
|
-
fontWeight: '700',
|
|
28
|
-
}));
|
|
29
|
-
|
|
30
|
-
const StyledSmallText = styled('div')(() => ({
|
|
31
|
-
marginLeft: '2px',
|
|
32
|
-
}));
|
|
33
|
-
|
|
34
|
-
const StyledCorrectIcon = styled(Check)(({ theme }) => ({
|
|
35
|
-
backgroundColor: color.correct(),
|
|
36
|
-
borderRadius: theme.spacing(2),
|
|
37
|
-
color: color.defaults.WHITE,
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
|
-
const StyledIncorrectIcon = styled(Close)(({ theme }) => ({
|
|
41
|
-
backgroundColor: color.incorrectWithIcon(),
|
|
42
|
-
borderRadius: theme.spacing(2),
|
|
43
|
-
color: color.defaults.WHITE,
|
|
44
|
-
}));
|
|
45
|
-
|
|
46
|
-
const StyledLastRow = styled('div')(() => ({
|
|
47
|
-
marginLeft: '3px',
|
|
48
|
-
display: 'flex',
|
|
49
|
-
alignItems: 'center',
|
|
50
|
-
gap: '12px',
|
|
51
|
-
}));
|
|
52
|
-
|
|
53
|
-
const { translator } = Translator;
|
|
54
|
-
|
|
55
|
-
const KeyLegend = ({ language }) => (
|
|
56
|
-
<StyledContainer>
|
|
57
|
-
<StyledTitle>Key</StyledTitle>
|
|
58
|
-
<StyledRow>
|
|
59
|
-
<StyledIncorrectIcon />
|
|
60
|
-
<div>{translator.t('charting.keyLegend.incorrectAnswer', { lng: language })}</div>
|
|
61
|
-
</StyledRow>
|
|
62
|
-
<StyledRow>
|
|
63
|
-
<StyledCorrectIcon />
|
|
64
|
-
<div>{translator.t('charting.keyLegend.correctAnswer', { lng: language })}</div>
|
|
65
|
-
</StyledRow>
|
|
66
|
-
<StyledLastRow>
|
|
67
|
-
<StyledCorrectIcon fontSize={'small'} />
|
|
68
|
-
<StyledSmallText>{translator.t('charting.keyLegend.correctKeyAnswer', { lng: language })}</StyledSmallText>
|
|
69
|
-
</StyledLastRow>
|
|
70
|
-
</StyledContainer>
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
KeyLegend.propTypes = {
|
|
74
|
-
language: PropTypes.string,
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export default KeyLegend;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { styled } from '@mui/material/styles';
|
|
5
|
-
|
|
6
|
-
import { gridDraggable, types, utils } from '@pie-lib/plot';
|
|
7
|
-
import { color } from '@pie-lib/render-ui';
|
|
8
|
-
import { disabled } from '../../common/styles';
|
|
9
|
-
|
|
10
|
-
const StyledDragHandle = styled('g')(({ theme }) => ({
|
|
11
|
-
color: 'black',
|
|
12
|
-
'& .handle': {
|
|
13
|
-
transition: 'fill 200ms linear, height 200ms linear',
|
|
14
|
-
'&.non-interactive': disabled('fill'),
|
|
15
|
-
},
|
|
16
|
-
'& .transparentHandle': {
|
|
17
|
-
height: '20px',
|
|
18
|
-
fill: 'transparent',
|
|
19
|
-
stroke: 'transparent',
|
|
20
|
-
},
|
|
21
|
-
'& .line': {
|
|
22
|
-
stroke: color.defaults.TEXT,
|
|
23
|
-
transition: 'fill 200ms linear, height 200ms linear',
|
|
24
|
-
'&.non-interactive': disabled('stroke'),
|
|
25
|
-
},
|
|
26
|
-
'& .disabledPoint': {
|
|
27
|
-
fill: color.defaults.BLACK + ' !important',
|
|
28
|
-
stroke: color.defaults.BLACK + ' !important',
|
|
29
|
-
},
|
|
30
|
-
'& .correctIcon': {
|
|
31
|
-
backgroundColor: color.correct(),
|
|
32
|
-
},
|
|
33
|
-
'& .incorrectIcon': {
|
|
34
|
-
backgroundColor: color.incorrectWithIcon(),
|
|
35
|
-
},
|
|
36
|
-
'& .correctnessIcon': {
|
|
37
|
-
borderRadius: theme.spacing(2),
|
|
38
|
-
color: color.defaults.WHITE,
|
|
39
|
-
fontSize: '16px',
|
|
40
|
-
width: '16px',
|
|
41
|
-
height: '16px',
|
|
42
|
-
padding: '2px',
|
|
43
|
-
border: `1px solid ${color.defaults.WHITE}`,
|
|
44
|
-
stroke: 'initial',
|
|
45
|
-
boxSizing: 'unset', // to override the default border-box in IBX
|
|
46
|
-
},
|
|
47
|
-
'& .smallIcon': {
|
|
48
|
-
fontSize: '10px',
|
|
49
|
-
width: '10px',
|
|
50
|
-
height: '10px',
|
|
51
|
-
},
|
|
52
|
-
}));
|
|
53
|
-
|
|
54
|
-
class RawDragHandle extends React.Component {
|
|
55
|
-
static propTypes = {
|
|
56
|
-
x: PropTypes.number.isRequired,
|
|
57
|
-
y: PropTypes.number.isRequired,
|
|
58
|
-
width: PropTypes.number,
|
|
59
|
-
graphProps: types.GraphPropsType.isRequired,
|
|
60
|
-
className: PropTypes.string,
|
|
61
|
-
interactive: PropTypes.bool,
|
|
62
|
-
CustomDraggableComponent: PropTypes.func,
|
|
63
|
-
correctness: PropTypes.shape({
|
|
64
|
-
value: PropTypes.string,
|
|
65
|
-
label: PropTypes.string,
|
|
66
|
-
}),
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
render() {
|
|
70
|
-
const { x, y, graphProps, className, interactive, CustomDraggableComponent, correctness, ...rest } = this.props;
|
|
71
|
-
const { scale } = graphProps;
|
|
72
|
-
|
|
73
|
-
if (!CustomDraggableComponent) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<StyledDragHandle>
|
|
79
|
-
<CustomDraggableComponent
|
|
80
|
-
scale={scale}
|
|
81
|
-
x={x}
|
|
82
|
-
y={y}
|
|
83
|
-
className={classNames(className, !interactive && 'non-interactive')}
|
|
84
|
-
correctness={correctness}
|
|
85
|
-
interactive={interactive}
|
|
86
|
-
{...rest}
|
|
87
|
-
/>
|
|
88
|
-
</StyledDragHandle>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export const DragHandle = RawDragHandle;
|
|
94
|
-
|
|
95
|
-
const DraggableHandle = gridDraggable({
|
|
96
|
-
axis: 'y',
|
|
97
|
-
fromDelta: (props, delta) => {
|
|
98
|
-
//TODO: should be in grid-draggable, if axis is y delta.x should always be 0.
|
|
99
|
-
delta.x = 0;
|
|
100
|
-
const newPoint = utils.point(props).add(utils.point(delta));
|
|
101
|
-
|
|
102
|
-
return newPoint.y;
|
|
103
|
-
},
|
|
104
|
-
bounds: (props, { domain, range }) => {
|
|
105
|
-
const area = { left: 0, top: props.y, bottom: props.y, right: 0 };
|
|
106
|
-
|
|
107
|
-
return utils.bounds(area, domain, range);
|
|
108
|
-
},
|
|
109
|
-
anchorPoint: (props) => {
|
|
110
|
-
return { x: props.x, y: props.y };
|
|
111
|
-
},
|
|
112
|
-
})(DragHandle);
|
|
113
|
-
|
|
114
|
-
export default DraggableHandle;
|
package/src/line/common/line.jsx
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Group } from '@visx/group';
|
|
3
|
-
import { LinePath } from '@visx/shape';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { types } from '@pie-lib/plot';
|
|
6
|
-
import DraggableHandle, { DragHandle } from './drag-handle';
|
|
7
|
-
import { styled } from '@mui/material/styles';
|
|
8
|
-
import { isEqual } from 'lodash-es';
|
|
9
|
-
import { color } from '@pie-lib/render-ui';
|
|
10
|
-
|
|
11
|
-
const getData = (data, domain) => {
|
|
12
|
-
const { max } = domain || {};
|
|
13
|
-
const length = data.length;
|
|
14
|
-
|
|
15
|
-
if (!max || !length) {
|
|
16
|
-
return [];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return data.map((el, i) => ({
|
|
20
|
-
...el,
|
|
21
|
-
x: length > 1 ? i * (max / (length - 1)) : 0.5,
|
|
22
|
-
y: el.value,
|
|
23
|
-
}));
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const StyledLinePath = styled(LinePath)(() => ({
|
|
27
|
-
fill: 'transparent',
|
|
28
|
-
stroke: color.defaults.TERTIARY,
|
|
29
|
-
strokeWidth: 3,
|
|
30
|
-
transition: 'stroke 200ms ease-in, stroke-width 200ms ease-in',
|
|
31
|
-
}));
|
|
32
|
-
|
|
33
|
-
export class RawLine extends React.Component {
|
|
34
|
-
static propTypes = {
|
|
35
|
-
onChange: PropTypes.func,
|
|
36
|
-
value: PropTypes.number,
|
|
37
|
-
label: PropTypes.string,
|
|
38
|
-
xBand: PropTypes.func,
|
|
39
|
-
index: PropTypes.number.isRequired,
|
|
40
|
-
graphProps: types.GraphPropsType.isRequired,
|
|
41
|
-
defineChart: PropTypes.bool,
|
|
42
|
-
data: PropTypes.arrayOf(
|
|
43
|
-
PropTypes.shape({
|
|
44
|
-
label: PropTypes.string,
|
|
45
|
-
value: PropTypes.number,
|
|
46
|
-
}),
|
|
47
|
-
),
|
|
48
|
-
CustomDraggableComponent: PropTypes.func,
|
|
49
|
-
correctData: PropTypes.array,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
static defaultProps = {
|
|
53
|
-
index: 0,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
constructor(props) {
|
|
57
|
-
super(props);
|
|
58
|
-
this.state = {
|
|
59
|
-
dragValue: undefined,
|
|
60
|
-
line: getData(props.data, props.graphProps.domain),
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
65
|
-
if (!isEqual(this.props.data, nextProps.data)) {
|
|
66
|
-
this.setState({
|
|
67
|
-
line: getData(nextProps.data, nextProps.graphProps.domain),
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
setDragValue = (line) => this.setState({ line });
|
|
73
|
-
|
|
74
|
-
dragStop = (index) => {
|
|
75
|
-
const { onChange } = this.props;
|
|
76
|
-
this.setState({ dragging: false }, () => {
|
|
77
|
-
onChange(index, this.state.line[index]);
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
dragValue = (index, existing, next) => {
|
|
82
|
-
const newLine = [...this.state.line];
|
|
83
|
-
newLine[index].dragValue = next;
|
|
84
|
-
this.setDragValue(newLine);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
render() {
|
|
88
|
-
const { graphProps, data, CustomDraggableComponent, defineChart, correctData } = this.props;
|
|
89
|
-
const { line: lineState, dragging } = this.state;
|
|
90
|
-
const { scale } = graphProps;
|
|
91
|
-
const lineToUse = dragging ? lineState : getData(data, graphProps.domain);
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<React.Fragment>
|
|
95
|
-
<StyledLinePath
|
|
96
|
-
data={lineToUse}
|
|
97
|
-
x={(d) => scale.x(d.x)}
|
|
98
|
-
y={(d) => scale.y(d.dragValue !== undefined ? d.dragValue : d.y)}
|
|
99
|
-
className="line"
|
|
100
|
-
/>
|
|
101
|
-
{lineToUse &&
|
|
102
|
-
lineToUse.map((point, i) => {
|
|
103
|
-
const r = 6;
|
|
104
|
-
const enableDraggable = defineChart || point.interactive;
|
|
105
|
-
const Component = enableDraggable ? DraggableHandle : DragHandle;
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
<Component
|
|
109
|
-
key={`point-${point.x}-${i}`}
|
|
110
|
-
x={point.x}
|
|
111
|
-
y={point.dragValue !== undefined ? point.dragValue : point.y}
|
|
112
|
-
interactive={enableDraggable}
|
|
113
|
-
r={r}
|
|
114
|
-
onDragStart={() => this.setState({ dragging: true })}
|
|
115
|
-
onDrag={(v) => this.dragValue(i, point.dragValue !== undefined ? point.dragValue : point.y, v)}
|
|
116
|
-
onDragStop={() => this.dragStop(i)}
|
|
117
|
-
graphProps={graphProps}
|
|
118
|
-
CustomDraggableComponent={CustomDraggableComponent}
|
|
119
|
-
correctness={point.correctness}
|
|
120
|
-
correctData={correctData}
|
|
121
|
-
label={point.label}
|
|
122
|
-
/>
|
|
123
|
-
);
|
|
124
|
-
})}
|
|
125
|
-
</React.Fragment>
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const StyledLine = styled(RawLine)(() => ({
|
|
131
|
-
'& .line': {
|
|
132
|
-
fill: 'transparent',
|
|
133
|
-
stroke: color.defaults.TERTIARY,
|
|
134
|
-
strokeWidth: 3,
|
|
135
|
-
transition: 'stroke 200ms ease-in, stroke-width 200ms ease-in',
|
|
136
|
-
},
|
|
137
|
-
}));
|
|
138
|
-
|
|
139
|
-
export class Line extends React.Component {
|
|
140
|
-
static propTypes = {
|
|
141
|
-
data: PropTypes.array,
|
|
142
|
-
onChange: PropTypes.func,
|
|
143
|
-
xBand: PropTypes.func,
|
|
144
|
-
graphProps: types.GraphPropsType.isRequired,
|
|
145
|
-
CustomDraggableComponent: PropTypes.func,
|
|
146
|
-
defineChart: PropTypes.bool,
|
|
147
|
-
correctData: PropTypes.array,
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
changeLine = (index, category) => {
|
|
151
|
-
const { onChange } = this.props;
|
|
152
|
-
const newLine = [...this.props.data];
|
|
153
|
-
const { dragValue, value } = category;
|
|
154
|
-
|
|
155
|
-
newLine[index].value = dragValue >= 0 ? dragValue : value;
|
|
156
|
-
|
|
157
|
-
onChange(newLine);
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
render() {
|
|
161
|
-
const props = this.props;
|
|
162
|
-
|
|
163
|
-
return (
|
|
164
|
-
<Group>
|
|
165
|
-
<StyledLine {...props} onChange={this.changeLine} />
|
|
166
|
-
</Group>
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export default Line;
|
package/src/line/line-cross.js
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { LinePath } from '@visx/shape';
|
|
4
|
-
import { Group } from '@visx/group';
|
|
5
|
-
import { styled } from '@mui/material/styles';
|
|
6
|
-
|
|
7
|
-
import { color } from '@pie-lib/render-ui';
|
|
8
|
-
import { dataToXBand } from '../utils';
|
|
9
|
-
import { types } from '@pie-lib/plot';
|
|
10
|
-
import RawLine from './common/line';
|
|
11
|
-
import { CorrectnessIndicator, SmallCorrectPointIndicator } from '../common/correctness-indicators';
|
|
12
|
-
|
|
13
|
-
const StyledLinePath = styled(LinePath)(() => ({
|
|
14
|
-
stroke: color.defaults.TEXT,
|
|
15
|
-
transition: 'fill 200ms linear, height 200ms linear',
|
|
16
|
-
'&.non-interactive': {
|
|
17
|
-
stroke: color.disabled?.() || '#ccc',
|
|
18
|
-
},
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
const StyledGroup = styled(Group)(({ correctness, interactive }) => ({
|
|
22
|
-
stroke: color.defaults.TEXT,
|
|
23
|
-
transition: 'fill 200ms linear, height 200ms linear',
|
|
24
|
-
...(correctness &&
|
|
25
|
-
!interactive && {
|
|
26
|
-
fill: `${color.defaults.BLACK} !important`,
|
|
27
|
-
stroke: `${color.defaults.BLACK} !important`,
|
|
28
|
-
}),
|
|
29
|
-
'&.non-interactive': {
|
|
30
|
-
stroke: color.disabled?.() || '#ccc',
|
|
31
|
-
},
|
|
32
|
-
}));
|
|
33
|
-
|
|
34
|
-
const StyledTransparentHandle = styled('circle')(() => ({
|
|
35
|
-
height: '20px',
|
|
36
|
-
fill: 'transparent',
|
|
37
|
-
stroke: 'transparent',
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
|
-
const DraggableComponent = (props) => {
|
|
41
|
-
const { className, scale, x, y, r, correctness, interactive, correctData, label, ...rest } = props;
|
|
42
|
-
const [hover, setHover] = useState(false);
|
|
43
|
-
|
|
44
|
-
const squareSize = r * 4;
|
|
45
|
-
const squareHalf = squareSize / 2;
|
|
46
|
-
const cx = scale.x(x);
|
|
47
|
-
const cy = scale.y(y);
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<StyledGroup className={className} correctness={correctness} interactive={interactive}>
|
|
51
|
-
<StyledLinePath
|
|
52
|
-
data={[
|
|
53
|
-
{ x: scale.x(x) - r, y: scale.y(y) + r },
|
|
54
|
-
{ x: scale.x(x) + r, y: scale.y(y) - r },
|
|
55
|
-
]}
|
|
56
|
-
key={`point-${x}-${y}-1`}
|
|
57
|
-
x={(d) => d.x}
|
|
58
|
-
y={(d) => d.y}
|
|
59
|
-
strokeWidth={5}
|
|
60
|
-
style={{ pointerEvents: 'none' }}
|
|
61
|
-
/>
|
|
62
|
-
<StyledLinePath
|
|
63
|
-
data={[
|
|
64
|
-
{ x: scale.x(x) - r, y: scale.y(y) - r },
|
|
65
|
-
{ x: scale.x(x) + r, y: scale.y(y) + r },
|
|
66
|
-
]}
|
|
67
|
-
key={`point-${x}-${y}-2`}
|
|
68
|
-
x={(d) => d.x}
|
|
69
|
-
y={(d) => d.y}
|
|
70
|
-
strokeWidth={5}
|
|
71
|
-
style={{ pointerEvents: 'none' }}
|
|
72
|
-
/>
|
|
73
|
-
{hover && (
|
|
74
|
-
<rect
|
|
75
|
-
x={cx - squareHalf}
|
|
76
|
-
y={cy - squareHalf}
|
|
77
|
-
width={squareSize}
|
|
78
|
-
height={squareSize}
|
|
79
|
-
stroke={color.defaults.BORDER_GRAY}
|
|
80
|
-
fill="none"
|
|
81
|
-
strokeWidth={2}
|
|
82
|
-
pointerEvents="none"
|
|
83
|
-
/>
|
|
84
|
-
)}
|
|
85
|
-
<StyledTransparentHandle
|
|
86
|
-
cx={cx}
|
|
87
|
-
cy={cy}
|
|
88
|
-
r={r * 2}
|
|
89
|
-
onMouseEnter={() => setHover(true)}
|
|
90
|
-
onMouseLeave={() => setHover(false)}
|
|
91
|
-
{...rest}
|
|
92
|
-
/>
|
|
93
|
-
{/* show correctness indicators */}
|
|
94
|
-
<CorrectnessIndicator scale={scale} x={x} y={y} r={r} correctness={correctness} interactive={interactive} />
|
|
95
|
-
{/* show correct point if answer was incorrect */}
|
|
96
|
-
<SmallCorrectPointIndicator
|
|
97
|
-
scale={scale}
|
|
98
|
-
x={x}
|
|
99
|
-
r={r}
|
|
100
|
-
correctness={correctness}
|
|
101
|
-
correctData={correctData}
|
|
102
|
-
label={label}
|
|
103
|
-
/>
|
|
104
|
-
</StyledGroup>
|
|
105
|
-
);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
DraggableComponent.propTypes = {
|
|
109
|
-
scale: PropTypes.object,
|
|
110
|
-
x: PropTypes.number,
|
|
111
|
-
y: PropTypes.number,
|
|
112
|
-
r: PropTypes.number,
|
|
113
|
-
className: PropTypes.string,
|
|
114
|
-
correctness: PropTypes.shape({
|
|
115
|
-
value: PropTypes.string,
|
|
116
|
-
label: PropTypes.string,
|
|
117
|
-
}),
|
|
118
|
-
interactive: PropTypes.bool,
|
|
119
|
-
correctData: PropTypes.array,
|
|
120
|
-
label: PropTypes.string,
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export class LineCross extends React.Component {
|
|
124
|
-
static propTypes = {
|
|
125
|
-
data: PropTypes.array,
|
|
126
|
-
onChange: PropTypes.func,
|
|
127
|
-
graphProps: types.GraphPropsType.isRequired,
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
render() {
|
|
131
|
-
const props = this.props;
|
|
132
|
-
const { data, graphProps } = props;
|
|
133
|
-
const { scale = {}, size = {} } = graphProps || {};
|
|
134
|
-
const xBand = dataToXBand(scale.x, data, size.width, 'lineCross');
|
|
135
|
-
|
|
136
|
-
return <RawLine {...props} xBand={xBand} CustomDraggableComponent={DraggableComponent} />;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export default () => ({
|
|
141
|
-
type: 'lineCross',
|
|
142
|
-
Component: LineCross,
|
|
143
|
-
name: 'Line Cross',
|
|
144
|
-
});
|