@pie-lib/graphing-solution-set 0.1.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/axis/arrow.d.ts +14 -0
- package/dist/axis/arrow.d.ts.map +1 -0
- package/dist/axis/arrow.js +34 -0
- package/dist/axis/axes.d.ts +133 -0
- package/dist/axis/axes.d.ts.map +1 -0
- package/dist/axis/axes.js +214 -0
- package/dist/axis/index.d.ts +11 -0
- package/dist/axis/index.d.ts.map +1 -0
- package/dist/bg.d.ts +52 -0
- package/dist/bg.d.ts.map +1 -0
- package/dist/bg.js +44 -0
- package/dist/container/actions.d.ts +16 -0
- package/dist/container/actions.d.ts.map +1 -0
- package/dist/container/actions.js +7 -0
- package/dist/container/index.d.ts +27 -0
- package/dist/container/index.d.ts.map +1 -0
- package/dist/container/index.js +48 -0
- package/dist/container/marks.d.ts +11 -0
- package/dist/container/marks.d.ts.map +1 -0
- package/dist/container/marks.js +11 -0
- package/dist/container/middleware.d.ts +11 -0
- package/dist/container/middleware.d.ts.map +1 -0
- package/dist/container/middleware.js +4 -0
- package/dist/container/reducer.d.ts +13 -0
- package/dist/container/reducer.d.ts.map +1 -0
- package/dist/container/reducer.js +7 -0
- package/dist/coordinates-label.d.ts +50 -0
- package/dist/coordinates-label.d.ts.map +1 -0
- package/dist/coordinates-label.js +46 -0
- package/dist/graph-with-controls.d.ts +86 -0
- package/dist/graph-with-controls.d.ts.map +1 -0
- package/dist/graph-with-controls.js +155 -0
- package/dist/graph.d.ts +120 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +221 -0
- package/dist/grid-setup.d.ts +27 -0
- package/dist/grid-setup.d.ts.map +1 -0
- package/dist/grid-setup.js +307 -0
- package/dist/grid.d.ts +44 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +59 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/labels.d.ts +74 -0
- package/dist/labels.d.ts.map +1 -0
- package/dist/labels.js +134 -0
- package/dist/mark-label.d.ts +50 -0
- package/dist/mark-label.d.ts.map +1 -0
- package/dist/mark-label.js +84 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +7 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/defineProperty.js +12 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +25 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -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/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/Grid.js +78 -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/utils/coerceNumber.js +10 -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/toString.js +6 -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/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/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/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +68 -0
- package/dist/node_modules/.bun/invariant@2.2.4/node_modules/invariant/browser.js +28 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Hash.js +21 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_ListCache.js +21 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Map.js +10 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_MapCache.js +21 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Symbol.js +9 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +15 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_baseIsNative.js +16 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_coreJsData.js +9 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +8 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getMapData.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getNative.js +15 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getRawTag.js +19 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getValue.js +11 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashClear.js +13 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashDelete.js +12 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashGet.js +18 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashHas.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_isKeyable.js +12 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_isMasked.js +16 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheClear.js +11 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheGet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheHas.js +13 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheClear.js +19 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheDelete.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheGet.js +13 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheHas.js +13 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_nativeCreate.js +9 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_objectToString.js +12 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_root.js +10 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_toSource.js +20 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/eq.js +11 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/isFunction.js +16 -0
- package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/isObject.js +12 -0
- package/dist/node_modules/.bun/lodash@4.17.21/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/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js +82 -0
- package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js +62 -0
- package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/index.js +10 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/Context.js +5 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/Provider.js +47 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/connectAdvanced.js +95 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/connect.js +52 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mapDispatchToProps.js +23 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mapStateToProps.js +13 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mergeProps.js +26 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/selectorFactory.js +41 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/verifySubselectors.js +11 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/wrapMapToProps.js +28 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/index.js +4 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/isPlainObject.js +10 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/shallowEqual.js +15 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/verifyPlainObject.js +8 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/warning.js +9 -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/node_modules/.bun/redux-undo@1.1.0/node_modules/redux-undo/dist/redux-undo.js +185 -0
- package/dist/node_modules/.bun/redux@4.2.1/node_modules/redux/es/redux.js +225 -0
- package/dist/toggle-bar.d.ts +41 -0
- package/dist/toggle-bar.d.ts.map +1 -0
- package/dist/tool-menu.d.ts +22 -0
- package/dist/tool-menu.d.ts.map +1 -0
- package/dist/tool-menu.js +188 -0
- package/dist/tools/index.d.ts +18 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +12 -0
- package/dist/tools/line/component.d.ts +92 -0
- package/dist/tools/line/component.d.ts.map +1 -0
- package/dist/tools/line/component.js +58 -0
- package/dist/tools/line/index.d.ts +14 -0
- package/dist/tools/line/index.d.ts.map +1 -0
- package/dist/tools/line/index.js +6 -0
- package/dist/tools/polygon/component.d.ts +115 -0
- package/dist/tools/polygon/component.d.ts.map +1 -0
- package/dist/tools/polygon/component.js +194 -0
- package/dist/tools/polygon/index.d.ts +20 -0
- package/dist/tools/polygon/index.d.ts.map +1 -0
- package/dist/tools/polygon/index.js +55 -0
- package/dist/tools/polygon/line.d.ts +105 -0
- package/dist/tools/polygon/line.d.ts.map +1 -0
- package/dist/tools/polygon/polygon.d.ts +102 -0
- package/dist/tools/polygon/polygon.d.ts.map +1 -0
- package/dist/tools/polygon/polygon.js +62 -0
- package/dist/tools/shared/arrow-head.d.ts +43 -0
- package/dist/tools/shared/arrow-head.d.ts.map +1 -0
- package/dist/tools/shared/arrow-head.js +37 -0
- package/dist/tools/shared/line/index.d.ts +165 -0
- package/dist/tools/shared/line/index.d.ts.map +1 -0
- package/dist/tools/shared/line/index.js +320 -0
- package/dist/tools/shared/line/line-path.d.ts +58 -0
- package/dist/tools/shared/line/line-path.d.ts.map +1 -0
- package/dist/tools/shared/line/with-root-edge.d.ts +89 -0
- package/dist/tools/shared/line/with-root-edge.d.ts.map +1 -0
- package/dist/tools/shared/point/arrow-point.d.ts +58 -0
- package/dist/tools/shared/point/arrow-point.d.ts.map +1 -0
- package/dist/tools/shared/point/arrow-point.js +47 -0
- package/dist/tools/shared/point/arrow.d.ts +47 -0
- package/dist/tools/shared/point/arrow.d.ts.map +1 -0
- package/dist/tools/shared/point/arrow.js +36 -0
- package/dist/tools/shared/point/base-point.d.ts +51 -0
- package/dist/tools/shared/point/base-point.d.ts.map +1 -0
- package/dist/tools/shared/point/base-point.js +88 -0
- package/dist/tools/shared/point/index.d.ts +154 -0
- package/dist/tools/shared/point/index.d.ts.map +1 -0
- package/dist/tools/shared/point/index.js +51 -0
- package/dist/tools/shared/styles.d.ts +25 -0
- package/dist/tools/shared/styles.d.ts.map +1 -0
- package/dist/tools/shared/styles.js +17 -0
- package/dist/tools/shared/types.d.ts +16 -0
- package/dist/tools/shared/types.d.ts.map +1 -0
- package/dist/tools/shared/types.js +10 -0
- package/dist/undo-redo.d.ts +21 -0
- package/dist/undo-redo.d.ts.map +1 -0
- package/dist/undo-redo.js +33 -0
- package/dist/use-debounce.d.ts +10 -0
- package/dist/use-debounce.d.ts.map +1 -0
- package/dist/use-debounce.js +13 -0
- package/dist/utils.d.ts +59 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +72 -0
- package/package.json +64 -0
- package/src/axis/arrow.tsx +67 -0
- package/src/axis/axes.tsx +321 -0
- package/src/axis/index.ts +13 -0
- package/src/bg.tsx +106 -0
- package/src/container/actions.ts +18 -0
- package/src/container/index.tsx +95 -0
- package/src/container/marks.ts +24 -0
- package/src/container/middleware.ts +17 -0
- package/src/container/reducer.ts +15 -0
- package/src/coordinates-label.tsx +72 -0
- package/src/graph-with-controls.tsx +252 -0
- package/src/graph.tsx +343 -0
- package/src/grid-setup.tsx +470 -0
- package/src/grid.tsx +143 -0
- package/src/index.ts +17 -0
- package/src/labels.tsx +211 -0
- package/src/mark-label.tsx +135 -0
- package/src/toggle-bar.tsx +231 -0
- package/src/tool-menu.tsx +245 -0
- package/src/tools/index.ts +18 -0
- package/src/tools/line/component.tsx +87 -0
- package/src/tools/line/index.ts +14 -0
- package/src/tools/polygon/component.tsx +334 -0
- package/src/tools/polygon/index.ts +62 -0
- package/src/tools/polygon/line.tsx +90 -0
- package/src/tools/polygon/polygon.tsx +103 -0
- package/src/tools/shared/arrow-head.tsx +56 -0
- package/src/tools/shared/line/index.tsx +481 -0
- package/src/tools/shared/line/line-path.tsx +95 -0
- package/src/tools/shared/line/with-root-edge.tsx +107 -0
- package/src/tools/shared/point/arrow-point.tsx +70 -0
- package/src/tools/shared/point/arrow.tsx +50 -0
- package/src/tools/shared/point/base-point.tsx +123 -0
- package/src/tools/shared/point/index.tsx +68 -0
- package/src/tools/shared/styles.ts +30 -0
- package/src/tools/shared/types.ts +18 -0
- package/src/undo-redo.tsx +47 -0
- package/src/use-debounce.ts +23 -0
- package/src/utils.ts +240 -0
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-lib/packages/graphing-solution-set/src/grid-setup.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
import { color, InputContainer as InputContainerImport } from '@pie-lib/render-ui';
|
|
14
|
+
|
|
15
|
+
function isRenderableReactInteropType(value: any) {
|
|
16
|
+
return (
|
|
17
|
+
typeof value === 'function' ||
|
|
18
|
+
(typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {
|
|
23
|
+
if (!maybeSymbol) return maybeSymbol;
|
|
24
|
+
if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;
|
|
25
|
+
if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;
|
|
26
|
+
if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {
|
|
27
|
+
return maybeSymbol[namedExport];
|
|
28
|
+
}
|
|
29
|
+
if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {
|
|
30
|
+
return maybeSymbol[namedExport].default;
|
|
31
|
+
}
|
|
32
|
+
return maybeSymbol;
|
|
33
|
+
}
|
|
34
|
+
const InputContainer = unwrapReactInteropSymbol(InputContainerImport, 'InputContainer') || unwrapReactInteropSymbol(renderUi.InputContainer, 'InputContainer');
|
|
35
|
+
import * as RenderUiNamespace from '@pie-lib/render-ui';
|
|
36
|
+
const renderUiNamespaceAny = RenderUiNamespace as any;
|
|
37
|
+
const renderUiDefaultMaybe = renderUiNamespaceAny['default'];
|
|
38
|
+
const renderUi =
|
|
39
|
+
renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'
|
|
40
|
+
? renderUiDefaultMaybe
|
|
41
|
+
: renderUiNamespaceAny;
|
|
42
|
+
import { Accordion, AccordionDetails, AccordionSummary, Typography } from '@mui/material';
|
|
43
|
+
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
44
|
+
import { NumberTextFieldCustom, Toggle } from '@pie-lib/config-ui';
|
|
45
|
+
import EditableHTML from '@pie-lib/editable-html-tip-tap';
|
|
46
|
+
import { styled } from '@mui/material/styles';
|
|
47
|
+
|
|
48
|
+
const Wrapper: any = styled('div')(() => ({
|
|
49
|
+
width: '450px',
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
const Content: any = styled('div')(() => ({
|
|
53
|
+
display: 'flex',
|
|
54
|
+
flexDirection: 'column',
|
|
55
|
+
width: '100%',
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
const ColumnView: any = styled('div')(() => ({
|
|
59
|
+
display: 'flex',
|
|
60
|
+
flexDirection: 'column',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
const RowView: any = styled('div')(() => ({
|
|
65
|
+
display: 'flex',
|
|
66
|
+
justifyContent: 'space-around',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
}));
|
|
69
|
+
|
|
70
|
+
const TextFieldSmall: any = styled('div')(({ theme }) => ({
|
|
71
|
+
width: '130px',
|
|
72
|
+
margin: `${theme.spacing(1)} ${theme.spacing(0.5)}`,
|
|
73
|
+
}));
|
|
74
|
+
|
|
75
|
+
const TextFieldMedium: any = styled('div')(({ theme }) => ({
|
|
76
|
+
width: '160px',
|
|
77
|
+
margin: `${theme.spacing(1)} ${theme.spacing(0.5)}`,
|
|
78
|
+
'& .MuiFormControl-root': {
|
|
79
|
+
width: '100%',
|
|
80
|
+
},
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
const TextFieldLarge: any = styled('div')(({ theme }) => ({
|
|
84
|
+
width: '230px',
|
|
85
|
+
margin: `${theme.spacing(1)} ${theme.spacing(0.5)}`,
|
|
86
|
+
'& .MuiFormControl-root': {
|
|
87
|
+
width: '100%',
|
|
88
|
+
},
|
|
89
|
+
}));
|
|
90
|
+
|
|
91
|
+
const ItalicText: any = styled(Typography)(({ theme }) => ({
|
|
92
|
+
fontStyle: 'italic',
|
|
93
|
+
margin: `${theme.spacing(1)} 0`,
|
|
94
|
+
}));
|
|
95
|
+
|
|
96
|
+
const Dimensions: any = styled('div')(() => ({
|
|
97
|
+
display: 'flex',
|
|
98
|
+
justifyContent: 'space-between',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
}));
|
|
101
|
+
|
|
102
|
+
const DisabledText: any = styled(Typography)(() => ({
|
|
103
|
+
color: color.disabled(),
|
|
104
|
+
}));
|
|
105
|
+
|
|
106
|
+
const AxisLabel: any = styled('div')(({ theme }) => ({
|
|
107
|
+
paddingTop: theme.spacing(2),
|
|
108
|
+
}));
|
|
109
|
+
|
|
110
|
+
const GridConfig = (props) => {
|
|
111
|
+
const { disabled, displayedFields, labelValue, labelValues, gridValue, gridValues, onChange } = props;
|
|
112
|
+
const { labelStep = {}, step = {} } = displayedFields;
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<ColumnView>
|
|
116
|
+
{step && step.enabled && (
|
|
117
|
+
<TextFieldMedium>
|
|
118
|
+
<NumberTextFieldCustom
|
|
119
|
+
label={step.label || ''}
|
|
120
|
+
value={gridValue}
|
|
121
|
+
customValues={gridValues}
|
|
122
|
+
variant="outlined"
|
|
123
|
+
disabled={disabled}
|
|
124
|
+
onChange={(e, v) => onChange('step', v)}
|
|
125
|
+
/>
|
|
126
|
+
</TextFieldMedium>
|
|
127
|
+
)}
|
|
128
|
+
{labelStep && labelStep.enabled && (
|
|
129
|
+
<TextFieldMedium>
|
|
130
|
+
<NumberTextFieldCustom
|
|
131
|
+
label={labelStep.label || ''}
|
|
132
|
+
value={labelValue}
|
|
133
|
+
customValues={labelValues}
|
|
134
|
+
variant="outlined"
|
|
135
|
+
disabled={disabled}
|
|
136
|
+
onChange={(e, v) => onChange('labelStep', v)}
|
|
137
|
+
/>
|
|
138
|
+
</TextFieldMedium>
|
|
139
|
+
)}
|
|
140
|
+
</ColumnView>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
GridConfig.propTypes = {
|
|
145
|
+
disabled: PropTypes.bool,
|
|
146
|
+
displayedFields: PropTypes.object,
|
|
147
|
+
labelValue: PropTypes.number,
|
|
148
|
+
labelValues: PropTypes.array,
|
|
149
|
+
gridValue: PropTypes.number,
|
|
150
|
+
gridValues: PropTypes.array,
|
|
151
|
+
onChange: PropTypes.func,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const AxisConfig = (props) => {
|
|
155
|
+
const { disabled, displayedFields, displayHeader, label, maxValue, minValue, onChange, type } = props;
|
|
156
|
+
const { axisLabel = {}, min = {}, max = {} } = displayedFields;
|
|
157
|
+
const activePlugins = ['bold', 'italic', 'underline', 'strikethrough'];
|
|
158
|
+
|
|
159
|
+
const onKeyDown = (event) => {
|
|
160
|
+
if (event.key === 'Enter') {
|
|
161
|
+
// prevent adding new lines - cancelling event
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return false;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<ColumnView>
|
|
170
|
+
{displayHeader && (
|
|
171
|
+
<Typography variant="subtitle2">
|
|
172
|
+
<i>{type === 'domain' ? 'x' : 'y'}</i>-axis
|
|
173
|
+
</Typography>
|
|
174
|
+
)}
|
|
175
|
+
{min && min.enabled && (
|
|
176
|
+
<TextFieldMedium>
|
|
177
|
+
<NumberTextFieldCustom
|
|
178
|
+
label={min.label || ''}
|
|
179
|
+
value={minValue}
|
|
180
|
+
min={-10000}
|
|
181
|
+
max={maxValue - 0.05}
|
|
182
|
+
variant="outlined"
|
|
183
|
+
disabled={disabled}
|
|
184
|
+
onChange={(e, v) => onChange('min', v)}
|
|
185
|
+
/>
|
|
186
|
+
</TextFieldMedium>
|
|
187
|
+
)}
|
|
188
|
+
{max && max.enabled && (
|
|
189
|
+
<TextFieldMedium>
|
|
190
|
+
<NumberTextFieldCustom
|
|
191
|
+
label={max.label || ''}
|
|
192
|
+
value={maxValue}
|
|
193
|
+
min={minValue + 0.05}
|
|
194
|
+
max={10000}
|
|
195
|
+
variant="outlined"
|
|
196
|
+
disabled={disabled}
|
|
197
|
+
onChange={(e, v) => onChange('max', v)}
|
|
198
|
+
/>
|
|
199
|
+
</TextFieldMedium>
|
|
200
|
+
)}
|
|
201
|
+
{axisLabel && axisLabel.enabled && (
|
|
202
|
+
<TextFieldMedium>
|
|
203
|
+
<InputContainer label={axisLabel.label || ''}>
|
|
204
|
+
<AxisLabel>
|
|
205
|
+
<EditableHTML
|
|
206
|
+
onChange={(value) => onChange('axisLabel', value)}
|
|
207
|
+
markup={label || ''}
|
|
208
|
+
charactersLimit={5}
|
|
209
|
+
onKeyDown={onKeyDown}
|
|
210
|
+
activePlugins={activePlugins}
|
|
211
|
+
/>
|
|
212
|
+
</AxisLabel>
|
|
213
|
+
</InputContainer>
|
|
214
|
+
</TextFieldMedium>
|
|
215
|
+
)}
|
|
216
|
+
</ColumnView>
|
|
217
|
+
);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
AxisConfig.propTypes = {
|
|
221
|
+
disabled: PropTypes.bool,
|
|
222
|
+
displayedFields: PropTypes.object,
|
|
223
|
+
displayHeader: PropTypes.bool,
|
|
224
|
+
label: PropTypes.string,
|
|
225
|
+
maxValue: PropTypes.number,
|
|
226
|
+
minValue: PropTypes.number,
|
|
227
|
+
type: PropTypes.string,
|
|
228
|
+
onChange: PropTypes.func,
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const GridSetup = (props) => {
|
|
232
|
+
const {
|
|
233
|
+
domain,
|
|
234
|
+
displayedFields = {},
|
|
235
|
+
gridValues = {},
|
|
236
|
+
includeAxes,
|
|
237
|
+
labelValues = {},
|
|
238
|
+
onChange,
|
|
239
|
+
onChangeView,
|
|
240
|
+
range,
|
|
241
|
+
size,
|
|
242
|
+
sizeConstraints,
|
|
243
|
+
standardGrid,
|
|
244
|
+
} = props;
|
|
245
|
+
|
|
246
|
+
const gridProps = { min: 2, max: 41 };
|
|
247
|
+
const {
|
|
248
|
+
axisLabel = {},
|
|
249
|
+
dimensionsEnabled,
|
|
250
|
+
includeAxesEnabled,
|
|
251
|
+
labelStep = {},
|
|
252
|
+
min = {},
|
|
253
|
+
max = {},
|
|
254
|
+
standardGridEnabled,
|
|
255
|
+
step = {},
|
|
256
|
+
} = displayedFields || {};
|
|
257
|
+
|
|
258
|
+
const displayAxisType = min.enabled || max.enabled || axisLabel.enabled || step.enabled || labelStep.enabled;
|
|
259
|
+
const gridConfigFields = { step, labelStep };
|
|
260
|
+
const axisConfigFields = { min, max, axisLabel };
|
|
261
|
+
|
|
262
|
+
const onIncludeAxes = (includeAxes) => {
|
|
263
|
+
const noAxesConfig = (type) => {
|
|
264
|
+
const axis = type === 'domain' ? domain : range;
|
|
265
|
+
return {
|
|
266
|
+
min: 1,
|
|
267
|
+
max: axis.max < gridProps.min || axis.max > gridProps.max ? 16 : axis.max,
|
|
268
|
+
step: 1,
|
|
269
|
+
labelStep: 0,
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
const updatedRange = {
|
|
274
|
+
...range,
|
|
275
|
+
...(includeAxes ? { labelStep: 1 } : noAxesConfig('range')),
|
|
276
|
+
};
|
|
277
|
+
const updatedDomain = {
|
|
278
|
+
...domain,
|
|
279
|
+
...(includeAxes ? { labelStep: 1 } : noAxesConfig('domain')),
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
onChange({ includeAxes, range: updatedRange, domain: updatedDomain });
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
const onStandardGridChanged = (value) => {
|
|
286
|
+
onChange({
|
|
287
|
+
standardGrid: value,
|
|
288
|
+
range: {
|
|
289
|
+
...domain,
|
|
290
|
+
axisLabel: range.axisLabel,
|
|
291
|
+
},
|
|
292
|
+
graph: {
|
|
293
|
+
...size,
|
|
294
|
+
height: size.width,
|
|
295
|
+
},
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const onSizeChanged = (key, value) => {
|
|
300
|
+
const graph = { ...size, [key]: value };
|
|
301
|
+
if (standardGrid) graph.height = value;
|
|
302
|
+
onChange({ graph });
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
const onDomainChanged = (key, value) => {
|
|
306
|
+
domain[key] = value;
|
|
307
|
+
if (standardGrid && key !== 'axisLabel') range[key] = value;
|
|
308
|
+
onChange({ domain, range });
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
const onRangeChanged = (key, value) => {
|
|
312
|
+
range[key] = value;
|
|
313
|
+
onChange({ range });
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
const axesConfig = (
|
|
317
|
+
<>
|
|
318
|
+
<RowView>
|
|
319
|
+
<AxisConfig
|
|
320
|
+
displayedFields={axisConfigFields}
|
|
321
|
+
displayHeader={displayAxisType}
|
|
322
|
+
type="domain"
|
|
323
|
+
minValue={domain.min}
|
|
324
|
+
maxValue={domain.max}
|
|
325
|
+
label={domain.axisLabel}
|
|
326
|
+
includeAxes={includeAxes}
|
|
327
|
+
onChange={onDomainChanged}
|
|
328
|
+
/>
|
|
329
|
+
<AxisConfig
|
|
330
|
+
displayedFields={axisConfigFields}
|
|
331
|
+
displayHeader={displayAxisType}
|
|
332
|
+
type="range"
|
|
333
|
+
minValue={range.min}
|
|
334
|
+
maxValue={range.max}
|
|
335
|
+
label={range.axisLabel}
|
|
336
|
+
disabled={standardGrid}
|
|
337
|
+
includeAxes={includeAxes}
|
|
338
|
+
onChange={onRangeChanged}
|
|
339
|
+
/>
|
|
340
|
+
</RowView>
|
|
341
|
+
{(min.enabled || max.enabled) && (
|
|
342
|
+
<ItalicText>
|
|
343
|
+
If you want the axis to be visible, use a zero or negative Min Value, and a positive Max Value
|
|
344
|
+
</ItalicText>
|
|
345
|
+
)}
|
|
346
|
+
{(step.enabled || labelStep.enabled) && (
|
|
347
|
+
<RowView>
|
|
348
|
+
<GridConfig
|
|
349
|
+
displayedFields={gridConfigFields}
|
|
350
|
+
gridValue={domain.step}
|
|
351
|
+
labelValue={domain.labelStep}
|
|
352
|
+
gridValues={gridValues.domain || []}
|
|
353
|
+
labelValues={labelValues.domain || []}
|
|
354
|
+
onChange={onDomainChanged}
|
|
355
|
+
/>
|
|
356
|
+
<GridConfig
|
|
357
|
+
disabled={standardGrid}
|
|
358
|
+
displayedFields={gridConfigFields}
|
|
359
|
+
gridValue={range.step}
|
|
360
|
+
labelValue={range.labelStep}
|
|
361
|
+
gridValues={gridValues.range || []}
|
|
362
|
+
labelValues={labelValues.range || []}
|
|
363
|
+
onChange={onRangeChanged}
|
|
364
|
+
/>
|
|
365
|
+
</RowView>
|
|
366
|
+
)}
|
|
367
|
+
{labelStep.enabled && <ItalicText>For unnumbered gridlines, enter a label interval of 0</ItalicText>}
|
|
368
|
+
</>
|
|
369
|
+
);
|
|
370
|
+
|
|
371
|
+
const gridlinesConfig = max.enabled ? (
|
|
372
|
+
<ColumnView>
|
|
373
|
+
<TextFieldLarge>
|
|
374
|
+
<NumberTextFieldCustom
|
|
375
|
+
label="Number of Vertical Gridlines"
|
|
376
|
+
value={domain.max}
|
|
377
|
+
min={!includeAxes && gridProps.min}
|
|
378
|
+
max={!includeAxes && gridProps.max}
|
|
379
|
+
variant="outlined"
|
|
380
|
+
onChange={(e, v) => onDomainChanged('max', v)}
|
|
381
|
+
/>
|
|
382
|
+
</TextFieldLarge>
|
|
383
|
+
<TextFieldLarge>
|
|
384
|
+
<NumberTextFieldCustom
|
|
385
|
+
label="Number of Horizontal Gridlines"
|
|
386
|
+
value={range.max}
|
|
387
|
+
min={!includeAxes && gridProps.min}
|
|
388
|
+
max={!includeAxes && gridProps.max}
|
|
389
|
+
variant="outlined"
|
|
390
|
+
disabled={standardGrid}
|
|
391
|
+
onChange={(e, v) => onRangeChanged('max', v)}
|
|
392
|
+
/>
|
|
393
|
+
</TextFieldLarge>
|
|
394
|
+
</ColumnView>
|
|
395
|
+
) : null;
|
|
396
|
+
|
|
397
|
+
return (
|
|
398
|
+
<Wrapper>
|
|
399
|
+
<Accordion onChange={onChangeView} TransitionProps={{ timeout: { enter: 225, exit: 195 } }}>
|
|
400
|
+
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
|
|
401
|
+
<Typography variant="subtitle1">Customize Grid Setup</Typography>
|
|
402
|
+
</AccordionSummary>
|
|
403
|
+
<AccordionDetails>
|
|
404
|
+
<Content>
|
|
405
|
+
{includeAxesEnabled && (
|
|
406
|
+
<Toggle label="Include axes and labels?" toggle={onIncludeAxes} checked={includeAxes} />
|
|
407
|
+
)}
|
|
408
|
+
{standardGridEnabled && (
|
|
409
|
+
<Toggle
|
|
410
|
+
label="Constrain to standard coordinate grid?"
|
|
411
|
+
toggle={onStandardGridChanged}
|
|
412
|
+
checked={standardGrid}
|
|
413
|
+
/>
|
|
414
|
+
)}
|
|
415
|
+
{includeAxes ? axesConfig : gridlinesConfig}
|
|
416
|
+
{dimensionsEnabled && (
|
|
417
|
+
<Dimensions>
|
|
418
|
+
<div>
|
|
419
|
+
<Typography>Dimensions(px)</Typography>
|
|
420
|
+
<DisabledText>
|
|
421
|
+
Min {sizeConstraints.min}, Max {sizeConstraints.max}
|
|
422
|
+
</DisabledText>
|
|
423
|
+
</div>
|
|
424
|
+
<TextFieldSmall>
|
|
425
|
+
<NumberTextFieldCustom
|
|
426
|
+
label="Width"
|
|
427
|
+
value={size.width}
|
|
428
|
+
min={sizeConstraints.min}
|
|
429
|
+
max={sizeConstraints.max}
|
|
430
|
+
step={sizeConstraints.step}
|
|
431
|
+
variant="outlined"
|
|
432
|
+
onChange={(e, v) => onSizeChanged('width', v)}
|
|
433
|
+
/>
|
|
434
|
+
</TextFieldSmall>
|
|
435
|
+
<TextFieldSmall>
|
|
436
|
+
<NumberTextFieldCustom
|
|
437
|
+
label="Height"
|
|
438
|
+
value={size.height}
|
|
439
|
+
min={sizeConstraints.min}
|
|
440
|
+
max={sizeConstraints.max}
|
|
441
|
+
step={sizeConstraints.step}
|
|
442
|
+
variant="outlined"
|
|
443
|
+
disabled={standardGrid}
|
|
444
|
+
onChange={(e, v) => onSizeChanged('height', v)}
|
|
445
|
+
/>
|
|
446
|
+
</TextFieldSmall>
|
|
447
|
+
</Dimensions>
|
|
448
|
+
)}
|
|
449
|
+
</Content>
|
|
450
|
+
</AccordionDetails>
|
|
451
|
+
</Accordion>
|
|
452
|
+
</Wrapper>
|
|
453
|
+
);
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
GridSetup.propTypes = {
|
|
457
|
+
domain: PropTypes.object,
|
|
458
|
+
displayedFields: PropTypes.object,
|
|
459
|
+
gridValues: PropTypes.object,
|
|
460
|
+
includeAxes: PropTypes.bool,
|
|
461
|
+
labelValues: PropTypes.object,
|
|
462
|
+
onChange: PropTypes.func,
|
|
463
|
+
onChangeView: PropTypes.func,
|
|
464
|
+
range: PropTypes.object,
|
|
465
|
+
size: PropTypes.object,
|
|
466
|
+
sizeConstraints: PropTypes.object,
|
|
467
|
+
standardGrid: PropTypes.bool,
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
export default GridSetup;
|
package/src/grid.tsx
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-lib/packages/graphing-solution-set/src/grid.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
import * as vx from '@visx/grid';
|
|
14
|
+
import { types } from '@pie-lib/plot';
|
|
15
|
+
import { getTickValues } from './utils.js';
|
|
16
|
+
|
|
17
|
+
export class Grid extends React.Component {
|
|
18
|
+
static propTypes = {
|
|
19
|
+
disabled: PropTypes.bool,
|
|
20
|
+
disabledAdditionalGrid: PropTypes.bool,
|
|
21
|
+
graphProps: types.GraphPropsType.isRequired,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
getAdditionalGridProps: any = (rowTickValues, columnTickValues) => {
|
|
25
|
+
const {
|
|
26
|
+
graphProps: {
|
|
27
|
+
scale,
|
|
28
|
+
size: { width, height },
|
|
29
|
+
domain,
|
|
30
|
+
range,
|
|
31
|
+
},
|
|
32
|
+
} = this.props;
|
|
33
|
+
const rowTickLabelValues = getTickValues({
|
|
34
|
+
...range,
|
|
35
|
+
step: range.labelStep,
|
|
36
|
+
}).filter((value) => rowTickValues.includes(value));
|
|
37
|
+
const columnTickLabelValues = getTickValues({
|
|
38
|
+
...domain,
|
|
39
|
+
step: domain.labelStep,
|
|
40
|
+
}).filter((value) => columnTickValues.includes(value));
|
|
41
|
+
|
|
42
|
+
const minValueLength =
|
|
43
|
+
(rowTickLabelValues.length &&
|
|
44
|
+
Math.min(...rowTickLabelValues)
|
|
45
|
+
.toString()
|
|
46
|
+
.replace(/[.-]/g, '').length) ||
|
|
47
|
+
1;
|
|
48
|
+
const maxValueLength =
|
|
49
|
+
(rowTickLabelValues.length &&
|
|
50
|
+
Math.max(...rowTickLabelValues)
|
|
51
|
+
.toString()
|
|
52
|
+
.replace(/[.-]/g, '').length) ||
|
|
53
|
+
1;
|
|
54
|
+
|
|
55
|
+
const rowLabelLength = Math.max(minValueLength, maxValueLength) * 9 + 22;
|
|
56
|
+
const horizontalDistanceToZero = scale.x(0);
|
|
57
|
+
const verticalDistanceToZero = scale.y(0);
|
|
58
|
+
const columnLabelLength = 28;
|
|
59
|
+
const rowStrokeDasharray = `${horizontalDistanceToZero - rowLabelLength} ${rowLabelLength} ${width}`;
|
|
60
|
+
const columnStrokeDasharray = `${verticalDistanceToZero} ${columnLabelLength} ${height}`;
|
|
61
|
+
|
|
62
|
+
const displayAdditionalGrid =
|
|
63
|
+
domain.labelStep > 0 &&
|
|
64
|
+
range.labelStep > 0 &&
|
|
65
|
+
rowTickLabelValues &&
|
|
66
|
+
columnTickLabelValues &&
|
|
67
|
+
rowTickLabelValues.length > 1 &&
|
|
68
|
+
columnTickLabelValues.length > 1 &&
|
|
69
|
+
(rowTickLabelValues.length !== rowTickValues.length || columnTickLabelValues.length !== columnTickValues.length);
|
|
70
|
+
|
|
71
|
+
const filteredColumnValues = columnTickLabelValues.filter(
|
|
72
|
+
(value) => value >= 0 || horizontalDistanceToZero - scale.x(value) > rowLabelLength,
|
|
73
|
+
);
|
|
74
|
+
const filteredRowValues = rowTickLabelValues.filter(
|
|
75
|
+
(value) => value >= 0 || scale.y(value) - verticalDistanceToZero > columnLabelLength,
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
rowTickLabelValues: filteredRowValues,
|
|
80
|
+
columnTickLabelValues: filteredColumnValues,
|
|
81
|
+
rowStrokeDasharray,
|
|
82
|
+
columnStrokeDasharray,
|
|
83
|
+
displayAdditionalGrid,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
render() {
|
|
88
|
+
const { graphProps } = this.props;
|
|
89
|
+
const {
|
|
90
|
+
scale,
|
|
91
|
+
size: { height, width },
|
|
92
|
+
domain,
|
|
93
|
+
range,
|
|
94
|
+
} = graphProps;
|
|
95
|
+
const rowTickValues = getTickValues(range);
|
|
96
|
+
const columnTickValues = getTickValues(domain);
|
|
97
|
+
const {
|
|
98
|
+
rowTickLabelValues,
|
|
99
|
+
columnTickLabelValues,
|
|
100
|
+
rowStrokeDasharray,
|
|
101
|
+
columnStrokeDasharray,
|
|
102
|
+
displayAdditionalGrid,
|
|
103
|
+
} = this.getAdditionalGridProps(rowTickValues, columnTickValues);
|
|
104
|
+
|
|
105
|
+
const additionalGridStroke =
|
|
106
|
+
domain.labelStep * 2 === domain.step || range.labelStep * 2 === range.step ? '#9FA8DA' : '#7985CB';
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<>
|
|
110
|
+
<vx.Grid
|
|
111
|
+
innerRef={(r) => (this.grid = r)}
|
|
112
|
+
xScale={scale.x}
|
|
113
|
+
yScale={scale.y}
|
|
114
|
+
width={width}
|
|
115
|
+
height={height}
|
|
116
|
+
stroke="#D3D3D3"
|
|
117
|
+
rowTickValues={rowTickValues}
|
|
118
|
+
columnTickValues={columnTickValues}
|
|
119
|
+
/>
|
|
120
|
+
{displayAdditionalGrid && (
|
|
121
|
+
<>
|
|
122
|
+
<vx.GridRows
|
|
123
|
+
scale={scale.y}
|
|
124
|
+
width={width}
|
|
125
|
+
tickValues={rowTickLabelValues}
|
|
126
|
+
stroke={additionalGridStroke}
|
|
127
|
+
strokeDasharray={rowStrokeDasharray}
|
|
128
|
+
/>
|
|
129
|
+
<vx.GridColumns
|
|
130
|
+
scale={scale.x}
|
|
131
|
+
height={height}
|
|
132
|
+
tickValues={columnTickLabelValues}
|
|
133
|
+
stroke={additionalGridStroke}
|
|
134
|
+
strokeDasharray={columnStrokeDasharray}
|
|
135
|
+
/>
|
|
136
|
+
</>
|
|
137
|
+
)}
|
|
138
|
+
</>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export default Grid;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-lib/packages/graphing-solution-set/src/index.js
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import Graph from './graph.js';
|
|
12
|
+
import GraphContainer from './container/index.js';
|
|
13
|
+
import GridSetup from './grid-setup.js';
|
|
14
|
+
import * as tools from './tools/index.js';
|
|
15
|
+
import ToolMenu from './tool-menu.js';
|
|
16
|
+
|
|
17
|
+
export { Graph, GraphContainer, GridSetup, ToolMenu, tools };
|