@octanejs/recharts 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/LICENSE +21 -0
- package/package.json +53 -0
- package/src/animation/AnimatedItems.tsrx +82 -0
- package/src/animation/AnimationControllerImpl.js +33 -0
- package/src/animation/AnimationHandle.js +291 -0
- package/src/animation/JavascriptAnimate.tsrx +81 -0
- package/src/animation/easing.js +193 -0
- package/src/animation/matchBy.js +279 -0
- package/src/animation/timeoutController.js +49 -0
- package/src/animation/useAnimationController.ts +22 -0
- package/src/animation/useAnimationStartSnapshot.ts +43 -0
- package/src/animation/util.js +11 -0
- package/src/cartesian/Bar.ts +4 -0
- package/src/cartesian/Bar.tsrx +716 -0
- package/src/cartesian/Bar.tsrx.d.ts +4 -0
- package/src/cartesian/BarStack.tsrx +97 -0
- package/src/cartesian/BarStack.tsrx.d.ts +6 -0
- package/src/cartesian/CartesianAxis.tsrx +413 -0
- package/src/cartesian/CartesianAxis.tsrx.d.ts +3 -0
- package/src/cartesian/GraphicalItemClipPath.tsrx +44 -0
- package/src/cartesian/Line.ts +4 -0
- package/src/cartesian/Line.tsrx +544 -0
- package/src/cartesian/Line.tsrx.d.ts +4 -0
- package/src/cartesian/LineDrawShape.tsrx +106 -0
- package/src/cartesian/LineDrawShape.tsrx.d.ts +2 -0
- package/src/cartesian/XAxis.tsrx +156 -0
- package/src/cartesian/XAxis.tsrx.d.ts +3 -0
- package/src/cartesian/YAxis.tsrx +183 -0
- package/src/cartesian/YAxis.tsrx.d.ts +3 -0
- package/src/cartesian/getCartesianPosition.js +277 -0
- package/src/cartesian/getEquidistantTicks.js +133 -0
- package/src/cartesian/getTicks.js +280 -0
- package/src/cartesian/useAnimatedLineLength.ts +33 -0
- package/src/chart/BarChart.tsrx +22 -0
- package/src/chart/BarChart.tsrx.d.ts +2 -0
- package/src/chart/CartesianChart.tsrx +76 -0
- package/src/chart/CartesianChart.tsrx.d.ts +10 -0
- package/src/chart/CategoricalChart.tsrx +54 -0
- package/src/chart/LineChart.tsrx +22 -0
- package/src/chart/LineChart.tsrx.d.ts +2 -0
- package/src/chart/RechartsWrapper.tsrx +294 -0
- package/src/component/ActivePoints.tsrx +76 -0
- package/src/component/Cell.ts +37 -0
- package/src/component/Dots.tsrx +74 -0
- package/src/component/Label.tsrx +309 -0
- package/src/component/Label.tsrx.d.ts +12 -0
- package/src/component/LabelList.tsrx +83 -0
- package/src/component/LabelList.tsrx.d.ts +8 -0
- package/src/component/ResponsiveContainer.ts +22 -0
- package/src/component/Text.tsrx +281 -0
- package/src/component/Text.tsrx.d.ts +9 -0
- package/src/component/responsiveContainerUtils.js +111 -0
- package/src/container/ClipPathProvider.tsrx +29 -0
- package/src/container/Layer.tsrx +9 -0
- package/src/container/Layer.tsrx.d.ts +6 -0
- package/src/container/RootSurface.tsrx +76 -0
- package/src/container/Surface.tsrx +23 -0
- package/src/container/Surface.tsrx.d.ts +12 -0
- package/src/context/CellsContext.ts +80 -0
- package/src/context/ErrorBarContext.tsrx +53 -0
- package/src/context/PanoramaContext.ts +10 -0
- package/src/context/RegisterGraphicalItemId.tsrx +19 -0
- package/src/context/accessibilityContext.js +10 -0
- package/src/context/chartDataContext.ts +57 -0
- package/src/context/chartLayoutContext.ts +171 -0
- package/src/context/legendPortalContext.ts +5 -0
- package/src/context/tooltipContext.js +55 -0
- package/src/context/tooltipPortalContext.ts +5 -0
- package/src/hooks.js +509 -0
- package/src/index.ts +64 -0
- package/src/internal.ts +37 -0
- package/src/polar/defaultPolarAngleAxisProps.js +27 -0
- package/src/polar/defaultPolarRadiusAxisProps.js +24 -0
- package/src/shape/Cross.tsrx +25 -0
- package/src/shape/Cross.tsrx.d.ts +12 -0
- package/src/shape/Curve.tsrx +132 -0
- package/src/shape/Curve.tsrx.d.ts +42 -0
- package/src/shape/Dot.tsrx +21 -0
- package/src/shape/Dot.tsrx.d.ts +9 -0
- package/src/shape/Polygon.tsrx +95 -0
- package/src/shape/Polygon.tsrx.d.ts +13 -0
- package/src/shape/Rectangle.tsrx +162 -0
- package/src/shape/Rectangle.tsrx.d.ts +31 -0
- package/src/shape/Sector.tsrx +219 -0
- package/src/shape/Sector.tsrx.d.ts +29 -0
- package/src/shape/Symbols.tsrx +95 -0
- package/src/shape/Symbols.tsrx.d.ts +15 -0
- package/src/shape/Trapezoid.tsrx +56 -0
- package/src/shape/Trapezoid.tsrx.d.ts +29 -0
- package/src/state/RechartsReduxContext.ts +7 -0
- package/src/state/RechartsStoreProvider.tsrx +24 -0
- package/src/state/ReportChartProps.ts +13 -0
- package/src/state/ReportEventSettings.ts +15 -0
- package/src/state/ReportMainChartProps.ts +22 -0
- package/src/state/SetGraphicalItem.ts +61 -0
- package/src/state/SetLegendPayload.ts +61 -0
- package/src/state/SetTooltipEntrySettings.ts +40 -0
- package/src/state/brushSlice.js +36 -0
- package/src/state/cartesianAxisSlice.js +256 -0
- package/src/state/chartDataSlice.js +67 -0
- package/src/state/errorBarSlice.js +53 -0
- package/src/state/eventSettingsSlice.js +25 -0
- package/src/state/externalEventsMiddleware.js +127 -0
- package/src/state/graphicalItemsSlice.js +91 -0
- package/src/state/hooks.ts +46 -0
- package/src/state/keyboardEventsMiddleware.js +226 -0
- package/src/state/layoutSlice.js +57 -0
- package/src/state/legendSlice.js +83 -0
- package/src/state/mouseEventsMiddleware.js +130 -0
- package/src/state/optionsSlice.js +45 -0
- package/src/state/polarAxisSlice.js +33 -0
- package/src/state/polarOptionsSlice.js +26 -0
- package/src/state/reduxDevtoolsJsonStringifyReplacer.js +14 -0
- package/src/state/referenceElementsSlice.js +51 -0
- package/src/state/renderedTicksSlice.js +41 -0
- package/src/state/rootPropsSlice.js +48 -0
- package/src/state/selectors/arrayEqualityCheck.js +32 -0
- package/src/state/selectors/axisSelectors.js +2113 -0
- package/src/state/selectors/barSelectors.js +263 -0
- package/src/state/selectors/barStackSelectors.js +65 -0
- package/src/state/selectors/brushSelectors.js +21 -0
- package/src/state/selectors/combiners/combineActiveLabel.js +18 -0
- package/src/state/selectors/combiners/combineActiveTooltipIndex.js +75 -0
- package/src/state/selectors/combiners/combineAllBarPositions.js +169 -0
- package/src/state/selectors/combiners/combineAxisRangeWithReverse.js +11 -0
- package/src/state/selectors/combiners/combineBarPosition.js +17 -0
- package/src/state/selectors/combiners/combineBarSizeList.js +115 -0
- package/src/state/selectors/combiners/combineCheckedDomain.js +44 -0
- package/src/state/selectors/combiners/combineConfiguredScale.js +46 -0
- package/src/state/selectors/combiners/combineCoordinateForDefaultIndex.js +48 -0
- package/src/state/selectors/combiners/combineDisplayedStackedData.js +54 -0
- package/src/state/selectors/combiners/combineInverseScaleFunction.js +12 -0
- package/src/state/selectors/combiners/combineRealScaleType.js +36 -0
- package/src/state/selectors/combiners/combineStackedData.js +22 -0
- package/src/state/selectors/combiners/combineTooltipInteractionState.js +121 -0
- package/src/state/selectors/combiners/combineTooltipPayload.js +248 -0
- package/src/state/selectors/combiners/combineTooltipPayloadConfigurations.js +59 -0
- package/src/state/selectors/containerSelectors.js +6 -0
- package/src/state/selectors/dataSelectors.js +97 -0
- package/src/state/selectors/graphicalItemSelectors.js +25 -0
- package/src/state/selectors/legendSelectors.js +18 -0
- package/src/state/selectors/lineSelectors.js +106 -0
- package/src/state/selectors/numberDomainEqualityCheck.js +11 -0
- package/src/state/selectors/pickAxisId.js +3 -0
- package/src/state/selectors/pickAxisType.js +3 -0
- package/src/state/selectors/polarAxisSelectors.js +237 -0
- package/src/state/selectors/rootPropsSelectors.js +13 -0
- package/src/state/selectors/selectActivePropsFromChartPointer.js +23 -0
- package/src/state/selectors/selectAllAxes.js +15 -0
- package/src/state/selectors/selectChartOffset.js +12 -0
- package/src/state/selectors/selectChartOffsetInternal.js +174 -0
- package/src/state/selectors/selectPlotArea.js +19 -0
- package/src/state/selectors/selectTooltipAxisId.js +3 -0
- package/src/state/selectors/selectTooltipAxisType.js +25 -0
- package/src/state/selectors/selectTooltipEventType.js +27 -0
- package/src/state/selectors/selectTooltipPayloadSearcher.js +3 -0
- package/src/state/selectors/selectTooltipSettings.js +3 -0
- package/src/state/selectors/selectTooltipState.js +3 -0
- package/src/state/selectors/selectors.js +222 -0
- package/src/state/selectors/tooltipSelectors.js +471 -0
- package/src/state/selectors/touchSelectors.js +31 -0
- package/src/state/store.js +101 -0
- package/src/state/tooltipSlice.js +237 -0
- package/src/state/touchEventsMiddleware.js +140 -0
- package/src/state/types/StackedGraphicalItem.js +18 -0
- package/src/state/zIndexSlice.js +167 -0
- package/src/synchronisation/syncSelectors.js +5 -0
- package/src/synchronisation/useChartSynchronisation.tsrx +285 -0
- package/src/util/ActiveShapeUtils.tsrx +62 -0
- package/src/util/BarUtils.tsrx +35 -0
- package/src/util/CartesianUtils.js +66 -0
- package/src/util/ChartUtils.js +630 -0
- package/src/util/Constants.js +42 -0
- package/src/util/DOMUtils.js +180 -0
- package/src/util/DataUtils.js +199 -0
- package/src/util/Events.js +7 -0
- package/src/util/Global.js +13 -0
- package/src/util/LRUCache.js +58 -0
- package/src/util/LogUtils.js +29 -0
- package/src/util/PolarUtils.js +190 -0
- package/src/util/ReactUtils.ts +94 -0
- package/src/util/ReduceCSSCalc.js +260 -0
- package/src/util/TickUtils.js +43 -0
- package/src/util/YAxisUtils.js +43 -0
- package/src/util/axisPropsAreEqual.js +63 -0
- package/src/util/createEventProxy.js +18 -0
- package/src/util/excludeEventProps.js +172 -0
- package/src/util/getActiveCoordinate.js +253 -0
- package/src/util/getAxisTypeBasedOnLayout.js +17 -0
- package/src/util/getClassNameFromUnknown.js +8 -0
- package/src/util/getEveryNth.js +29 -0
- package/src/util/getRadiusAndStrokeWidthFromDot.js +28 -0
- package/src/util/getRelativeCoordinate.js +96 -0
- package/src/util/getSliced.js +11 -0
- package/src/util/isDomainSpecifiedByUser.js +255 -0
- package/src/util/isWellBehavedNumber.js +8 -0
- package/src/util/propsAreEqual.js +96 -0
- package/src/util/resolveDefaultProps.js +131 -0
- package/src/util/round.js +39 -0
- package/src/util/scale/RechartsScale.js +68 -0
- package/src/util/scale/createCategoricalInverse.js +77 -0
- package/src/util/scale/getNiceTickValues.js +354 -0
- package/src/util/scale/index.js +3 -0
- package/src/util/scale/util/arithmetic.js +51 -0
- package/src/util/stacks/getStackSeriesIdentifier.js +10 -0
- package/src/util/svgPropertiesAndEvents.ts +29 -0
- package/src/util/svgPropertiesNoEvents.js +383 -0
- package/src/util/types.ts +59 -0
- package/src/util/useAnimationId.ts +14 -0
- package/src/util/useId.ts +13 -0
- package/src/util/usePrefersReducedMotion.ts +30 -0
- package/src/util/useReportScale.ts +26 -0
- package/src/util/useUniqueId.js +34 -0
- package/src/zIndex/DefaultZIndexes.js +75 -0
- package/src/zIndex/ZIndexLayer.tsrx +80 -0
- package/src/zIndex/ZIndexLayer.tsrx.d.ts +2 -0
- package/src/zIndex/ZIndexPortal.tsrx +43 -0
- package/src/zIndex/getZIndexFromUnknown.js +15 -0
- package/src/zIndex/zIndexSelectors.js +45 -0
|
@@ -0,0 +1,630 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/util/ChartUtils.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
// Sanctioned deviation: es-toolkit compat imports normalized to the ESM barrel
|
|
4
|
+
// ('es-toolkit/compat') — the per-function subpaths are CJS-only and break
|
|
5
|
+
// consumers that compile this binding from source (vite dev prebundle).
|
|
6
|
+
function ownKeys(e, r) {
|
|
7
|
+
var t = Object.keys(e);
|
|
8
|
+
if (Object.getOwnPropertySymbols) {
|
|
9
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
10
|
+
(r &&
|
|
11
|
+
(o = o.filter(function (r) {
|
|
12
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
13
|
+
})),
|
|
14
|
+
t.push.apply(t, o));
|
|
15
|
+
}
|
|
16
|
+
return t;
|
|
17
|
+
}
|
|
18
|
+
function _objectSpread(e) {
|
|
19
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
20
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
21
|
+
r % 2
|
|
22
|
+
? ownKeys(Object(t), !0).forEach(function (r) {
|
|
23
|
+
_defineProperty(e, r, t[r]);
|
|
24
|
+
})
|
|
25
|
+
: Object.getOwnPropertyDescriptors
|
|
26
|
+
? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t))
|
|
27
|
+
: ownKeys(Object(t)).forEach(function (r) {
|
|
28
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return e;
|
|
32
|
+
}
|
|
33
|
+
function _defineProperty(e, r, t) {
|
|
34
|
+
return (
|
|
35
|
+
(r = _toPropertyKey(r)) in e
|
|
36
|
+
? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 })
|
|
37
|
+
: (e[r] = t),
|
|
38
|
+
e
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function _toPropertyKey(t) {
|
|
42
|
+
var i = _toPrimitive(t, 'string');
|
|
43
|
+
return 'symbol' == typeof i ? i : i + '';
|
|
44
|
+
}
|
|
45
|
+
function _toPrimitive(t, r) {
|
|
46
|
+
if ('object' != typeof t || !t) return t;
|
|
47
|
+
var e = t[Symbol.toPrimitive];
|
|
48
|
+
if (void 0 !== e) {
|
|
49
|
+
var i = e.call(t, r || 'default');
|
|
50
|
+
if ('object' != typeof i) return i;
|
|
51
|
+
throw new TypeError('@@toPrimitive must return a primitive value.');
|
|
52
|
+
}
|
|
53
|
+
return ('string' === r ? String : Number)(t);
|
|
54
|
+
}
|
|
55
|
+
import { get, sortBy } from 'es-toolkit/compat';
|
|
56
|
+
import {
|
|
57
|
+
stack as shapeStack,
|
|
58
|
+
stackOffsetExpand,
|
|
59
|
+
stackOffsetNone,
|
|
60
|
+
stackOffsetSilhouette,
|
|
61
|
+
stackOffsetWiggle,
|
|
62
|
+
stackOrderNone,
|
|
63
|
+
} from 'victory-vendor/d3-shape';
|
|
64
|
+
import {
|
|
65
|
+
findEntryInArray,
|
|
66
|
+
isNan,
|
|
67
|
+
isNotNil,
|
|
68
|
+
isNullish,
|
|
69
|
+
isNumber,
|
|
70
|
+
isNumOrStr,
|
|
71
|
+
mathSign,
|
|
72
|
+
} from './DataUtils';
|
|
73
|
+
import { getSliced } from './getSliced';
|
|
74
|
+
import { isWellBehavedNumber } from './isWellBehavedNumber';
|
|
75
|
+
export function getValueByDataKey(obj, dataKey, defaultValue) {
|
|
76
|
+
if (isNullish(obj) || isNullish(dataKey)) {
|
|
77
|
+
return defaultValue;
|
|
78
|
+
}
|
|
79
|
+
if (isNumOrStr(dataKey)) {
|
|
80
|
+
return get(obj, dataKey, defaultValue);
|
|
81
|
+
}
|
|
82
|
+
if (typeof dataKey === 'function') {
|
|
83
|
+
return dataKey(obj);
|
|
84
|
+
}
|
|
85
|
+
return defaultValue;
|
|
86
|
+
}
|
|
87
|
+
export var appendOffsetOfLegend = (offset, legendSettings, legendSize) => {
|
|
88
|
+
if (legendSettings && legendSize) {
|
|
89
|
+
var boxWidth = legendSize.width,
|
|
90
|
+
boxHeight = legendSize.height;
|
|
91
|
+
var align = legendSettings.align,
|
|
92
|
+
verticalAlign = legendSettings.verticalAlign,
|
|
93
|
+
layout = legendSettings.layout;
|
|
94
|
+
if (
|
|
95
|
+
(layout === 'vertical' || (layout === 'horizontal' && verticalAlign === 'middle')) &&
|
|
96
|
+
align !== 'center' &&
|
|
97
|
+
isNumber(offset[align])
|
|
98
|
+
) {
|
|
99
|
+
return _objectSpread(
|
|
100
|
+
_objectSpread({}, offset),
|
|
101
|
+
{},
|
|
102
|
+
{
|
|
103
|
+
[align]: offset[align] + (boxWidth || 0),
|
|
104
|
+
},
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
if (
|
|
108
|
+
(layout === 'horizontal' || (layout === 'vertical' && align === 'center')) &&
|
|
109
|
+
verticalAlign !== 'middle' &&
|
|
110
|
+
isNumber(offset[verticalAlign])
|
|
111
|
+
) {
|
|
112
|
+
return _objectSpread(
|
|
113
|
+
_objectSpread({}, offset),
|
|
114
|
+
{},
|
|
115
|
+
{
|
|
116
|
+
[verticalAlign]: offset[verticalAlign] + (boxHeight || 0),
|
|
117
|
+
},
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return offset;
|
|
122
|
+
};
|
|
123
|
+
export var isCategoricalAxis = (layout, axisType) =>
|
|
124
|
+
(layout === 'horizontal' && axisType === 'xAxis') ||
|
|
125
|
+
(layout === 'vertical' && axisType === 'yAxis') ||
|
|
126
|
+
(layout === 'centric' && axisType === 'angleAxis') ||
|
|
127
|
+
(layout === 'radial' && axisType === 'radiusAxis');
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Calculate the Coordinates of grid
|
|
131
|
+
* @param {Array} ticks The ticks in axis
|
|
132
|
+
* @param {Number} minValue The minimum value of axis
|
|
133
|
+
* @param {Number} maxValue The maximum value of axis
|
|
134
|
+
* @param {boolean} syncWithTicks Synchronize grid lines with ticks or not
|
|
135
|
+
* @return {Array} Coordinates
|
|
136
|
+
*/
|
|
137
|
+
export var getCoordinatesOfGrid = (ticks, minValue, maxValue, syncWithTicks) => {
|
|
138
|
+
if (syncWithTicks) {
|
|
139
|
+
return ticks.map((entry) => entry.coordinate);
|
|
140
|
+
}
|
|
141
|
+
var hasMin, hasMax;
|
|
142
|
+
var values = ticks.map((entry) => {
|
|
143
|
+
if (entry.coordinate === minValue) {
|
|
144
|
+
hasMin = true;
|
|
145
|
+
}
|
|
146
|
+
if (entry.coordinate === maxValue) {
|
|
147
|
+
hasMax = true;
|
|
148
|
+
}
|
|
149
|
+
return entry.coordinate;
|
|
150
|
+
});
|
|
151
|
+
if (!hasMin) {
|
|
152
|
+
values.push(minValue);
|
|
153
|
+
}
|
|
154
|
+
if (!hasMax) {
|
|
155
|
+
values.push(maxValue);
|
|
156
|
+
}
|
|
157
|
+
return values;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Of on four almost identical implementations of tick generation.
|
|
161
|
+
* The four horsemen of tick generation are:
|
|
162
|
+
* - {@link selectTooltipAxisTicks}
|
|
163
|
+
* - {@link combineAxisTicks}
|
|
164
|
+
* - {@link getTicksOfAxis}.
|
|
165
|
+
* - {@link combineGraphicalItemTicks}
|
|
166
|
+
*/
|
|
167
|
+
export var getTicksOfAxis = (axis, isGrid, isAll) => {
|
|
168
|
+
if (!axis) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
var duplicateDomain = axis.duplicateDomain,
|
|
172
|
+
type = axis.type,
|
|
173
|
+
range = axis.range,
|
|
174
|
+
scale = axis.scale,
|
|
175
|
+
realScaleType = axis.realScaleType,
|
|
176
|
+
isCategorical = axis.isCategorical,
|
|
177
|
+
categoricalDomain = axis.categoricalDomain,
|
|
178
|
+
tickCount = axis.tickCount,
|
|
179
|
+
ticks = axis.ticks,
|
|
180
|
+
niceTicks = axis.niceTicks,
|
|
181
|
+
axisType = axis.axisType;
|
|
182
|
+
if (!scale) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
var offsetForBand = realScaleType === 'scaleBand' && scale.bandwidth ? scale.bandwidth() / 2 : 2;
|
|
186
|
+
var offset =
|
|
187
|
+
(isGrid || isAll) && type === 'category' && scale.bandwidth
|
|
188
|
+
? scale.bandwidth() / offsetForBand
|
|
189
|
+
: 0;
|
|
190
|
+
offset =
|
|
191
|
+
axisType === 'angleAxis' && range && range.length >= 2
|
|
192
|
+
? mathSign(range[0] - range[1]) * 2 * offset
|
|
193
|
+
: offset;
|
|
194
|
+
|
|
195
|
+
// The ticks set by user should only affect the ticks adjacent to axis line
|
|
196
|
+
if (isGrid && (ticks || niceTicks)) {
|
|
197
|
+
var result = (ticks || niceTicks || [])
|
|
198
|
+
.map((entry, index) => {
|
|
199
|
+
var scaleContent = duplicateDomain ? duplicateDomain.indexOf(entry) : entry;
|
|
200
|
+
var scaled = scale.map(scaleContent);
|
|
201
|
+
if (!isWellBehavedNumber(scaled)) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
// If the scaleContent is not a number, the coordinate will be NaN.
|
|
206
|
+
// That could be the case for example with a PointScale and a string as domain.
|
|
207
|
+
coordinate: scaled + offset,
|
|
208
|
+
value: entry,
|
|
209
|
+
offset,
|
|
210
|
+
index,
|
|
211
|
+
};
|
|
212
|
+
})
|
|
213
|
+
.filter(isNotNil);
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// When axis is a categorical axis, but the type of axis is number or the scale of axis is not "auto"
|
|
218
|
+
// For type='number' with niceTicks available, skip this branch so ticks are evenly spaced (GitHub issue #4271)
|
|
219
|
+
if (isCategorical && categoricalDomain) {
|
|
220
|
+
return categoricalDomain
|
|
221
|
+
.map((entry, index) => {
|
|
222
|
+
var scaled = scale.map(entry);
|
|
223
|
+
if (!isWellBehavedNumber(scaled)) {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
coordinate: scaled + offset,
|
|
228
|
+
value: entry,
|
|
229
|
+
index,
|
|
230
|
+
offset,
|
|
231
|
+
};
|
|
232
|
+
})
|
|
233
|
+
.filter(isNotNil);
|
|
234
|
+
}
|
|
235
|
+
if (scale.ticks && !isAll && tickCount != null) {
|
|
236
|
+
return scale
|
|
237
|
+
.ticks(tickCount)
|
|
238
|
+
.map((entry, index) => {
|
|
239
|
+
var scaled = scale.map(entry);
|
|
240
|
+
if (!isWellBehavedNumber(scaled)) {
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
coordinate: scaled + offset,
|
|
245
|
+
value: entry,
|
|
246
|
+
index,
|
|
247
|
+
offset,
|
|
248
|
+
};
|
|
249
|
+
})
|
|
250
|
+
.filter(isNotNil);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// When axis has duplicated text, serial numbers are used to generate scale
|
|
254
|
+
return scale
|
|
255
|
+
.domain()
|
|
256
|
+
.map((entry, index) => {
|
|
257
|
+
var scaled = scale.map(entry);
|
|
258
|
+
if (!isWellBehavedNumber(scaled)) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
coordinate: scaled + offset,
|
|
263
|
+
// @ts-expect-error can't use Date as an index
|
|
264
|
+
value: duplicateDomain ? duplicateDomain[entry] : entry,
|
|
265
|
+
index,
|
|
266
|
+
offset,
|
|
267
|
+
};
|
|
268
|
+
})
|
|
269
|
+
.filter(isNotNil);
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Both value and domain are tuples of two numbers
|
|
274
|
+
* - but the type stays as array of numbers until we have better support in rest of the app
|
|
275
|
+
* @param value input that will be truncated
|
|
276
|
+
* @param domain boundaries
|
|
277
|
+
* @returns tuple of two numbers
|
|
278
|
+
*/
|
|
279
|
+
export var truncateByDomain = (value, domain) => {
|
|
280
|
+
if (!domain || domain.length !== 2 || !isNumber(domain[0]) || !isNumber(domain[1])) {
|
|
281
|
+
return value;
|
|
282
|
+
}
|
|
283
|
+
var minValue = Math.min(domain[0], domain[1]);
|
|
284
|
+
var maxValue = Math.max(domain[0], domain[1]);
|
|
285
|
+
var result = [value[0], value[1]];
|
|
286
|
+
if (!isNumber(value[0]) || value[0] < minValue) {
|
|
287
|
+
result[0] = minValue;
|
|
288
|
+
}
|
|
289
|
+
if (!isNumber(value[1]) || value[1] > maxValue) {
|
|
290
|
+
result[1] = maxValue;
|
|
291
|
+
}
|
|
292
|
+
if (result[0] > maxValue) {
|
|
293
|
+
result[0] = maxValue;
|
|
294
|
+
}
|
|
295
|
+
if (result[1] < minValue) {
|
|
296
|
+
result[1] = minValue;
|
|
297
|
+
}
|
|
298
|
+
return result;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Stacks all positive numbers above zero and all negative numbers below zero.
|
|
303
|
+
*
|
|
304
|
+
* If all values in the series are positive then this behaves the same as 'none' stacker.
|
|
305
|
+
*
|
|
306
|
+
* @param {Array} series from d3-shape Stack
|
|
307
|
+
* @return {Array} series with applied offset
|
|
308
|
+
*/
|
|
309
|
+
export var offsetSign = (series) => {
|
|
310
|
+
var _series$;
|
|
311
|
+
var n = series.length;
|
|
312
|
+
if (n <= 0) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
var m = (_series$ = series[0]) === null || _series$ === void 0 ? void 0 : _series$.length;
|
|
316
|
+
if (m == null || m <= 0) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
for (var j = 0; j < m; ++j) {
|
|
320
|
+
var positive = 0;
|
|
321
|
+
var negative = 0;
|
|
322
|
+
for (var i = 0; i < n; ++i) {
|
|
323
|
+
var row = series[i];
|
|
324
|
+
var col = row === null || row === void 0 ? void 0 : row[j];
|
|
325
|
+
if (col == null) {
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
var series1 = col[1];
|
|
329
|
+
var series0 = col[0];
|
|
330
|
+
var value = isNan(series1) ? series0 : series1;
|
|
331
|
+
if (value >= 0) {
|
|
332
|
+
col[0] = positive;
|
|
333
|
+
positive += value;
|
|
334
|
+
col[1] = positive;
|
|
335
|
+
} else {
|
|
336
|
+
col[0] = negative;
|
|
337
|
+
negative += value;
|
|
338
|
+
col[1] = negative;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Replaces all negative values with zero when stacking data.
|
|
346
|
+
*
|
|
347
|
+
* If all values in the series are positive then this behaves the same as 'none' stacker.
|
|
348
|
+
*
|
|
349
|
+
* @param {Array} series from d3-shape Stack
|
|
350
|
+
* @return {Array} series with applied offset
|
|
351
|
+
*/
|
|
352
|
+
export var offsetPositive = (series) => {
|
|
353
|
+
var _series$2;
|
|
354
|
+
var n = series.length;
|
|
355
|
+
if (n <= 0) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
var m = (_series$2 = series[0]) === null || _series$2 === void 0 ? void 0 : _series$2.length;
|
|
359
|
+
if (m == null || m <= 0) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
for (var j = 0; j < m; ++j) {
|
|
363
|
+
var positive = 0;
|
|
364
|
+
for (var i = 0; i < n; ++i) {
|
|
365
|
+
var row = series[i];
|
|
366
|
+
var col = row === null || row === void 0 ? void 0 : row[j];
|
|
367
|
+
if (col == null) {
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
var value = isNan(col[1]) ? col[0] : col[1];
|
|
371
|
+
if (value >= 0) {
|
|
372
|
+
col[0] = positive;
|
|
373
|
+
positive += value;
|
|
374
|
+
col[1] = positive;
|
|
375
|
+
} else {
|
|
376
|
+
col[0] = 0;
|
|
377
|
+
col[1] = 0;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Function type to compute offset for stacked data.
|
|
385
|
+
*
|
|
386
|
+
* d3-shape has something fishy going on with its types.
|
|
387
|
+
* In @definitelytyped/d3-shape, this function (the offset accessor) is typed as Series<> => void.
|
|
388
|
+
* However! When I actually open the storybook I can see that the offset accessor actually receives Array<Series<>>.
|
|
389
|
+
* The same I can see in the source code itself:
|
|
390
|
+
* https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/66042
|
|
391
|
+
* That one unfortunately has no types but we can tell it passes three-dimensional array.
|
|
392
|
+
*
|
|
393
|
+
* Which leads me to believe that definitelytyped is wrong on this one.
|
|
394
|
+
* There's open discussion on this topic without much attention:
|
|
395
|
+
* https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/66042
|
|
396
|
+
*/
|
|
397
|
+
|
|
398
|
+
var STACK_OFFSET_MAP = {
|
|
399
|
+
sign: offsetSign,
|
|
400
|
+
// @ts-expect-error definitelytyped types are incorrect
|
|
401
|
+
expand: stackOffsetExpand,
|
|
402
|
+
// @ts-expect-error definitelytyped types are incorrect
|
|
403
|
+
none: stackOffsetNone,
|
|
404
|
+
// @ts-expect-error definitelytyped types are incorrect
|
|
405
|
+
silhouette: stackOffsetSilhouette,
|
|
406
|
+
// @ts-expect-error definitelytyped types are incorrect
|
|
407
|
+
wiggle: stackOffsetWiggle,
|
|
408
|
+
positive: offsetPositive,
|
|
409
|
+
};
|
|
410
|
+
export var getStackedData = (data, dataKeys, offsetType) => {
|
|
411
|
+
var _STACK_OFFSET_MAP$off;
|
|
412
|
+
var offsetAccessor =
|
|
413
|
+
(_STACK_OFFSET_MAP$off = STACK_OFFSET_MAP[offsetType]) !== null &&
|
|
414
|
+
_STACK_OFFSET_MAP$off !== void 0
|
|
415
|
+
? _STACK_OFFSET_MAP$off
|
|
416
|
+
: stackOffsetNone;
|
|
417
|
+
var stack = shapeStack()
|
|
418
|
+
.keys(dataKeys)
|
|
419
|
+
.value((d, key) => Number(getValueByDataKey(d, key, 0)))
|
|
420
|
+
.order(stackOrderNone)
|
|
421
|
+
// @ts-expect-error definitelytyped types are incorrect
|
|
422
|
+
.offset(offsetAccessor);
|
|
423
|
+
var result = stack(data);
|
|
424
|
+
|
|
425
|
+
// Post-process ranged data: if value is an array of two numbers, use them directly without stacking
|
|
426
|
+
result.forEach((series, seriesIndex) => {
|
|
427
|
+
series.forEach((point, pointIndex) => {
|
|
428
|
+
var value = getValueByDataKey(data[pointIndex], dataKeys[seriesIndex], 0);
|
|
429
|
+
if (Array.isArray(value) && value.length === 2 && isNumber(value[0]) && isNumber(value[1])) {
|
|
430
|
+
// eslint-disable-next-line prefer-destructuring,no-param-reassign
|
|
431
|
+
point[0] = value[0];
|
|
432
|
+
// eslint-disable-next-line prefer-destructuring,no-param-reassign
|
|
433
|
+
point[1] = value[1];
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
return result;
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Externally, we accept both strings and numbers as stack IDs
|
|
442
|
+
* @inline
|
|
443
|
+
*/
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Stack IDs in the external props allow numbers; but internally we use it as an object key
|
|
447
|
+
* and object keys are always strings. Also, it would be kinda confusing if stackId=8 and stackId='8' were different stacks
|
|
448
|
+
* so let's just force a string.
|
|
449
|
+
*/
|
|
450
|
+
|
|
451
|
+
export function getNormalizedStackId(publicStackId) {
|
|
452
|
+
return publicStackId == null ? undefined : String(publicStackId);
|
|
453
|
+
}
|
|
454
|
+
export function getCateCoordinateOfLine(_ref) {
|
|
455
|
+
var axis = _ref.axis,
|
|
456
|
+
ticks = _ref.ticks,
|
|
457
|
+
bandSize = _ref.bandSize,
|
|
458
|
+
entry = _ref.entry,
|
|
459
|
+
index = _ref.index,
|
|
460
|
+
dataKey = _ref.dataKey;
|
|
461
|
+
if (axis.type === 'category') {
|
|
462
|
+
// find coordinate of category axis by the value of category
|
|
463
|
+
// @ts-expect-error why does this use direct object access instead of getValueByDataKey?
|
|
464
|
+
if (!axis.allowDuplicatedCategory && axis.dataKey && !isNullish(entry[axis.dataKey])) {
|
|
465
|
+
// @ts-expect-error why does this use direct object access instead of getValueByDataKey?
|
|
466
|
+
var matchedTick = findEntryInArray(ticks, 'value', entry[axis.dataKey]);
|
|
467
|
+
if (matchedTick) {
|
|
468
|
+
return matchedTick.coordinate + bandSize / 2;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
return ticks !== null && ticks !== void 0 && ticks[index]
|
|
472
|
+
? ticks[index].coordinate + bandSize / 2
|
|
473
|
+
: null;
|
|
474
|
+
}
|
|
475
|
+
var value = getValueByDataKey(entry, !isNullish(dataKey) ? dataKey : axis.dataKey);
|
|
476
|
+
var scaled = axis.scale.map(value);
|
|
477
|
+
if (!isNumber(scaled)) {
|
|
478
|
+
return null;
|
|
479
|
+
}
|
|
480
|
+
return scaled;
|
|
481
|
+
}
|
|
482
|
+
export var getCateCoordinateOfBar = (_ref2) => {
|
|
483
|
+
var axis = _ref2.axis,
|
|
484
|
+
ticks = _ref2.ticks,
|
|
485
|
+
offset = _ref2.offset,
|
|
486
|
+
bandSize = _ref2.bandSize,
|
|
487
|
+
entry = _ref2.entry,
|
|
488
|
+
index = _ref2.index;
|
|
489
|
+
if (axis.type === 'category') {
|
|
490
|
+
return ticks[index] ? ticks[index].coordinate + offset : null;
|
|
491
|
+
}
|
|
492
|
+
// getValueByDataKey does not validate the output type
|
|
493
|
+
var value = getValueByDataKey(entry, axis.dataKey, axis.scale.domain()[index]);
|
|
494
|
+
if (isNullish(value)) {
|
|
495
|
+
return null;
|
|
496
|
+
}
|
|
497
|
+
var scaled = axis.scale.map(value);
|
|
498
|
+
if (!isNumber(scaled)) {
|
|
499
|
+
return null;
|
|
500
|
+
}
|
|
501
|
+
return scaled - bandSize / 2 + offset;
|
|
502
|
+
};
|
|
503
|
+
export var getBaseValueOfBar = (_ref3) => {
|
|
504
|
+
var numericAxis = _ref3.numericAxis;
|
|
505
|
+
var domain = numericAxis.scale.domain();
|
|
506
|
+
if (numericAxis.type === 'number') {
|
|
507
|
+
// @ts-expect-error type number means the domain has numbers in it but this relationship is not known to typescript
|
|
508
|
+
var minValue = Math.min(domain[0], domain[1]);
|
|
509
|
+
// @ts-expect-error type number means the domain has numbers in it but this relationship is not known to typescript
|
|
510
|
+
var maxValue = Math.max(domain[0], domain[1]);
|
|
511
|
+
if (minValue <= 0 && maxValue >= 0) {
|
|
512
|
+
return 0;
|
|
513
|
+
}
|
|
514
|
+
if (maxValue < 0) {
|
|
515
|
+
return maxValue;
|
|
516
|
+
}
|
|
517
|
+
return minValue;
|
|
518
|
+
}
|
|
519
|
+
return domain[0];
|
|
520
|
+
};
|
|
521
|
+
var getDomainOfSingle = (data) => {
|
|
522
|
+
var flat = data.flat(2).filter(isNumber);
|
|
523
|
+
return [Math.min(...flat), Math.max(...flat)];
|
|
524
|
+
};
|
|
525
|
+
var makeDomainFinite = (domain) => {
|
|
526
|
+
return [domain[0] === Infinity ? 0 : domain[0], domain[1] === -Infinity ? 0 : domain[1]];
|
|
527
|
+
};
|
|
528
|
+
export var getDomainOfStackGroups = (stackGroups, startIndex, endIndex) => {
|
|
529
|
+
if (stackGroups == null || Object.keys(stackGroups).length === 0) {
|
|
530
|
+
return undefined;
|
|
531
|
+
}
|
|
532
|
+
return makeDomainFinite(
|
|
533
|
+
Object.keys(stackGroups).reduce(
|
|
534
|
+
(result, stackId) => {
|
|
535
|
+
var group = stackGroups[stackId];
|
|
536
|
+
if (!group) {
|
|
537
|
+
return result;
|
|
538
|
+
}
|
|
539
|
+
var stackedData = group.stackedData;
|
|
540
|
+
var domain = stackedData.reduce(
|
|
541
|
+
(res, entry) => {
|
|
542
|
+
var sliced = getSliced(entry, startIndex, endIndex);
|
|
543
|
+
var s = getDomainOfSingle(sliced);
|
|
544
|
+
if (!isWellBehavedNumber(s[0]) || !isWellBehavedNumber(s[1])) {
|
|
545
|
+
return res;
|
|
546
|
+
}
|
|
547
|
+
return [Math.min(res[0], s[0]), Math.max(res[1], s[1])];
|
|
548
|
+
},
|
|
549
|
+
[Infinity, -Infinity],
|
|
550
|
+
);
|
|
551
|
+
return [Math.min(domain[0], result[0]), Math.max(domain[1], result[1])];
|
|
552
|
+
},
|
|
553
|
+
[Infinity, -Infinity],
|
|
554
|
+
),
|
|
555
|
+
);
|
|
556
|
+
};
|
|
557
|
+
export var MIN_VALUE_REG = /^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/;
|
|
558
|
+
export var MAX_VALUE_REG = /^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/;
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Calculate the size between two category
|
|
562
|
+
* @param {Object} axis The options of axis
|
|
563
|
+
* @param {Array} ticks The ticks of axis
|
|
564
|
+
* @param {Boolean} isBar if items in axis are bars
|
|
565
|
+
* @return {Number} Size
|
|
566
|
+
*/
|
|
567
|
+
export var getBandSizeOfAxis = (axis, ticks, isBar) => {
|
|
568
|
+
if (axis && axis.scale && axis.scale.bandwidth) {
|
|
569
|
+
var bandWidth = axis.scale.bandwidth();
|
|
570
|
+
if (!isBar || bandWidth > 0) {
|
|
571
|
+
return bandWidth;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
if (axis && ticks && ticks.length >= 2) {
|
|
575
|
+
var orderedTicks = sortBy(ticks, (o) => o.coordinate);
|
|
576
|
+
var bandSize = Infinity;
|
|
577
|
+
for (var i = 1, len = orderedTicks.length; i < len; i++) {
|
|
578
|
+
var cur = orderedTicks[i];
|
|
579
|
+
var prev = orderedTicks[i - 1];
|
|
580
|
+
bandSize = Math.min(
|
|
581
|
+
((cur === null || cur === void 0 ? void 0 : cur.coordinate) || 0) -
|
|
582
|
+
((prev === null || prev === void 0 ? void 0 : prev.coordinate) || 0),
|
|
583
|
+
bandSize,
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
return bandSize === Infinity ? 0 : bandSize;
|
|
587
|
+
}
|
|
588
|
+
return isBar ? undefined : 0;
|
|
589
|
+
};
|
|
590
|
+
export function getTooltipEntry(_ref4) {
|
|
591
|
+
var tooltipEntrySettings = _ref4.tooltipEntrySettings,
|
|
592
|
+
dataKey = _ref4.dataKey,
|
|
593
|
+
payload = _ref4.payload,
|
|
594
|
+
value = _ref4.value,
|
|
595
|
+
name = _ref4.name;
|
|
596
|
+
return _objectSpread(
|
|
597
|
+
_objectSpread({}, tooltipEntrySettings),
|
|
598
|
+
{},
|
|
599
|
+
{
|
|
600
|
+
dataKey,
|
|
601
|
+
payload,
|
|
602
|
+
value,
|
|
603
|
+
name,
|
|
604
|
+
},
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
export function getTooltipNameProp(nameFromItem, dataKey) {
|
|
608
|
+
if (nameFromItem != null) {
|
|
609
|
+
return String(nameFromItem);
|
|
610
|
+
}
|
|
611
|
+
if (typeof dataKey === 'string') {
|
|
612
|
+
return dataKey;
|
|
613
|
+
}
|
|
614
|
+
return undefined;
|
|
615
|
+
}
|
|
616
|
+
export var calculateCartesianTooltipPos = (coordinate, layout) => {
|
|
617
|
+
if (layout === 'horizontal') {
|
|
618
|
+
return coordinate.relativeX;
|
|
619
|
+
}
|
|
620
|
+
if (layout === 'vertical') {
|
|
621
|
+
return coordinate.relativeY;
|
|
622
|
+
}
|
|
623
|
+
return undefined;
|
|
624
|
+
};
|
|
625
|
+
export var calculatePolarTooltipPos = (rangeObj, layout) => {
|
|
626
|
+
if (layout === 'centric') {
|
|
627
|
+
return rangeObj.angle;
|
|
628
|
+
}
|
|
629
|
+
return rangeObj.radius;
|
|
630
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/util/Constants.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
export var COLOR_PANEL = [
|
|
4
|
+
'#1890FF',
|
|
5
|
+
'#66B5FF',
|
|
6
|
+
'#41D9C7',
|
|
7
|
+
'#2FC25B',
|
|
8
|
+
'#6EDB8F',
|
|
9
|
+
'#9AE65C',
|
|
10
|
+
'#FACC14',
|
|
11
|
+
'#E6965C',
|
|
12
|
+
'#57AD71',
|
|
13
|
+
'#223273',
|
|
14
|
+
'#738AE6',
|
|
15
|
+
'#7564CC',
|
|
16
|
+
'#8543E0',
|
|
17
|
+
'#A877ED',
|
|
18
|
+
'#5C8EE6',
|
|
19
|
+
'#13C2C2',
|
|
20
|
+
'#70E0E0',
|
|
21
|
+
'#5CA3E6',
|
|
22
|
+
'#3436C7',
|
|
23
|
+
'#8082FF',
|
|
24
|
+
'#DD81E6',
|
|
25
|
+
'#F04864',
|
|
26
|
+
'#FA7D92',
|
|
27
|
+
'#D598D9',
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* We use this attribute to identify which element is the one that the user is touching.
|
|
32
|
+
* The index is the position of the element in the data array.
|
|
33
|
+
* This can be either a number (for array-based charts) or a string (for the charts that have a matrix-shaped data).
|
|
34
|
+
*/
|
|
35
|
+
export var DATA_ITEM_INDEX_ATTRIBUTE_NAME = 'data-recharts-item-index';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* We use this attribute to identify which element is the one that the user is touching.
|
|
39
|
+
* Unlike dataKey, or name, it is always unique.
|
|
40
|
+
*/
|
|
41
|
+
export var DATA_ITEM_GRAPHICAL_ITEM_ID_ATTRIBUTE_NAME = 'data-recharts-item-id';
|
|
42
|
+
export var DEFAULT_Y_AXIS_WIDTH = 60;
|