@gravity-ui/charts 1.38.7 → 1.39.1
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/cjs/components/AxisX/prepare-axis-data.js +0 -1
- package/dist/cjs/components/ChartInner/index.js +18 -6
- package/dist/cjs/components/ChartInner/useChartInnerHandlers.d.ts +1 -2
- package/dist/cjs/components/ChartInner/useChartInnerHandlers.js +5 -1
- package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +3 -3
- package/dist/cjs/components/ChartInner/useChartInnerProps.js +14 -17
- package/dist/cjs/components/ChartInner/useDefaultState.d.ts +26 -0
- package/dist/cjs/components/ChartInner/useDefaultState.js +74 -0
- package/dist/cjs/components/ChartInner/utils/axis.d.ts +44 -0
- package/dist/{esm/hooks/useYAxisLabelWidth/index.js → cjs/components/ChartInner/utils/axis.js} +1 -1
- package/dist/cjs/{hooks/useChartOptions → components/ChartInner/utils}/chart.d.ts +2 -2
- package/dist/cjs/components/ChartInner/{utils.d.ts → utils/common.d.ts} +2 -1
- package/dist/cjs/components/ChartInner/utils/index.d.ts +7 -0
- package/dist/cjs/components/ChartInner/utils/index.js +7 -0
- package/dist/cjs/{hooks/useNormalizedOriginalData/index.d.ts → components/ChartInner/utils/normalized-original-data.d.ts} +10 -10
- package/dist/{esm/hooks/useNormalizedOriginalData/index.js → cjs/components/ChartInner/utils/normalized-original-data.js} +1 -1
- package/dist/cjs/{hooks/useChartOptions → components/ChartInner/utils}/title.d.ts +2 -2
- package/dist/{esm/hooks/useChartOptions → cjs/components/ChartInner/utils}/title.js +1 -1
- package/dist/cjs/components/ChartInner/utils/tooltip.d.ts +8 -0
- package/dist/cjs/components/ChartInner/utils/tooltip.js +7 -0
- package/dist/cjs/{hooks/useChartOptions → components/ChartInner/utils}/zoom.d.ts +3 -3
- package/dist/cjs/{hooks/useChartOptions → components/ChartInner/utils}/zoom.js +1 -1
- package/dist/cjs/hooks/index.d.ts +1 -4
- package/dist/cjs/hooks/index.js +1 -4
- package/dist/cjs/hooks/{useChartOptions/types.d.ts → types.d.ts} +1 -1
- package/dist/cjs/hooks/useAxis/index.d.ts +2 -2
- package/dist/cjs/hooks/useAxis/index.js +1 -1
- package/dist/cjs/hooks/useAxis/y-axis.js +1 -3
- package/dist/cjs/hooks/useAxisScales/x-scale.js +0 -1
- package/dist/cjs/hooks/useAxisScales/y-scale.js +0 -1
- package/dist/cjs/hooks/useCrosshair/index.js +21 -15
- package/dist/cjs/hooks/useRangeSlider/types.d.ts +1 -1
- package/dist/cjs/hooks/useRangeSlider/utils.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-area.d.ts +2 -2
- package/dist/cjs/hooks/useSeries/prepare-legend.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-line.d.ts +2 -2
- package/dist/cjs/hooks/useSeries/prepare-radar.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/index.js +19 -4
- package/dist/cjs/hooks/useShapes/pie/prepare-data.js +0 -1
- package/dist/cjs/hooks/useTooltip/index.d.ts +1 -1
- package/dist/cjs/hooks/useZoom/index.d.ts +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/types/index.d.ts +24 -11
- package/dist/cjs/utils/chart/axis/common.d.ts +1 -1
- package/dist/cjs/utils/chart/chart-dimensions.d.ts +24 -0
- package/dist/{esm/hooks/useChartDimensions/index.js → cjs/utils/chart/chart-dimensions.js} +43 -5
- package/dist/cjs/utils/chart/common.d.ts +28 -0
- package/dist/cjs/utils/chart/common.js +192 -0
- package/dist/cjs/utils/chart/get-closest-data.js +0 -1
- package/dist/cjs/utils/chart/index.d.ts +2 -28
- package/dist/cjs/utils/chart/index.js +2 -192
- package/dist/cjs/utils/chart/tooltip.d.ts +6 -0
- package/dist/{esm/hooks/useChartOptions → cjs/utils/chart}/tooltip.js +2 -7
- package/dist/cjs/utils/chart/zoom.js +0 -2
- package/dist/esm/components/AxisX/prepare-axis-data.js +0 -1
- package/dist/esm/components/ChartInner/index.js +18 -6
- package/dist/esm/components/ChartInner/useChartInnerHandlers.d.ts +1 -2
- package/dist/esm/components/ChartInner/useChartInnerHandlers.js +5 -1
- package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +3 -3
- package/dist/esm/components/ChartInner/useChartInnerProps.js +14 -17
- package/dist/esm/components/ChartInner/useDefaultState.d.ts +26 -0
- package/dist/esm/components/ChartInner/useDefaultState.js +74 -0
- package/dist/esm/components/ChartInner/utils/axis.d.ts +44 -0
- package/dist/{cjs/hooks/useYAxisLabelWidth/index.js → esm/components/ChartInner/utils/axis.js} +1 -1
- package/dist/esm/{hooks/useChartOptions → components/ChartInner/utils}/chart.d.ts +2 -2
- package/dist/esm/components/ChartInner/{utils.d.ts → utils/common.d.ts} +2 -1
- package/dist/esm/components/ChartInner/utils/index.d.ts +7 -0
- package/dist/esm/components/ChartInner/utils/index.js +7 -0
- package/dist/esm/{hooks/useNormalizedOriginalData/index.d.ts → components/ChartInner/utils/normalized-original-data.d.ts} +10 -10
- package/dist/{cjs/hooks/useNormalizedOriginalData/index.js → esm/components/ChartInner/utils/normalized-original-data.js} +1 -1
- package/dist/esm/{hooks/useChartOptions → components/ChartInner/utils}/title.d.ts +2 -2
- package/dist/{cjs/hooks/useChartOptions → esm/components/ChartInner/utils}/title.js +1 -1
- package/dist/esm/components/ChartInner/utils/tooltip.d.ts +8 -0
- package/dist/esm/components/ChartInner/utils/tooltip.js +7 -0
- package/dist/esm/{hooks/useChartOptions → components/ChartInner/utils}/zoom.d.ts +3 -3
- package/dist/esm/{hooks/useChartOptions → components/ChartInner/utils}/zoom.js +1 -1
- package/dist/esm/hooks/index.d.ts +1 -4
- package/dist/esm/hooks/index.js +1 -4
- package/dist/esm/hooks/{useChartOptions/types.d.ts → types.d.ts} +1 -1
- package/dist/esm/hooks/useAxis/index.d.ts +2 -2
- package/dist/esm/hooks/useAxis/index.js +1 -1
- package/dist/esm/hooks/useAxis/y-axis.js +1 -3
- package/dist/esm/hooks/useAxisScales/x-scale.js +0 -1
- package/dist/esm/hooks/useAxisScales/y-scale.js +0 -1
- package/dist/esm/hooks/useCrosshair/index.js +21 -15
- package/dist/esm/hooks/useRangeSlider/types.d.ts +1 -1
- package/dist/esm/hooks/useRangeSlider/utils.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-area.d.ts +2 -2
- package/dist/esm/hooks/useSeries/prepare-legend.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-line.d.ts +2 -2
- package/dist/esm/hooks/useSeries/prepare-radar.d.ts +1 -1
- package/dist/esm/hooks/useShapes/index.js +19 -4
- package/dist/esm/hooks/useShapes/pie/prepare-data.js +0 -1
- package/dist/esm/hooks/useTooltip/index.d.ts +1 -1
- package/dist/esm/hooks/useZoom/index.d.ts +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/types/index.d.ts +24 -11
- package/dist/esm/utils/chart/axis/common.d.ts +1 -1
- package/dist/esm/utils/chart/chart-dimensions.d.ts +24 -0
- package/dist/{cjs/hooks/useChartDimensions/index.js → esm/utils/chart/chart-dimensions.js} +43 -5
- package/dist/esm/utils/chart/common.d.ts +28 -0
- package/dist/esm/utils/chart/common.js +192 -0
- package/dist/esm/utils/chart/get-closest-data.js +0 -1
- package/dist/esm/utils/chart/index.d.ts +2 -28
- package/dist/esm/utils/chart/index.js +2 -192
- package/dist/esm/utils/chart/tooltip.d.ts +6 -0
- package/dist/{cjs/hooks/useChartOptions → esm/utils/chart}/tooltip.js +2 -7
- package/dist/esm/utils/chart/zoom.js +0 -2
- package/package.json +3 -1
- package/dist/cjs/hooks/useChartDimensions/index.d.ts +0 -17
- package/dist/cjs/hooks/useChartDimensions/utils.d.ts +0 -10
- package/dist/cjs/hooks/useChartDimensions/utils.js +0 -41
- package/dist/cjs/hooks/useChartOptions/tooltip.d.ts +0 -13
- package/dist/cjs/hooks/useYAxisLabelWidth/index.d.ts +0 -44
- package/dist/esm/hooks/useChartDimensions/index.d.ts +0 -17
- package/dist/esm/hooks/useChartDimensions/utils.d.ts +0 -10
- package/dist/esm/hooks/useChartDimensions/utils.js +0 -41
- package/dist/esm/hooks/useChartOptions/tooltip.d.ts +0 -13
- package/dist/esm/hooks/useYAxisLabelWidth/index.d.ts +0 -44
- /package/dist/cjs/{hooks/useChartOptions → components/ChartInner/utils}/chart.js +0 -0
- /package/dist/cjs/components/ChartInner/{utils.js → utils/common.js} +0 -0
- /package/dist/cjs/hooks/{useChartOptions/types.js → types.js} +0 -0
- /package/dist/esm/{hooks/useChartOptions → components/ChartInner/utils}/chart.js +0 -0
- /package/dist/esm/components/ChartInner/{utils.js → utils/common.js} +0 -0
- /package/dist/esm/hooks/{useChartOptions/types.js → types.js} +0 -0
|
@@ -68,7 +68,6 @@ async function getSvgAxisLabel({ getTextSize, text, axis, top, left, labelMaxWid
|
|
|
68
68
|
};
|
|
69
69
|
return svgLabel;
|
|
70
70
|
}
|
|
71
|
-
// eslint-disable-next-line complexity
|
|
72
71
|
export async function prepareXAxisData({ axis, boundsOffsetLeft, boundsOffsetRight, boundsWidth, height, scale, series, split, yAxis, }) {
|
|
73
72
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
74
73
|
const xAxisItems = [];
|
|
@@ -3,9 +3,6 @@ import { ArrowRotateLeft } from '@gravity-ui/icons';
|
|
|
3
3
|
import { Button, ButtonIcon, useUniqId } from '@gravity-ui/uikit';
|
|
4
4
|
import { useCrosshair, usePrevious } from '../../hooks';
|
|
5
5
|
import { getPreparedRangeSlider } from '../../hooks/useAxis/range-slider';
|
|
6
|
-
import { getPreparedChart } from '../../hooks/useChartOptions/chart';
|
|
7
|
-
import { getPreparedTitle } from '../../hooks/useChartOptions/title';
|
|
8
|
-
import { getPreparedTooltip } from '../../hooks/useChartOptions/tooltip';
|
|
9
6
|
import { getClipPathIdByBounds } from '../../hooks/useShapes/utils';
|
|
10
7
|
import { EventType, block, getDispatcher, isBandScale } from '../../utils';
|
|
11
8
|
import { AxisX } from '../AxisX/AxisX';
|
|
@@ -21,7 +18,8 @@ import { getInitialRangeSliderState } from '../utils';
|
|
|
21
18
|
import { useChartInnerHandlers } from './useChartInnerHandlers';
|
|
22
19
|
import { useChartInnerProps } from './useChartInnerProps';
|
|
23
20
|
import { useChartInnerState } from './useChartInnerState';
|
|
24
|
-
import {
|
|
21
|
+
import { useDefaultState } from './useDefaultState';
|
|
22
|
+
import { getPreparedChart, getPreparedTitle, getPreparedTooltip, getResetZoomButtonStyle, useAsyncState, useDebouncedValue, } from './utils';
|
|
25
23
|
import './styles.css';
|
|
26
24
|
const b = block('chart');
|
|
27
25
|
const DEBOUNCED_VALUE_DELAY = 10;
|
|
@@ -63,7 +61,7 @@ export const ChartInner = (props) => {
|
|
|
63
61
|
preparedRangeSlider,
|
|
64
62
|
tooltip: preparedTooltip,
|
|
65
63
|
});
|
|
66
|
-
const { allPreparedSeries, boundsHeight, boundsOffsetLeft, boundsOffsetTop, boundsWidth, handleLegendItemClick,
|
|
64
|
+
const { allPreparedSeries, boundsHeight, boundsOffsetLeft, boundsOffsetTop, boundsWidth, handleLegendItemClick, legendConfig, legendItems, preparedLegend, preparedSeries, preparedSeriesOptions, preparedSplit, shapes, shapesData, shapesReady, xAxis, xScale, yAxis, yScale, } = useChartInnerProps(Object.assign(Object.assign({}, props), { clipPathId,
|
|
67
65
|
dispatcher,
|
|
68
66
|
htmlLayout, plotNode: plotRef.current, preparedChart,
|
|
69
67
|
rangeSliderState,
|
|
@@ -99,7 +97,21 @@ export const ChartInner = (props) => {
|
|
|
99
97
|
xScale,
|
|
100
98
|
yScale,
|
|
101
99
|
tooltipThrottle: preparedTooltip.throttle,
|
|
102
|
-
|
|
100
|
+
});
|
|
101
|
+
useDefaultState({
|
|
102
|
+
boundsHeight,
|
|
103
|
+
boundsOffsetLeft,
|
|
104
|
+
boundsOffsetTop,
|
|
105
|
+
boundsWidth,
|
|
106
|
+
defaultState: data.defaultState,
|
|
107
|
+
dispatcher,
|
|
108
|
+
shapesData,
|
|
109
|
+
shapesReady,
|
|
110
|
+
svgRef,
|
|
111
|
+
xAxis,
|
|
112
|
+
yAxis,
|
|
113
|
+
xScale,
|
|
114
|
+
yScale,
|
|
103
115
|
});
|
|
104
116
|
const clickHandler = (_b = (_a = data.chart) === null || _a === void 0 ? void 0 : _a.events) === null || _b === void 0 ? void 0 : _b.click;
|
|
105
117
|
const pointerMoveHandler = (_d = (_c = data.chart) === null || _c === void 0 ? void 0 : _c.events) === null || _d === void 0 ? void 0 : _d.pointermove;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { Dispatch } from 'd3';
|
|
3
3
|
import type { PreparedXAxis, PreparedYAxis, ShapeData } from '../../hooks';
|
|
4
4
|
import type { ChartScale } from '../../hooks/useAxisScales/types';
|
|
@@ -20,7 +20,6 @@ type Props = {
|
|
|
20
20
|
xScale?: ChartScale;
|
|
21
21
|
yScale?: (ChartScale | undefined)[];
|
|
22
22
|
tooltipThrottle: number;
|
|
23
|
-
isOutsideBounds: (x: number, y: number) => boolean;
|
|
24
23
|
};
|
|
25
24
|
export declare function useChartInnerHandlers(props: Props): {
|
|
26
25
|
handleChartClick: (event: React.MouseEvent<SVGSVGElement>) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { pointer } from 'd3';
|
|
2
3
|
import get from 'lodash/get';
|
|
3
4
|
import throttle from 'lodash/throttle';
|
|
@@ -6,7 +7,10 @@ import { EventType } from '../../utils';
|
|
|
6
7
|
import { getClosestPoints } from '../../utils/chart/get-closest-data';
|
|
7
8
|
import { getHoveredPlots } from '../../utils/chart/get-hovered-plots';
|
|
8
9
|
export function useChartInnerHandlers(props) {
|
|
9
|
-
const { boundsHeight, boundsOffsetLeft, boundsOffsetTop, boundsWidth, dispatcher, shapesData, svgContainer, togglePinTooltip, tooltipPinned, unpinTooltip, xAxis, yAxis, xScale, yScale, tooltipThrottle,
|
|
10
|
+
const { boundsHeight, boundsOffsetLeft, boundsOffsetTop, boundsWidth, dispatcher, shapesData, svgContainer, togglePinTooltip, tooltipPinned, unpinTooltip, xAxis, yAxis, xScale, yScale, tooltipThrottle, } = props;
|
|
11
|
+
const isOutsideBounds = React.useCallback((x, y) => {
|
|
12
|
+
return x < 0 || x > boundsWidth || y < 0 || y > boundsHeight;
|
|
13
|
+
}, [boundsHeight, boundsWidth]);
|
|
10
14
|
const handleMove = ([pointerX, pointerY], event) => {
|
|
11
15
|
if (tooltipPinned) {
|
|
12
16
|
return;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Dispatch } from 'd3';
|
|
3
|
-
import type { ChartScale, LegendItem, OnLegendItemClick,
|
|
3
|
+
import type { ChartScale, LegendItem, OnLegendItemClick, PreparedLegend, PreparedSeries, PreparedSplit, PreparedXAxis, RangeSliderState, ShapeData, ZoomState } from '../../hooks';
|
|
4
|
+
import type { PreparedChart } from '../../hooks/types';
|
|
4
5
|
import type { LegendConfig } from '../../types';
|
|
5
6
|
import type { ChartInnerProps } from './types';
|
|
6
7
|
type Props = ChartInnerProps & {
|
|
@@ -22,7 +23,7 @@ export declare function useChartInnerProps(props: Props): {
|
|
|
22
23
|
xAxis: PreparedXAxis | null;
|
|
23
24
|
yAxis: (Omit<import("../../types").ChartAxis, "type" | "labels" | "plotLines" | "plotBands"> & {
|
|
24
25
|
type: import("../../types").ChartAxisType;
|
|
25
|
-
labels: Omit<import("../../types").ChartAxisLabels, "
|
|
26
|
+
labels: Omit<import("../../types").ChartAxisLabels, "style" | "enabled" | "padding" | "autoRotation"> & Required<Pick<import("../../types").ChartAxisLabels, "margin" | "enabled" | "html" | "rotation" | "padding">> & {
|
|
26
27
|
style: import("../../types").BaseTextStyle;
|
|
27
28
|
rotation: number;
|
|
28
29
|
height: number;
|
|
@@ -60,7 +61,6 @@ export declare function useChartInnerProps(props: Props): {
|
|
|
60
61
|
shapesData: ShapeData[];
|
|
61
62
|
shapesReady: boolean;
|
|
62
63
|
handleLegendItemClick: OnLegendItemClick;
|
|
63
|
-
isOutsideBounds: (x: number, y: number) => boolean;
|
|
64
64
|
allPreparedSeries?: PreparedSeries[] | undefined;
|
|
65
65
|
legendConfig?: LegendConfig | undefined;
|
|
66
66
|
legendItems?: LegendItem[][] | undefined;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import isEqual from 'lodash/isEqual';
|
|
3
3
|
import { DEFAULT_PALETTE, SERIES_TYPE } from '../../constants';
|
|
4
|
-
import { createScales, getAxes,
|
|
5
|
-
import { getYAxisWidth } from '../../hooks/useChartDimensions/utils';
|
|
4
|
+
import { createScales, getAxes, getPreparedSeries, getShapes, getSplit, getVisibleSeries, useZoom, } from '../../hooks';
|
|
6
5
|
import { getLegendComponents, getPreparedLegend } from '../../hooks/useSeries/prepare-legend';
|
|
7
6
|
import { getPreparedOptions } from '../../hooks/useSeries/prepare-options';
|
|
8
7
|
import { getActiveLegendItems, getAllLegendItems } from '../../hooks/useSeries/utils';
|
|
9
|
-
import { getEffectiveXRange, getSortedSeriesData, getZoomedSeriesData, isAxisRelatedSeries, } from '../../utils';
|
|
10
|
-
import {
|
|
8
|
+
import { getChartDimensions, getEffectiveXRange, getSortedSeriesData, getYAxisWidth, getZoomedSeriesData, isAxisRelatedSeries, } from '../../utils';
|
|
9
|
+
import { getNormalizedXAxis, getNormalizedYAxis, recalculateYAxisLabelsWidth } from './utils';
|
|
10
|
+
import { hasAtLeastOneSeriesDataPerPlot } from './utils/common';
|
|
11
11
|
const CLIP_PATH_BY_SERIES_TYPE = {
|
|
12
12
|
[SERIES_TYPE.Scatter]: false,
|
|
13
13
|
};
|
|
@@ -36,9 +36,8 @@ function getBoundsOffsetLeft(args) {
|
|
|
36
36
|
}, 0);
|
|
37
37
|
return chartMarginLeft + legendOffset + leftAxisWidth;
|
|
38
38
|
}
|
|
39
|
-
// eslint-disable-next-line complexity
|
|
40
39
|
export function useChartInnerProps(props) {
|
|
41
|
-
var _a, _b, _c, _d, _e, _f
|
|
40
|
+
var _a, _b, _c, _d, _e, _f;
|
|
42
41
|
const { clipPathId, data, dispatcher, height, htmlLayout, plotNode, preparedChart, rangeSliderState, width, updateZoomState, zoomState, } = props;
|
|
43
42
|
const [selectedLegendItems, setSelectedLegendItems] = React.useState(null);
|
|
44
43
|
const [chartState, setState] = React.useState(null);
|
|
@@ -158,9 +157,6 @@ export function useChartInnerProps(props) {
|
|
|
158
157
|
yAxis = newYAxis;
|
|
159
158
|
calculateAxisBasedProps();
|
|
160
159
|
}
|
|
161
|
-
const isOutsideBounds = (x, y) => {
|
|
162
|
-
return x < 0 || x > boundsWidth || y < 0 || y > boundsHeight;
|
|
163
|
-
};
|
|
164
160
|
const { shapes, shapesData } = await getShapes({
|
|
165
161
|
boundsWidth,
|
|
166
162
|
boundsHeight,
|
|
@@ -175,7 +171,9 @@ export function useChartInnerProps(props) {
|
|
|
175
171
|
split: preparedSplit,
|
|
176
172
|
htmlLayout,
|
|
177
173
|
clipPathId,
|
|
178
|
-
isOutsideBounds,
|
|
174
|
+
isOutsideBounds: (x, y) => {
|
|
175
|
+
return x < 0 || x > boundsWidth || y < 0 || y > boundsHeight;
|
|
176
|
+
},
|
|
179
177
|
zoomState: effectiveZoomState,
|
|
180
178
|
});
|
|
181
179
|
const boundsOffsetTop = getBoundsOffsetTop({
|
|
@@ -198,7 +196,6 @@ export function useChartInnerProps(props) {
|
|
|
198
196
|
boundsOffsetLeft,
|
|
199
197
|
boundsOffsetTop,
|
|
200
198
|
boundsWidth,
|
|
201
|
-
isOutsideBounds,
|
|
202
199
|
legendConfig,
|
|
203
200
|
legendItems,
|
|
204
201
|
preparedLegend,
|
|
@@ -238,6 +235,8 @@ export function useChartInnerProps(props) {
|
|
|
238
235
|
const activeLegendItems = React.useMemo(() => { var _a; return (_a = chartState === null || chartState === void 0 ? void 0 : chartState.activeLegendItems) !== null && _a !== void 0 ? _a : []; }, [chartState === null || chartState === void 0 ? void 0 : chartState.activeLegendItems]);
|
|
239
236
|
const boundsHeight = (_a = chartState === null || chartState === void 0 ? void 0 : chartState.boundsHeight) !== null && _a !== void 0 ? _a : 0;
|
|
240
237
|
const boundsWidth = (_b = chartState === null || chartState === void 0 ? void 0 : chartState.boundsWidth) !== null && _b !== void 0 ? _b : 0;
|
|
238
|
+
const xAxis = (_c = chartState === null || chartState === void 0 ? void 0 : chartState.xAxis) !== null && _c !== void 0 ? _c : null;
|
|
239
|
+
const yAxis = React.useMemo(() => { var _a; return (_a = chartState === null || chartState === void 0 ? void 0 : chartState.yAxis) !== null && _a !== void 0 ? _a : []; }, [chartState === null || chartState === void 0 ? void 0 : chartState.yAxis]);
|
|
241
240
|
const handleLegendItemClick = React.useCallback(({ id, metaKey }) => {
|
|
242
241
|
const allItems = getAllLegendItems(preparedSeries);
|
|
243
242
|
const onlyItemSelected = (selectedLegendItems !== null && selectedLegendItems !== void 0 ? selectedLegendItems : []).length === 1 && activeLegendItems.includes(id);
|
|
@@ -259,9 +258,7 @@ export function useChartInnerProps(props) {
|
|
|
259
258
|
}
|
|
260
259
|
setSelectedLegendItems(nextActiveLegendItems);
|
|
261
260
|
}, [preparedSeries, selectedLegendItems, activeLegendItems]);
|
|
262
|
-
const
|
|
263
|
-
const yAxis = (_d = chartState === null || chartState === void 0 ? void 0 : chartState.yAxis) !== null && _d !== void 0 ? _d : [];
|
|
264
|
-
const handleAttemptToSetZoomState = (nextZoomState) => {
|
|
261
|
+
const handleAttemptToSetZoomState = React.useCallback((nextZoomState) => {
|
|
265
262
|
var _a;
|
|
266
263
|
const { preparedSeries: nextZoomedSeriesData } = getZoomedSeriesData({
|
|
267
264
|
seriesData: (_a = chartState === null || chartState === void 0 ? void 0 : chartState.preparedSeries) !== null && _a !== void 0 ? _a : [],
|
|
@@ -273,7 +270,7 @@ export function useChartInnerProps(props) {
|
|
|
273
270
|
if (hasData) {
|
|
274
271
|
updateZoomState(nextZoomState);
|
|
275
272
|
}
|
|
276
|
-
};
|
|
273
|
+
}, [chartState === null || chartState === void 0 ? void 0 : chartState.preparedSeries, updateZoomState, xAxis, yAxis]);
|
|
277
274
|
useZoom({
|
|
278
275
|
node: plotNode,
|
|
279
276
|
onUpdate: handleAttemptToSetZoomState,
|
|
@@ -287,8 +284,8 @@ export function useChartInnerProps(props) {
|
|
|
287
284
|
yScale: chartState === null || chartState === void 0 ? void 0 : chartState.yScale,
|
|
288
285
|
});
|
|
289
286
|
// additional end
|
|
290
|
-
return Object.assign(Object.assign({}, chartState), { preparedSeries, boundsOffsetLeft: (
|
|
287
|
+
return Object.assign(Object.assign({}, chartState), { preparedSeries, boundsOffsetLeft: (_d = chartState === null || chartState === void 0 ? void 0 : chartState.boundsOffsetLeft) !== null && _d !== void 0 ? _d : 0, boundsOffsetTop: (_e = chartState === null || chartState === void 0 ? void 0 : chartState.boundsOffsetTop) !== null && _e !== void 0 ? _e : 0, boundsHeight,
|
|
291
288
|
boundsWidth,
|
|
292
289
|
xAxis,
|
|
293
|
-
yAxis, shapesData: (
|
|
290
|
+
yAxis, shapesData: (_f = chartState === null || chartState === void 0 ? void 0 : chartState.shapesData) !== null && _f !== void 0 ? _f : [], shapesReady: Boolean(chartState), handleLegendItemClick });
|
|
294
291
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Dispatch } from 'd3';
|
|
3
|
+
import type { PreparedXAxis, PreparedYAxis, ShapeData } from '../../hooks';
|
|
4
|
+
import type { ChartScale } from '../../hooks/useAxisScales/types';
|
|
5
|
+
type Props = {
|
|
6
|
+
boundsHeight: number;
|
|
7
|
+
boundsOffsetLeft: number;
|
|
8
|
+
boundsOffsetTop: number;
|
|
9
|
+
boundsWidth: number;
|
|
10
|
+
defaultState?: {
|
|
11
|
+
hoveredPosition?: {
|
|
12
|
+
x: number | string;
|
|
13
|
+
y: number | string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
dispatcher: Dispatch<object>;
|
|
17
|
+
shapesData: ShapeData[];
|
|
18
|
+
shapesReady: boolean;
|
|
19
|
+
svgRef: React.RefObject<SVGSVGElement | null>;
|
|
20
|
+
xAxis: PreparedXAxis | null;
|
|
21
|
+
yAxis: PreparedYAxis[];
|
|
22
|
+
xScale?: ChartScale;
|
|
23
|
+
yScale?: (ChartScale | undefined)[];
|
|
24
|
+
};
|
|
25
|
+
export declare function useDefaultState(props: Props): void;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import get from 'lodash/get';
|
|
3
|
+
import { EventType } from '../../utils';
|
|
4
|
+
import { getClosestPoints } from '../../utils/chart/get-closest-data';
|
|
5
|
+
import { getHoveredPlots } from '../../utils/chart/get-hovered-plots';
|
|
6
|
+
import { calculateNumericProperty } from '../../utils/chart/math';
|
|
7
|
+
export function useDefaultState(props) {
|
|
8
|
+
const { boundsHeight, boundsOffsetLeft, boundsOffsetTop, boundsWidth, defaultState, dispatcher, shapesData, shapesReady, svgRef, xAxis, yAxis, xScale, yScale, } = props;
|
|
9
|
+
const appliedRef = React.useRef(false);
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
const hoveredPosition = defaultState === null || defaultState === void 0 ? void 0 : defaultState.hoveredPosition;
|
|
12
|
+
if (appliedRef.current || !shapesReady || !hoveredPosition) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
appliedRef.current = true;
|
|
16
|
+
// Defer dispatch so shape components (Area, Line, etc.) register their hover-shape.*
|
|
17
|
+
// listeners first; parent effects run before child effects in React.
|
|
18
|
+
queueMicrotask(() => {
|
|
19
|
+
var _a;
|
|
20
|
+
const x = calculateNumericProperty({ value: hoveredPosition.x, base: boundsWidth });
|
|
21
|
+
const y = calculateNumericProperty({ value: hoveredPosition.y, base: boundsHeight });
|
|
22
|
+
if (x === undefined || y === undefined) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const shapesDataWithTooltipEnabled = shapesData.filter((d) => get(d, 'series.tooltip.enabled', true));
|
|
26
|
+
const closest = getClosestPoints({
|
|
27
|
+
position: [x, y],
|
|
28
|
+
shapesData: shapesDataWithTooltipEnabled,
|
|
29
|
+
boundsHeight,
|
|
30
|
+
boundsWidth,
|
|
31
|
+
});
|
|
32
|
+
const { plotLines, plotBands } = getHoveredPlots({
|
|
33
|
+
pointerX: x,
|
|
34
|
+
pointerY: y,
|
|
35
|
+
xAxis,
|
|
36
|
+
yAxis,
|
|
37
|
+
xScale,
|
|
38
|
+
yScale,
|
|
39
|
+
});
|
|
40
|
+
const hoveredPlotsArg = { lines: plotLines, bands: plotBands };
|
|
41
|
+
const svgPointerX = x + boundsOffsetLeft;
|
|
42
|
+
const svgPointerY = y + boundsOffsetTop;
|
|
43
|
+
dispatcher.call(EventType.HOVER_SHAPE, undefined, closest, [svgPointerX, svgPointerY], hoveredPlotsArg);
|
|
44
|
+
const rect = (_a = svgRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
45
|
+
const syntheticEvent = rect &&
|
|
46
|
+
new PointerEvent('pointermove', {
|
|
47
|
+
bubbles: true,
|
|
48
|
+
clientX: rect.left + svgPointerX,
|
|
49
|
+
clientY: rect.top + svgPointerY,
|
|
50
|
+
});
|
|
51
|
+
dispatcher.call(EventType.POINTERMOVE_CHART, {}, {
|
|
52
|
+
hovered: closest,
|
|
53
|
+
xAxis,
|
|
54
|
+
yAxis: yAxis[0],
|
|
55
|
+
hoveredPlotLines: plotLines,
|
|
56
|
+
hoveredPlotBands: plotBands,
|
|
57
|
+
}, syntheticEvent);
|
|
58
|
+
});
|
|
59
|
+
}, [
|
|
60
|
+
boundsHeight,
|
|
61
|
+
boundsOffsetLeft,
|
|
62
|
+
boundsOffsetTop,
|
|
63
|
+
boundsWidth,
|
|
64
|
+
defaultState,
|
|
65
|
+
dispatcher,
|
|
66
|
+
shapesData,
|
|
67
|
+
shapesReady,
|
|
68
|
+
svgRef,
|
|
69
|
+
xAxis,
|
|
70
|
+
xScale,
|
|
71
|
+
yAxis,
|
|
72
|
+
yScale,
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { PreparedYAxis } from '../../../hooks';
|
|
2
|
+
import type { ChartScale } from '../../../hooks/useAxisScales/types';
|
|
3
|
+
import type { PreparedSeries } from '../../../hooks/useSeries/types';
|
|
4
|
+
export declare function recalculateYAxisLabelsWidth(props: {
|
|
5
|
+
seriesData: PreparedSeries[];
|
|
6
|
+
yAxis: PreparedYAxis[];
|
|
7
|
+
yScale?: (ChartScale | undefined)[];
|
|
8
|
+
}): Promise<(Omit<import("../../..").ChartAxis, "type" | "labels" | "plotLines" | "plotBands"> & {
|
|
9
|
+
type: import("../../..").ChartAxisType;
|
|
10
|
+
labels: Omit<import("../../..").ChartAxisLabels, "style" | "enabled" | "padding" | "autoRotation"> & Required<Pick<import("../../..").ChartAxisLabels, "margin" | "enabled" | "html" | "rotation" | "padding">> & {
|
|
11
|
+
style: import("../../..").BaseTextStyle;
|
|
12
|
+
rotation: number;
|
|
13
|
+
height: number;
|
|
14
|
+
width: number;
|
|
15
|
+
lineHeight: number;
|
|
16
|
+
maxWidth: number;
|
|
17
|
+
};
|
|
18
|
+
title: {
|
|
19
|
+
height: number;
|
|
20
|
+
width: number;
|
|
21
|
+
text: string;
|
|
22
|
+
margin: number;
|
|
23
|
+
style: import("../../..").BaseTextStyle;
|
|
24
|
+
align: import("../../..").ChartAxisTitleAlignment;
|
|
25
|
+
maxRowCount: number;
|
|
26
|
+
rotation: number;
|
|
27
|
+
maxWidth: number;
|
|
28
|
+
html: boolean;
|
|
29
|
+
};
|
|
30
|
+
min?: number;
|
|
31
|
+
grid: {
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
};
|
|
34
|
+
maxPadding: number;
|
|
35
|
+
ticks: {
|
|
36
|
+
pixelInterval?: number;
|
|
37
|
+
};
|
|
38
|
+
tickMarks: import("../../../hooks").PreparedAxisTickMarks;
|
|
39
|
+
position: "left" | "right" | "top" | "bottom";
|
|
40
|
+
plotIndex: number;
|
|
41
|
+
plotLines: import("../../../hooks").PreparedAxisPlotLine[];
|
|
42
|
+
plotBands: import("../../../hooks").PreparedAxisPlotBand[];
|
|
43
|
+
crosshair: Required<import("../../..").AxisCrosshair>;
|
|
44
|
+
})[]>;
|
package/dist/{esm/hooks/useYAxisLabelWidth/index.js → cjs/components/ChartInner/utils/axis.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
|
-
import { getYAxisLabelMaxWidth } from '
|
|
2
|
+
import { getYAxisLabelMaxWidth } from '../../../hooks/useAxis/y-axis';
|
|
3
3
|
export async function recalculateYAxisLabelsWidth(props) {
|
|
4
4
|
const { seriesData, yAxis, yScale } = props;
|
|
5
5
|
const axisIndexesToRecalculateMap = new Map();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { PreparedChart, PreparedTitle } from '../../../hooks/types';
|
|
2
|
+
import type { ChartData, ChartSeries } from '../../../types';
|
|
3
3
|
export declare const getPreparedChart: (args: {
|
|
4
4
|
chart: ChartData["chart"];
|
|
5
5
|
seriesData: ChartSeries[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { PreparedAxis, PreparedSeries
|
|
2
|
+
import type { PreparedAxis, PreparedSeries } from '../../../hooks';
|
|
3
|
+
import type { PreparedZoom } from '../../../hooks/types';
|
|
3
4
|
export declare function hasAtLeastOneSeriesDataPerPlot(seriesData: PreparedSeries[], yAxes?: PreparedAxis[]): boolean;
|
|
4
5
|
export declare function useAsyncState<T>(value: T, setState: () => Promise<T>, isReady?: boolean): T;
|
|
5
6
|
export declare function getResetZoomButtonStyle(args: {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { ChartData } from '
|
|
1
|
+
import type { ChartData } from '../../../types';
|
|
2
2
|
export declare function getNormalizedXAxis(props: {
|
|
3
3
|
xAxis: ChartData['xAxis'];
|
|
4
4
|
}): {
|
|
5
5
|
categories: string[] | undefined;
|
|
6
|
-
rangeSlider?: import("
|
|
7
|
-
crosshair?: import("
|
|
6
|
+
rangeSlider?: import("../../../types").ChartAxisRangeSlider;
|
|
7
|
+
crosshair?: import("../../../types").AxisCrosshair;
|
|
8
8
|
timestamps?: number[];
|
|
9
|
-
type?: import("
|
|
10
|
-
labels?: import("
|
|
9
|
+
type?: import("../../../types").ChartAxisType;
|
|
10
|
+
labels?: import("../../../types").ChartAxisLabels;
|
|
11
11
|
lineColor?: string;
|
|
12
|
-
title?: import("
|
|
12
|
+
title?: import("../../../types").ChartAxisTitle;
|
|
13
13
|
min?: number;
|
|
14
14
|
max?: number;
|
|
15
15
|
grid?: {
|
|
@@ -20,9 +20,9 @@ export declare function getNormalizedXAxis(props: {
|
|
|
20
20
|
interval?: number | string;
|
|
21
21
|
};
|
|
22
22
|
maxPadding?: number;
|
|
23
|
-
plotLines?: import("
|
|
24
|
-
plotBands?: import("
|
|
25
|
-
tickMarks?: import("
|
|
23
|
+
plotLines?: import("../../../types").AxisPlotLine[];
|
|
24
|
+
plotBands?: import("../../../types").AxisPlotBand[];
|
|
25
|
+
tickMarks?: import("../../../types").ChartAxisTickMarks;
|
|
26
26
|
visible?: boolean;
|
|
27
27
|
order?: "sortAsc" | "sortDesc" | "reverse";
|
|
28
28
|
startOnTick?: boolean;
|
|
@@ -30,4 +30,4 @@ export declare function getNormalizedXAxis(props: {
|
|
|
30
30
|
};
|
|
31
31
|
export declare function getNormalizedYAxis(props: {
|
|
32
32
|
yAxis: ChartData['yAxis'];
|
|
33
|
-
}): import("
|
|
33
|
+
}): import("../../../types").ChartYAxis[] | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { PreparedTitle } from '../../../hooks/types';
|
|
2
|
+
import type { ChartData } from '../../../types';
|
|
3
3
|
export declare const getPreparedTitle: ({ title, }: {
|
|
4
4
|
title: ChartData["title"];
|
|
5
5
|
}) => PreparedTitle | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
|
-
import { getHorizontalSvgTextHeight } from '
|
|
2
|
+
import { getHorizontalSvgTextHeight } from '../../../utils';
|
|
3
3
|
const DEFAULT_TITLE_FONT_SIZE = '15px';
|
|
4
4
|
const TITLE_PADDINGS = 8 * 2;
|
|
5
5
|
export const getPreparedTitle = ({ title, }) => {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PreparedTooltip } from '../../../hooks/types';
|
|
2
|
+
import type { ChartData, ChartSeries, ChartXAxis, ChartYAxis } from '../../../types';
|
|
3
|
+
export declare const getPreparedTooltip: (args: {
|
|
4
|
+
tooltip: ChartData["tooltip"];
|
|
5
|
+
seriesData: ChartSeries[];
|
|
6
|
+
yAxes?: ChartYAxis[];
|
|
7
|
+
xAxis?: ChartXAxis;
|
|
8
|
+
}) => PreparedTooltip;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import get from 'lodash/get';
|
|
2
|
+
import { getDefaultTooltipHeaderFormat } from '../../../utils/chart/tooltip';
|
|
3
|
+
export const getPreparedTooltip = (args) => {
|
|
4
|
+
var _a, _b;
|
|
5
|
+
const { tooltip, seriesData, yAxes, xAxis } = args;
|
|
6
|
+
return Object.assign(Object.assign({}, tooltip), { enabled: get(tooltip, 'enabled', true), throttle: (_a = tooltip === null || tooltip === void 0 ? void 0 : tooltip.throttle) !== null && _a !== void 0 ? _a : 0, headerFormat: (_b = tooltip === null || tooltip === void 0 ? void 0 : tooltip.headerFormat) !== null && _b !== void 0 ? _b : getDefaultTooltipHeaderFormat({ seriesData, yAxes, xAxis }) });
|
|
7
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ZoomType } from '
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { ZoomType } from '../../../constants';
|
|
2
|
+
import type { PreparedZoom } from '../../../hooks/types';
|
|
3
|
+
import type { ChartSeries, ChartZoom } from '../../../types';
|
|
4
4
|
export declare function getZoomType(args: {
|
|
5
5
|
seriesData: ChartSeries[];
|
|
6
6
|
zoomType?: ZoomType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import intersection from 'lodash/intersection';
|
|
2
2
|
import merge from 'lodash/merge';
|
|
3
|
-
import { SERIES_TYPE, ZOOM_TYPE, brushDefaults } from '
|
|
3
|
+
import { SERIES_TYPE, ZOOM_TYPE, brushDefaults } from '../../../constants';
|
|
4
4
|
function mapSeriesTypeToZoomType(seriesType) {
|
|
5
5
|
switch (seriesType) {
|
|
6
6
|
case SERIES_TYPE.Area: {
|
|
@@ -4,10 +4,7 @@ export * from './useAxisScales';
|
|
|
4
4
|
export * from './useAxisScales/types';
|
|
5
5
|
export * from './useBrush';
|
|
6
6
|
export * from './useBrush/types';
|
|
7
|
-
export * from './useChartDimensions';
|
|
8
|
-
export * from './useChartOptions/types';
|
|
9
7
|
export * from './useCrosshair';
|
|
10
|
-
export * from './useNormalizedOriginalData';
|
|
11
8
|
export * from './usePrevious';
|
|
12
9
|
export * from './useRangeSlider';
|
|
13
10
|
export * from './useRangeSlider/types';
|
|
@@ -17,6 +14,6 @@ export * from './useShapes';
|
|
|
17
14
|
export * from './useSplit';
|
|
18
15
|
export * from './useSplit/types';
|
|
19
16
|
export * from './useTooltip';
|
|
20
|
-
export * from './useYAxisLabelWidth';
|
|
21
17
|
export * from './useZoom';
|
|
22
18
|
export * from './useZoom/types';
|
|
19
|
+
export * from './types';
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -4,10 +4,7 @@ export * from './useAxisScales';
|
|
|
4
4
|
export * from './useAxisScales/types';
|
|
5
5
|
export * from './useBrush';
|
|
6
6
|
export * from './useBrush/types';
|
|
7
|
-
export * from './useChartDimensions';
|
|
8
|
-
export * from './useChartOptions/types';
|
|
9
7
|
export * from './useCrosshair';
|
|
10
|
-
export * from './useNormalizedOriginalData';
|
|
11
8
|
export * from './usePrevious';
|
|
12
9
|
export * from './useRangeSlider';
|
|
13
10
|
export * from './useRangeSlider/types';
|
|
@@ -17,6 +14,6 @@ export * from './useShapes';
|
|
|
17
14
|
export * from './useSplit';
|
|
18
15
|
export * from './useSplit/types';
|
|
19
16
|
export * from './useTooltip';
|
|
20
|
-
export * from './useYAxisLabelWidth';
|
|
21
17
|
export * from './useZoom';
|
|
22
18
|
export * from './useZoom/types';
|
|
19
|
+
export * from './types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChartBrush, ChartData, ChartMargin, ChartZoom, DeepRequired } from '
|
|
1
|
+
import type { ChartBrush, ChartData, ChartMargin, ChartZoom, DeepRequired } from '../types';
|
|
2
2
|
export type PreparedZoom = DeepRequired<Omit<ChartZoom, 'enabled' | 'brush'>> & DeepRequired<{
|
|
3
3
|
brush: ChartBrush;
|
|
4
4
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChartXAxis, ChartYAxis, LegendConfig } from '../../types';
|
|
2
|
-
import type { PreparedChart } from '../
|
|
2
|
+
import type { PreparedChart } from '../types';
|
|
3
3
|
import type { PreparedLegend, PreparedSeries, PreparedSeriesOptions } from '../useSeries/types';
|
|
4
4
|
import type { AxesState } from './types';
|
|
5
5
|
interface UseAxesProps {
|
|
@@ -18,7 +18,7 @@ export declare function getAxes(props: UseAxesProps): Promise<{
|
|
|
18
18
|
xAxis: import("./types").PreparedXAxis | null;
|
|
19
19
|
yAxis: (Omit<import("../../types").ChartAxis, "type" | "labels" | "plotLines" | "plotBands"> & {
|
|
20
20
|
type: import("../../types").ChartAxisType;
|
|
21
|
-
labels: Omit<import("../../types").ChartAxisLabels, "
|
|
21
|
+
labels: Omit<import("../../types").ChartAxisLabels, "style" | "enabled" | "padding" | "autoRotation"> & Required<Pick<import("../../types").ChartAxisLabels, "margin" | "enabled" | "html" | "rotation" | "padding">> & {
|
|
22
22
|
style: import("../../types").BaseTextStyle;
|
|
23
23
|
rotation: number;
|
|
24
24
|
height: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import isEqual from 'lodash/isEqual';
|
|
3
|
-
import { getWidthOccupiedByYAxis } from '
|
|
3
|
+
import { getWidthOccupiedByYAxis } from '../../utils';
|
|
4
4
|
import { getPreparedXAxis } from './x-axis';
|
|
5
5
|
import { getPreparedYAxis } from './y-axis';
|
|
6
6
|
export async function getAxes(props) {
|
|
@@ -49,9 +49,7 @@ export const getPreparedYAxis = ({ height, boundsHeight, width, seriesData, yAxi
|
|
|
49
49
|
if (!hasAxisRelatedSeries) {
|
|
50
50
|
return Promise.resolve([]);
|
|
51
51
|
}
|
|
52
|
-
return Promise.all(
|
|
53
|
-
// eslint-disable-next-line complexity
|
|
54
|
-
axisItems.map(async (axisItem, axisIndex) => {
|
|
52
|
+
return Promise.all(axisItems.map(async (axisItem, axisIndex) => {
|
|
55
53
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
56
54
|
const plotIndex = get(axisItem, 'plotIndex', 0);
|
|
57
55
|
const firstPlotAxis = !axisByPlot[plotIndex];
|
|
@@ -34,7 +34,6 @@ function getXScaleRange({ boundsWidth, hasZoomX }) {
|
|
|
34
34
|
const range = hasZoomX ? xRangeZoom : xRange;
|
|
35
35
|
return range;
|
|
36
36
|
}
|
|
37
|
-
// eslint-disable-next-line complexity
|
|
38
37
|
export function createXScale(args) {
|
|
39
38
|
const { axis, boundsWidth, series, rangeSliderState, zoomStateX } = args;
|
|
40
39
|
const effectiveX = getEffectiveXRange(zoomStateX, rangeSliderState);
|
|
@@ -117,7 +117,6 @@ function getDomainMaxAlignedToEndTick(args) {
|
|
|
117
117
|
}
|
|
118
118
|
return dNewMax;
|
|
119
119
|
}
|
|
120
|
-
// eslint-disable-next-line complexity
|
|
121
120
|
export function createYScale(args) {
|
|
122
121
|
const { axis, boundsHeight, series, primaryAxis, primaryTicksCount, zoomStateY } = args;
|
|
123
122
|
const [yMinPropsOrState, yMaxPropsOrState] = getMinMaxPropsOrState({
|