@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,180 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/util/DOMUtils.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
function ownKeys(e, r) {
|
|
4
|
+
var t = Object.keys(e);
|
|
5
|
+
if (Object.getOwnPropertySymbols) {
|
|
6
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
7
|
+
(r &&
|
|
8
|
+
(o = o.filter(function (r) {
|
|
9
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
10
|
+
})),
|
|
11
|
+
t.push.apply(t, o));
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
}
|
|
15
|
+
function _objectSpread(e) {
|
|
16
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
17
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
18
|
+
r % 2
|
|
19
|
+
? ownKeys(Object(t), !0).forEach(function (r) {
|
|
20
|
+
_defineProperty(e, r, t[r]);
|
|
21
|
+
})
|
|
22
|
+
: Object.getOwnPropertyDescriptors
|
|
23
|
+
? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t))
|
|
24
|
+
: ownKeys(Object(t)).forEach(function (r) {
|
|
25
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return e;
|
|
29
|
+
}
|
|
30
|
+
function _defineProperty(e, r, t) {
|
|
31
|
+
return (
|
|
32
|
+
(r = _toPropertyKey(r)) in e
|
|
33
|
+
? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 })
|
|
34
|
+
: (e[r] = t),
|
|
35
|
+
e
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function _toPropertyKey(t) {
|
|
39
|
+
var i = _toPrimitive(t, 'string');
|
|
40
|
+
return 'symbol' == typeof i ? i : i + '';
|
|
41
|
+
}
|
|
42
|
+
function _toPrimitive(t, r) {
|
|
43
|
+
if ('object' != typeof t || !t) return t;
|
|
44
|
+
var e = t[Symbol.toPrimitive];
|
|
45
|
+
if (void 0 !== e) {
|
|
46
|
+
var i = e.call(t, r || 'default');
|
|
47
|
+
if ('object' != typeof i) return i;
|
|
48
|
+
throw new TypeError('@@toPrimitive must return a primitive value.');
|
|
49
|
+
}
|
|
50
|
+
return ('string' === r ? String : Number)(t);
|
|
51
|
+
}
|
|
52
|
+
import { Global } from './Global';
|
|
53
|
+
import { LRUCache } from './LRUCache';
|
|
54
|
+
var defaultConfig = {
|
|
55
|
+
cacheSize: 2000,
|
|
56
|
+
enableCache: true,
|
|
57
|
+
};
|
|
58
|
+
var currentConfig = _objectSpread({}, defaultConfig);
|
|
59
|
+
var stringCache = new LRUCache(currentConfig.cacheSize);
|
|
60
|
+
var SPAN_STYLE = {
|
|
61
|
+
position: 'absolute',
|
|
62
|
+
top: '-20000px',
|
|
63
|
+
left: 0,
|
|
64
|
+
padding: 0,
|
|
65
|
+
margin: 0,
|
|
66
|
+
border: 'none',
|
|
67
|
+
whiteSpace: 'pre',
|
|
68
|
+
};
|
|
69
|
+
var MEASUREMENT_SPAN_ID = 'recharts_measurement_span';
|
|
70
|
+
function createCacheKey(text, style) {
|
|
71
|
+
// Simple string concatenation for better performance than JSON.stringify
|
|
72
|
+
var fontSize = style.fontSize || '';
|
|
73
|
+
var fontFamily = style.fontFamily || '';
|
|
74
|
+
var fontWeight = style.fontWeight || '';
|
|
75
|
+
var fontStyle = style.fontStyle || '';
|
|
76
|
+
var letterSpacing = style.letterSpacing || '';
|
|
77
|
+
var textTransform = style.textTransform || '';
|
|
78
|
+
return ''
|
|
79
|
+
.concat(text, '|')
|
|
80
|
+
.concat(fontSize, '|')
|
|
81
|
+
.concat(fontFamily, '|')
|
|
82
|
+
.concat(fontWeight, '|')
|
|
83
|
+
.concat(fontStyle, '|')
|
|
84
|
+
.concat(letterSpacing, '|')
|
|
85
|
+
.concat(textTransform);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Measure text using DOM (accurate but slower)
|
|
90
|
+
* @param text - The text to measure
|
|
91
|
+
* @param style - CSS style properties to apply
|
|
92
|
+
* @returns The size of the text
|
|
93
|
+
*/
|
|
94
|
+
var measureTextWithDOM = (text, style) => {
|
|
95
|
+
try {
|
|
96
|
+
var measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
|
|
97
|
+
if (!measurementSpan) {
|
|
98
|
+
measurementSpan = document.createElement('span');
|
|
99
|
+
measurementSpan.setAttribute('id', MEASUREMENT_SPAN_ID);
|
|
100
|
+
measurementSpan.setAttribute('aria-hidden', 'true');
|
|
101
|
+
document.body.appendChild(measurementSpan);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Apply styles directly without unnecessary object creation
|
|
105
|
+
Object.assign(measurementSpan.style, SPAN_STYLE, style);
|
|
106
|
+
measurementSpan.textContent = ''.concat(text);
|
|
107
|
+
var rect = measurementSpan.getBoundingClientRect();
|
|
108
|
+
return {
|
|
109
|
+
width: rect.width,
|
|
110
|
+
height: rect.height,
|
|
111
|
+
};
|
|
112
|
+
} catch (_unused) {
|
|
113
|
+
return {
|
|
114
|
+
width: 0,
|
|
115
|
+
height: 0,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
export var getStringSize = function getStringSize(text) {
|
|
120
|
+
var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
121
|
+
if (text === undefined || text === null || Global.isSsr) {
|
|
122
|
+
return {
|
|
123
|
+
width: 0,
|
|
124
|
+
height: 0,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// If caching is disabled, measure directly
|
|
129
|
+
if (!currentConfig.enableCache) {
|
|
130
|
+
return measureTextWithDOM(text, style);
|
|
131
|
+
}
|
|
132
|
+
var cacheKey = createCacheKey(text, style);
|
|
133
|
+
var cachedResult = stringCache.get(cacheKey);
|
|
134
|
+
if (cachedResult) {
|
|
135
|
+
return cachedResult;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Measure using DOM
|
|
139
|
+
var result = measureTextWithDOM(text, style);
|
|
140
|
+
|
|
141
|
+
// Store in LRU cache
|
|
142
|
+
stringCache.set(cacheKey, result);
|
|
143
|
+
return result;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Configure text measurement behavior
|
|
148
|
+
* @param config - Partial configuration to apply
|
|
149
|
+
* @returns void
|
|
150
|
+
*/
|
|
151
|
+
export var configureTextMeasurement = (config) => {
|
|
152
|
+
var newConfig = _objectSpread(_objectSpread({}, currentConfig), config);
|
|
153
|
+
if (newConfig.cacheSize !== currentConfig.cacheSize) {
|
|
154
|
+
stringCache = new LRUCache(newConfig.cacheSize);
|
|
155
|
+
}
|
|
156
|
+
currentConfig = newConfig;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Get current text measurement configuration
|
|
161
|
+
* @returns Current configuration
|
|
162
|
+
*/
|
|
163
|
+
export var getTextMeasurementConfig = () => _objectSpread({}, currentConfig);
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Clear the string size cache. Useful for testing or memory management.
|
|
167
|
+
* @returns void
|
|
168
|
+
*/
|
|
169
|
+
export var clearStringCache = () => {
|
|
170
|
+
stringCache.clear();
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Get cache statistics for debugging purposes.
|
|
175
|
+
* @returns Cache statistics including size and max size
|
|
176
|
+
*/
|
|
177
|
+
export var getStringCacheStats = () => ({
|
|
178
|
+
size: stringCache.size(),
|
|
179
|
+
maxSize: currentConfig.cacheSize,
|
|
180
|
+
});
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/util/DataUtils.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
|
+
import { get } from 'es-toolkit/compat';
|
|
7
|
+
import { round } from './round';
|
|
8
|
+
export var mathSign = (value) => {
|
|
9
|
+
if (value === 0) {
|
|
10
|
+
return 0;
|
|
11
|
+
}
|
|
12
|
+
if (value > 0) {
|
|
13
|
+
return 1;
|
|
14
|
+
}
|
|
15
|
+
return -1;
|
|
16
|
+
};
|
|
17
|
+
export var isNan = (value) => {
|
|
18
|
+
// eslint-disable-next-line eqeqeq
|
|
19
|
+
return typeof value == 'number' && value != +value;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Checks if the value is a percent string.
|
|
24
|
+
* A valid percent string must end with '%' and have at least one character before the '%'.
|
|
25
|
+
*
|
|
26
|
+
* @param {string | number | undefined} value The value to check
|
|
27
|
+
* @returns {boolean} true if the value is a percent string
|
|
28
|
+
*/
|
|
29
|
+
export var isPercent = (value) =>
|
|
30
|
+
typeof value === 'string' && value.length > 1 && value.indexOf('%') === value.length - 1;
|
|
31
|
+
export var isNumber = (value) =>
|
|
32
|
+
(typeof value === 'number' || value instanceof Number) && !isNan(value);
|
|
33
|
+
export var isNumOrStr = (value) => isNumber(value) || typeof value === 'string';
|
|
34
|
+
var idCounter = 0;
|
|
35
|
+
export var uniqueId = (prefix) => {
|
|
36
|
+
var id = ++idCounter;
|
|
37
|
+
return ''.concat(prefix || '').concat(id);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Calculates the numeric value represented by a percent string or number, based on a total value.
|
|
42
|
+
*
|
|
43
|
+
* - If `percent` is not a number or string, returns `defaultValue`.
|
|
44
|
+
* - If `percent` is a percent string but `totalValue` is null/undefined, returns `defaultValue`.
|
|
45
|
+
* - If the result is NaN, returns `defaultValue`.
|
|
46
|
+
* - If `validate` is true and the result exceeds `totalValue`, returns `totalValue`.
|
|
47
|
+
*
|
|
48
|
+
* @param percent - The percent value to convert. Can be a number (e.g. 25) or a string ending with '%' (e.g. '25%').
|
|
49
|
+
* If a string, it must end with '%' to be treated as a percent; otherwise, it is parsed as a number.
|
|
50
|
+
* @param totalValue - The total value to calculate the percent of. Required if `percent` is a percent string.
|
|
51
|
+
* @param defaultValue - The value returned if `percent` is undefined, invalid, or cannot be converted to a number.
|
|
52
|
+
* @param validate - If true, ensures the result does not exceed `totalValue` (when provided).
|
|
53
|
+
* @returns The calculated value, or `defaultValue` for invalid input.
|
|
54
|
+
*/
|
|
55
|
+
export var getPercentValue = function getPercentValue(percent, totalValue) {
|
|
56
|
+
var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
57
|
+
var validate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
58
|
+
if (!isNumber(percent) && typeof percent !== 'string') {
|
|
59
|
+
return defaultValue;
|
|
60
|
+
}
|
|
61
|
+
var value;
|
|
62
|
+
if (isPercent(percent)) {
|
|
63
|
+
if (totalValue == null) {
|
|
64
|
+
return defaultValue;
|
|
65
|
+
}
|
|
66
|
+
var index = percent.indexOf('%');
|
|
67
|
+
value = (totalValue * parseFloat(percent.slice(0, index))) / 100;
|
|
68
|
+
} else {
|
|
69
|
+
value = +percent;
|
|
70
|
+
}
|
|
71
|
+
if (isNan(value)) {
|
|
72
|
+
value = defaultValue;
|
|
73
|
+
}
|
|
74
|
+
if (validate && totalValue != null && value > totalValue) {
|
|
75
|
+
value = totalValue;
|
|
76
|
+
}
|
|
77
|
+
return value;
|
|
78
|
+
};
|
|
79
|
+
export var hasDuplicate = (ary) => {
|
|
80
|
+
if (!Array.isArray(ary)) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
var len = ary.length;
|
|
84
|
+
var cache = {};
|
|
85
|
+
for (var i = 0; i < len; i++) {
|
|
86
|
+
if (!cache[String(ary[i])]) {
|
|
87
|
+
cache[String(ary[i])] = true;
|
|
88
|
+
} else {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Function to interpolate between two numbers.
|
|
97
|
+
* If both start and end are numbers, it calculates the interpolated value based on the parameter animationElapsedTime (0 to 1).
|
|
98
|
+
* If either start or end is not a number, it returns the end value directly.
|
|
99
|
+
*
|
|
100
|
+
* You will typically use this function when implementing custom animations.
|
|
101
|
+
*
|
|
102
|
+
* `animationElapsedTime` can be outside the (0, 1) range, depending on easing.
|
|
103
|
+
*
|
|
104
|
+
* This one interpolates only numbers;
|
|
105
|
+
* if you want to interpolate colors or strings then perhaps see {@link https://d3js.org/d3-interpolate d3-interpolate}.
|
|
106
|
+
* @param start the starting value (when animationElapsedTime=0)
|
|
107
|
+
* @param end the final value (when animationElapsedTime=1)
|
|
108
|
+
* @param animationElapsedTime interpolation factor; values in [0, 1] interpolate between start and end, and values outside that range extrapolate
|
|
109
|
+
*
|
|
110
|
+
* @since 3.9
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
export function interpolate(start, end, animationElapsedTime) {
|
|
114
|
+
if (isNumber(start) && isNumber(end)) {
|
|
115
|
+
return round(start + animationElapsedTime * (end - start));
|
|
116
|
+
}
|
|
117
|
+
return end;
|
|
118
|
+
}
|
|
119
|
+
export function findEntryInArray(ary, specifiedKey, specifiedValue) {
|
|
120
|
+
if (!ary || !ary.length) {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
return ary.find(
|
|
124
|
+
(entry) =>
|
|
125
|
+
entry &&
|
|
126
|
+
(typeof specifiedKey === 'function' ? specifiedKey(entry) : get(entry, specifiedKey)) ===
|
|
127
|
+
specifiedValue,
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The least square linear regression
|
|
132
|
+
* @param {Array} data The array of points
|
|
133
|
+
* @returns {Object} The domain of x, and the parameter of linear function
|
|
134
|
+
*/
|
|
135
|
+
export var getLinearRegression = (data) => {
|
|
136
|
+
var len = data.length;
|
|
137
|
+
var xsum = 0;
|
|
138
|
+
var ysum = 0;
|
|
139
|
+
var xysum = 0;
|
|
140
|
+
var xxsum = 0;
|
|
141
|
+
var xmin = Infinity;
|
|
142
|
+
var xmax = -Infinity;
|
|
143
|
+
var xcurrent = 0;
|
|
144
|
+
var ycurrent = 0;
|
|
145
|
+
for (var i = 0; i < len; i++) {
|
|
146
|
+
var _data$i, _data$i2;
|
|
147
|
+
xcurrent = ((_data$i = data[i]) === null || _data$i === void 0 ? void 0 : _data$i.cx) || 0;
|
|
148
|
+
ycurrent = ((_data$i2 = data[i]) === null || _data$i2 === void 0 ? void 0 : _data$i2.cy) || 0;
|
|
149
|
+
xsum += xcurrent;
|
|
150
|
+
ysum += ycurrent;
|
|
151
|
+
xysum += xcurrent * ycurrent;
|
|
152
|
+
xxsum += xcurrent * xcurrent;
|
|
153
|
+
xmin = Math.min(xmin, xcurrent);
|
|
154
|
+
xmax = Math.max(xmax, xcurrent);
|
|
155
|
+
}
|
|
156
|
+
var a =
|
|
157
|
+
len * xxsum !== xsum * xsum ? (len * xysum - xsum * ysum) / (len * xxsum - xsum * xsum) : 0;
|
|
158
|
+
return {
|
|
159
|
+
xmin,
|
|
160
|
+
xmax,
|
|
161
|
+
a,
|
|
162
|
+
b: (ysum - a * xsum) / len,
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Checks if the value is null or undefined
|
|
167
|
+
* @param value The value to check
|
|
168
|
+
* @returns true if the value is null or undefined
|
|
169
|
+
*/
|
|
170
|
+
export var isNullish = (value) => {
|
|
171
|
+
return value === null || typeof value === 'undefined';
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Uppercase the first letter of a string
|
|
176
|
+
* @param {string} value The string to uppercase
|
|
177
|
+
* @returns {string} The uppercased string
|
|
178
|
+
*/
|
|
179
|
+
export var upperFirst = (value) => {
|
|
180
|
+
if (isNullish(value)) {
|
|
181
|
+
return value;
|
|
182
|
+
}
|
|
183
|
+
return ''.concat(value.charAt(0).toUpperCase()).concat(value.slice(1));
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Checks if the value is not null nor undefined.
|
|
188
|
+
* @param value The value to check
|
|
189
|
+
* @returns true if the value is not null nor undefined
|
|
190
|
+
*/
|
|
191
|
+
export function isNotNil(value) {
|
|
192
|
+
return value != null;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* No-operation function that does nothing.
|
|
197
|
+
* Useful as a placeholder or default callback function.
|
|
198
|
+
*/
|
|
199
|
+
export function noop() {}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/util/Events.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
import EventEmitter from 'eventemitter3';
|
|
4
|
+
var eventCenter = new EventEmitter();
|
|
5
|
+
export { eventCenter };
|
|
6
|
+
export var TOOLTIP_SYNC_EVENT = 'recharts.syncEvent.tooltip';
|
|
7
|
+
export var BRUSH_SYNC_EVENT = 'recharts.syncEvent.brush';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/util/Global.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
var parseIsSsrByDefault = () =>
|
|
4
|
+
!(
|
|
5
|
+
typeof window !== 'undefined' &&
|
|
6
|
+
window.document &&
|
|
7
|
+
Boolean(window.document.createElement) &&
|
|
8
|
+
window.setTimeout
|
|
9
|
+
);
|
|
10
|
+
export var Global = {
|
|
11
|
+
devToolsEnabled: true,
|
|
12
|
+
isSsr: parseIsSsrByDefault(),
|
|
13
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/util/LRUCache.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
function _defineProperty(e, r, t) {
|
|
4
|
+
return (
|
|
5
|
+
(r = _toPropertyKey(r)) in e
|
|
6
|
+
? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 })
|
|
7
|
+
: (e[r] = t),
|
|
8
|
+
e
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
function _toPropertyKey(t) {
|
|
12
|
+
var i = _toPrimitive(t, 'string');
|
|
13
|
+
return 'symbol' == typeof i ? i : i + '';
|
|
14
|
+
}
|
|
15
|
+
function _toPrimitive(t, r) {
|
|
16
|
+
if ('object' != typeof t || !t) return t;
|
|
17
|
+
var e = t[Symbol.toPrimitive];
|
|
18
|
+
if (void 0 !== e) {
|
|
19
|
+
var i = e.call(t, r || 'default');
|
|
20
|
+
if ('object' != typeof i) return i;
|
|
21
|
+
throw new TypeError('@@toPrimitive must return a primitive value.');
|
|
22
|
+
}
|
|
23
|
+
return ('string' === r ? String : Number)(t);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Simple LRU (Least Recently Used) cache implementation
|
|
27
|
+
*/
|
|
28
|
+
export class LRUCache {
|
|
29
|
+
constructor(maxSize) {
|
|
30
|
+
_defineProperty(this, 'cache', new Map());
|
|
31
|
+
this.maxSize = maxSize;
|
|
32
|
+
}
|
|
33
|
+
get(key) {
|
|
34
|
+
var value = this.cache.get(key);
|
|
35
|
+
if (value !== undefined) {
|
|
36
|
+
this.cache.delete(key);
|
|
37
|
+
this.cache.set(key, value);
|
|
38
|
+
}
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
set(key, value) {
|
|
42
|
+
if (this.cache.has(key)) {
|
|
43
|
+
this.cache.delete(key);
|
|
44
|
+
} else if (this.cache.size >= this.maxSize) {
|
|
45
|
+
var firstKey = this.cache.keys().next().value;
|
|
46
|
+
if (firstKey != null) {
|
|
47
|
+
this.cache.delete(firstKey);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
this.cache.set(key, value);
|
|
51
|
+
}
|
|
52
|
+
clear() {
|
|
53
|
+
this.cache.clear();
|
|
54
|
+
}
|
|
55
|
+
size() {
|
|
56
|
+
return this.cache.size;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/util/LogUtils.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
/* eslint no-console: 0 */
|
|
4
|
+
var isDev = true;
|
|
5
|
+
export var warn = function warn(condition, format) {
|
|
6
|
+
for (
|
|
7
|
+
var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2;
|
|
8
|
+
_key < _len;
|
|
9
|
+
_key++
|
|
10
|
+
) {
|
|
11
|
+
args[_key - 2] = arguments[_key];
|
|
12
|
+
}
|
|
13
|
+
if (isDev && typeof console !== 'undefined' && console.warn) {
|
|
14
|
+
if (format === undefined) {
|
|
15
|
+
console.warn('LogUtils requires an error message argument');
|
|
16
|
+
}
|
|
17
|
+
if (!condition) {
|
|
18
|
+
if (format === undefined) {
|
|
19
|
+
console.warn(
|
|
20
|
+
'Minified exception occurred; use the non-minified dev environment ' +
|
|
21
|
+
'for the full error message and additional helpful warnings.',
|
|
22
|
+
);
|
|
23
|
+
} else {
|
|
24
|
+
var argIndex = 0;
|
|
25
|
+
console.warn(format.replace(/%s/g, () => args[argIndex++]));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/util/PolarUtils.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
function ownKeys(e, r) {
|
|
4
|
+
var t = Object.keys(e);
|
|
5
|
+
if (Object.getOwnPropertySymbols) {
|
|
6
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
7
|
+
(r &&
|
|
8
|
+
(o = o.filter(function (r) {
|
|
9
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
10
|
+
})),
|
|
11
|
+
t.push.apply(t, o));
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
}
|
|
15
|
+
function _objectSpread(e) {
|
|
16
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
17
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
18
|
+
r % 2
|
|
19
|
+
? ownKeys(Object(t), !0).forEach(function (r) {
|
|
20
|
+
_defineProperty(e, r, t[r]);
|
|
21
|
+
})
|
|
22
|
+
: Object.getOwnPropertyDescriptors
|
|
23
|
+
? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t))
|
|
24
|
+
: ownKeys(Object(t)).forEach(function (r) {
|
|
25
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return e;
|
|
29
|
+
}
|
|
30
|
+
function _defineProperty(e, r, t) {
|
|
31
|
+
return (
|
|
32
|
+
(r = _toPropertyKey(r)) in e
|
|
33
|
+
? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 })
|
|
34
|
+
: (e[r] = t),
|
|
35
|
+
e
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function _toPropertyKey(t) {
|
|
39
|
+
var i = _toPrimitive(t, 'string');
|
|
40
|
+
return 'symbol' == typeof i ? i : i + '';
|
|
41
|
+
}
|
|
42
|
+
function _toPrimitive(t, r) {
|
|
43
|
+
if ('object' != typeof t || !t) return t;
|
|
44
|
+
var e = t[Symbol.toPrimitive];
|
|
45
|
+
if (void 0 !== e) {
|
|
46
|
+
var i = e.call(t, r || 'default');
|
|
47
|
+
if ('object' != typeof i) return i;
|
|
48
|
+
throw new TypeError('@@toPrimitive must return a primitive value.');
|
|
49
|
+
}
|
|
50
|
+
return ('string' === r ? String : Number)(t);
|
|
51
|
+
}
|
|
52
|
+
export var RADIAN = Math.PI / 180;
|
|
53
|
+
export var degreeToRadian = (angle) => (angle * Math.PI) / 180;
|
|
54
|
+
export var radianToDegree = (angleInRadian) => (angleInRadian * 180) / Math.PI;
|
|
55
|
+
export var polarToCartesian = (cx, cy, radius, angle) => ({
|
|
56
|
+
x: cx + Math.cos(-RADIAN * angle) * radius,
|
|
57
|
+
y: cy + Math.sin(-RADIAN * angle) * radius,
|
|
58
|
+
});
|
|
59
|
+
export var getMaxRadius = function getMaxRadius(width, height) {
|
|
60
|
+
var offset =
|
|
61
|
+
arguments.length > 2 && arguments[2] !== undefined
|
|
62
|
+
? arguments[2]
|
|
63
|
+
: {
|
|
64
|
+
top: 0,
|
|
65
|
+
right: 0,
|
|
66
|
+
bottom: 0,
|
|
67
|
+
left: 0,
|
|
68
|
+
width: 0,
|
|
69
|
+
height: 0,
|
|
70
|
+
brushBottom: 0,
|
|
71
|
+
};
|
|
72
|
+
return (
|
|
73
|
+
Math.min(
|
|
74
|
+
Math.abs(width - (offset.left || 0) - (offset.right || 0)),
|
|
75
|
+
Math.abs(height - (offset.top || 0) - (offset.bottom || 0)),
|
|
76
|
+
) / 2
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
var distanceBetweenPoints = (point, anotherPoint) => {
|
|
80
|
+
var x1 = point.x,
|
|
81
|
+
y1 = point.y;
|
|
82
|
+
var x2 = anotherPoint.x,
|
|
83
|
+
y2 = anotherPoint.y;
|
|
84
|
+
return Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2);
|
|
85
|
+
};
|
|
86
|
+
var getAngleOfPoint = (_ref, _ref2) => {
|
|
87
|
+
var x = _ref.x,
|
|
88
|
+
y = _ref.y;
|
|
89
|
+
var cx = _ref2.cx,
|
|
90
|
+
cy = _ref2.cy;
|
|
91
|
+
var radius = distanceBetweenPoints(
|
|
92
|
+
{
|
|
93
|
+
x,
|
|
94
|
+
y,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
x: cx,
|
|
98
|
+
y: cy,
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
if (radius <= 0) {
|
|
102
|
+
return {
|
|
103
|
+
radius,
|
|
104
|
+
angle: 0,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
var cos = (x - cx) / radius;
|
|
108
|
+
var angleInRadian = Math.acos(cos);
|
|
109
|
+
if (y > cy) {
|
|
110
|
+
angleInRadian = 2 * Math.PI - angleInRadian;
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
radius,
|
|
114
|
+
angle: radianToDegree(angleInRadian),
|
|
115
|
+
angleInRadian,
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
var formatAngleOfSector = (_ref3) => {
|
|
119
|
+
var startAngle = _ref3.startAngle,
|
|
120
|
+
endAngle = _ref3.endAngle;
|
|
121
|
+
var startCnt = Math.floor(startAngle / 360);
|
|
122
|
+
var endCnt = Math.floor(endAngle / 360);
|
|
123
|
+
var min = Math.min(startCnt, endCnt);
|
|
124
|
+
return {
|
|
125
|
+
startAngle: startAngle - min * 360,
|
|
126
|
+
endAngle: endAngle - min * 360,
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
var reverseFormatAngleOfSector = (angle, _ref4) => {
|
|
130
|
+
var startAngle = _ref4.startAngle,
|
|
131
|
+
endAngle = _ref4.endAngle;
|
|
132
|
+
var startCnt = Math.floor(startAngle / 360);
|
|
133
|
+
var endCnt = Math.floor(endAngle / 360);
|
|
134
|
+
var min = Math.min(startCnt, endCnt);
|
|
135
|
+
return angle + min * 360;
|
|
136
|
+
};
|
|
137
|
+
export var inRangeOfSector = (_ref5, viewBox) => {
|
|
138
|
+
var x = _ref5.relativeX,
|
|
139
|
+
y = _ref5.relativeY;
|
|
140
|
+
var _getAngleOfPoint = getAngleOfPoint(
|
|
141
|
+
{
|
|
142
|
+
x,
|
|
143
|
+
y,
|
|
144
|
+
},
|
|
145
|
+
viewBox,
|
|
146
|
+
),
|
|
147
|
+
radius = _getAngleOfPoint.radius,
|
|
148
|
+
angle = _getAngleOfPoint.angle;
|
|
149
|
+
var innerRadius = viewBox.innerRadius,
|
|
150
|
+
outerRadius = viewBox.outerRadius;
|
|
151
|
+
if (radius < innerRadius || radius > outerRadius) {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
if (radius === 0) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
var _formatAngleOfSector = formatAngleOfSector(viewBox),
|
|
158
|
+
startAngle = _formatAngleOfSector.startAngle,
|
|
159
|
+
endAngle = _formatAngleOfSector.endAngle;
|
|
160
|
+
var formatAngle = angle;
|
|
161
|
+
var inRange;
|
|
162
|
+
if (startAngle <= endAngle) {
|
|
163
|
+
while (formatAngle > endAngle) {
|
|
164
|
+
formatAngle -= 360;
|
|
165
|
+
}
|
|
166
|
+
while (formatAngle < startAngle) {
|
|
167
|
+
formatAngle += 360;
|
|
168
|
+
}
|
|
169
|
+
inRange = formatAngle >= startAngle && formatAngle <= endAngle;
|
|
170
|
+
} else {
|
|
171
|
+
while (formatAngle > startAngle) {
|
|
172
|
+
formatAngle -= 360;
|
|
173
|
+
}
|
|
174
|
+
while (formatAngle < endAngle) {
|
|
175
|
+
formatAngle += 360;
|
|
176
|
+
}
|
|
177
|
+
inRange = formatAngle >= endAngle && formatAngle <= startAngle;
|
|
178
|
+
}
|
|
179
|
+
if (inRange) {
|
|
180
|
+
return _objectSpread(
|
|
181
|
+
_objectSpread({}, viewBox),
|
|
182
|
+
{},
|
|
183
|
+
{
|
|
184
|
+
radius,
|
|
185
|
+
angle: reverseFormatAngleOfSector(formatAngle, viewBox),
|
|
186
|
+
},
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
return null;
|
|
190
|
+
};
|