@gravity-ui/charts 1.20.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/AxisY/AxisY.js +8 -1
- package/dist/cjs/components/AxisY/prepare-axis-data.js +39 -12
- package/dist/cjs/components/AxisY/types.d.ts +3 -0
- package/dist/cjs/components/ChartInner/index.js +23 -8
- package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +24 -13
- package/dist/cjs/components/ChartInner/useChartInnerProps.js +41 -107
- package/dist/cjs/components/ChartInner/useChartInnerState.d.ts +4 -2
- package/dist/cjs/components/ChartInner/useChartInnerState.js +9 -0
- package/dist/cjs/components/ChartInner/utils.d.ts +12 -3
- package/dist/cjs/components/ChartInner/utils.js +61 -1
- package/dist/cjs/components/Title/index.d.ts +0 -1
- package/dist/cjs/components/Title/index.js +6 -4
- package/dist/cjs/hooks/index.d.ts +7 -3
- package/dist/cjs/hooks/index.js +7 -3
- package/dist/cjs/hooks/useAxis/index.d.ts +19 -0
- package/dist/cjs/hooks/useAxis/index.js +63 -0
- package/dist/cjs/hooks/useChartOptions/chart.js +6 -1
- package/dist/cjs/hooks/useChartOptions/index.d.ts +1 -4
- package/dist/cjs/hooks/useChartOptions/index.js +2 -5
- package/dist/cjs/hooks/useChartOptions/title.js +4 -2
- package/dist/cjs/hooks/useChartOptions/types.d.ts +0 -1
- package/dist/cjs/hooks/useChartOptions/utils.d.ts +1 -4
- package/dist/cjs/hooks/useChartOptions/utils.js +29 -6
- package/dist/cjs/hooks/useChartOptions/x-axis.js +2 -2
- package/dist/cjs/hooks/useChartOptions/y-axis.js +10 -11
- package/dist/cjs/hooks/useNormalizedOriginalData/index.d.ts +40 -0
- package/dist/cjs/hooks/useNormalizedOriginalData/index.js +33 -0
- package/dist/cjs/hooks/useSeries/index.d.ts +0 -9
- package/dist/cjs/hooks/useSeries/index.js +0 -18
- package/dist/cjs/hooks/useSeries/types.d.ts +3 -0
- package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +4 -0
- package/dist/cjs/hooks/useShapes/bar-y/prepare-data.js +4 -0
- package/dist/cjs/hooks/useShapes/scatter/prepare-data.d.ts +2 -2
- package/dist/cjs/hooks/useShapes/scatter/prepare-data.js +40 -5
- package/dist/cjs/types/chart/axis.d.ts +20 -2
- package/dist/cjs/types/chart/zoom.d.ts +29 -0
- package/dist/cjs/utils/chart/get-closest-data.js +1 -1
- package/dist/cjs/utils/chart/series/sorting.d.ts +2 -2
- package/dist/cjs/utils/chart/series/sorting.js +3 -3
- package/dist/cjs/utils/chart/text.js +24 -21
- package/dist/cjs/utils/chart/zoom.d.ts +7 -6
- package/dist/cjs/utils/chart/zoom.js +14 -6
- package/dist/esm/components/AxisY/AxisY.js +8 -1
- package/dist/esm/components/AxisY/prepare-axis-data.js +39 -12
- package/dist/esm/components/AxisY/types.d.ts +3 -0
- package/dist/esm/components/ChartInner/index.js +23 -8
- package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +23 -12
- package/dist/esm/components/ChartInner/useChartInnerProps.js +41 -107
- package/dist/esm/components/ChartInner/useChartInnerState.d.ts +4 -2
- package/dist/esm/components/ChartInner/useChartInnerState.js +9 -0
- package/dist/esm/components/ChartInner/utils.d.ts +12 -3
- package/dist/esm/components/ChartInner/utils.js +61 -1
- package/dist/esm/components/Title/index.d.ts +0 -1
- package/dist/esm/components/Title/index.js +6 -4
- package/dist/esm/hooks/index.d.ts +7 -3
- package/dist/esm/hooks/index.js +7 -3
- package/dist/esm/hooks/useAxis/index.d.ts +19 -0
- package/dist/esm/hooks/useAxis/index.js +63 -0
- package/dist/esm/hooks/useChartOptions/chart.js +6 -1
- package/dist/esm/hooks/useChartOptions/index.d.ts +1 -4
- package/dist/esm/hooks/useChartOptions/index.js +2 -5
- package/dist/esm/hooks/useChartOptions/title.js +4 -2
- package/dist/esm/hooks/useChartOptions/types.d.ts +0 -1
- package/dist/esm/hooks/useChartOptions/utils.d.ts +1 -4
- package/dist/esm/hooks/useChartOptions/utils.js +29 -6
- package/dist/esm/hooks/useChartOptions/x-axis.js +2 -2
- package/dist/esm/hooks/useChartOptions/y-axis.js +10 -11
- package/dist/esm/hooks/useNormalizedOriginalData/index.d.ts +40 -0
- package/dist/esm/hooks/useNormalizedOriginalData/index.js +33 -0
- package/dist/esm/hooks/useSeries/index.d.ts +0 -9
- package/dist/esm/hooks/useSeries/index.js +0 -18
- package/dist/esm/hooks/useSeries/types.d.ts +3 -0
- package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +4 -0
- package/dist/esm/hooks/useShapes/bar-y/prepare-data.js +4 -0
- package/dist/esm/hooks/useShapes/scatter/prepare-data.d.ts +2 -2
- package/dist/esm/hooks/useShapes/scatter/prepare-data.js +40 -5
- package/dist/esm/types/chart/axis.d.ts +20 -2
- package/dist/esm/types/chart/zoom.d.ts +29 -0
- package/dist/esm/utils/chart/get-closest-data.js +1 -1
- package/dist/esm/utils/chart/series/sorting.d.ts +2 -2
- package/dist/esm/utils/chart/series/sorting.js +3 -3
- package/dist/esm/utils/chart/text.js +24 -21
- package/dist/esm/utils/chart/zoom.d.ts +7 -6
- package/dist/esm/utils/chart/zoom.js +14 -6
- package/package.json +7 -16
- package/dist/cjs/components/Title/styles.css +0 -5
- package/dist/esm/components/Title/styles.css +0 -5
|
@@ -118,6 +118,10 @@ export const prepareBarXData = async (args) => {
|
|
|
118
118
|
let xCenter;
|
|
119
119
|
if (xAxis.type === 'category') {
|
|
120
120
|
const xBandScale = xScale;
|
|
121
|
+
const xBandScaleDomain = xBandScale.domain();
|
|
122
|
+
if (xBandScaleDomain.indexOf(xValue) === -1) {
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
121
125
|
xCenter = (xBandScale(xValue) || 0) + xBandScale.bandwidth() / 2;
|
|
122
126
|
}
|
|
123
127
|
else {
|
|
@@ -67,6 +67,10 @@ export async function prepareBarYData(args) {
|
|
|
67
67
|
let center;
|
|
68
68
|
if (yAxis[0].type === 'category') {
|
|
69
69
|
const bandScale = yScale;
|
|
70
|
+
const bandScaleDomain = bandScale.domain();
|
|
71
|
+
if (bandScaleDomain.indexOf(yValue) === -1) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
70
74
|
center = (bandScale(yValue) || 0) + bandSize / 2;
|
|
71
75
|
}
|
|
72
76
|
else {
|
|
@@ -2,11 +2,11 @@ import type { ChartScale } from '../../useAxisScales';
|
|
|
2
2
|
import type { PreparedAxis } from '../../useChartOptions/types';
|
|
3
3
|
import type { PreparedScatterSeries } from '../../useSeries/types';
|
|
4
4
|
import type { PreparedScatterData } from './types';
|
|
5
|
-
export declare
|
|
5
|
+
export declare function prepareScatterData(args: {
|
|
6
6
|
series: PreparedScatterSeries[];
|
|
7
7
|
xAxis: PreparedAxis;
|
|
8
8
|
xScale: ChartScale;
|
|
9
9
|
yAxis: PreparedAxis[];
|
|
10
10
|
yScale: (ChartScale | undefined)[];
|
|
11
11
|
isOutsideBounds: (x: number, y: number) => boolean;
|
|
12
|
-
})
|
|
12
|
+
}): PreparedScatterData[];
|
|
@@ -1,9 +1,38 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
|
+
import { getDataCategoryValue } from '../../../utils';
|
|
2
3
|
import { getXValue, getYValue } from '../utils';
|
|
3
|
-
|
|
4
|
+
function getFilteredLinearScatterData(data) {
|
|
4
5
|
return data.filter((d) => typeof d.x === 'number' && typeof d.y === 'number');
|
|
5
|
-
}
|
|
6
|
-
|
|
6
|
+
}
|
|
7
|
+
function getFilteredCategoryScatterData(args) {
|
|
8
|
+
const { data, xAxis, xScale, yAxis, yScale } = args;
|
|
9
|
+
const xDomain = xScale.domain();
|
|
10
|
+
const xCategories = get(xAxis, 'categories', []);
|
|
11
|
+
const yDomain = yScale.domain();
|
|
12
|
+
const yCategories = get(yAxis, 'categories', []);
|
|
13
|
+
return data.filter((d) => {
|
|
14
|
+
let xInRange = true;
|
|
15
|
+
let yInRange = true;
|
|
16
|
+
if (xAxis.type === 'category') {
|
|
17
|
+
const dataCategory = getDataCategoryValue({
|
|
18
|
+
axisDirection: 'x',
|
|
19
|
+
categories: xCategories,
|
|
20
|
+
data: d,
|
|
21
|
+
});
|
|
22
|
+
xInRange = xDomain.indexOf(dataCategory) !== -1;
|
|
23
|
+
}
|
|
24
|
+
if (yAxis.type === 'category') {
|
|
25
|
+
const dataCategory = getDataCategoryValue({
|
|
26
|
+
axisDirection: 'y',
|
|
27
|
+
categories: yCategories,
|
|
28
|
+
data: d,
|
|
29
|
+
});
|
|
30
|
+
yInRange = yDomain.indexOf(dataCategory) !== -1;
|
|
31
|
+
}
|
|
32
|
+
return xInRange && yInRange;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export function prepareScatterData(args) {
|
|
7
36
|
const { series, xAxis, xScale, yAxis, yScale, isOutsideBounds } = args;
|
|
8
37
|
return series.reduce((acc, s) => {
|
|
9
38
|
const yAxisIndex = get(s, 'yAxis', 0);
|
|
@@ -13,7 +42,13 @@ export const prepareScatterData = (args) => {
|
|
|
13
42
|
return acc;
|
|
14
43
|
}
|
|
15
44
|
const filteredData = xAxis.type === 'category' || seriesYAxis.type === 'category'
|
|
16
|
-
?
|
|
45
|
+
? getFilteredCategoryScatterData({
|
|
46
|
+
data: s.data,
|
|
47
|
+
xAxis,
|
|
48
|
+
xScale,
|
|
49
|
+
yAxis: seriesYAxis,
|
|
50
|
+
yScale: seriesYScale,
|
|
51
|
+
})
|
|
17
52
|
: getFilteredLinearScatterData(s.data);
|
|
18
53
|
filteredData.forEach((d) => {
|
|
19
54
|
var _a;
|
|
@@ -39,4 +74,4 @@ export const prepareScatterData = (args) => {
|
|
|
39
74
|
});
|
|
40
75
|
return acc;
|
|
41
76
|
}, []);
|
|
42
|
-
}
|
|
77
|
+
}
|
|
@@ -65,9 +65,27 @@ export interface ChartAxis {
|
|
|
65
65
|
*/
|
|
66
66
|
maxRowCount?: number;
|
|
67
67
|
};
|
|
68
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* The minimum value of the axis. If undefined the min value is automatically calculated.
|
|
70
|
+
*
|
|
71
|
+
* The value type depends on the axis scale:
|
|
72
|
+
* - For `linear` and `logarithmic` axes: numeric value
|
|
73
|
+
* - For `datetime` axes: timestamp (milliseconds since Unix epoch)
|
|
74
|
+
* - For `category` axes: index of the element in the categories array (which has been processed according to the specified `order` property)
|
|
75
|
+
*
|
|
76
|
+
* Note: min/max is not supported for category axes in waterfall and heatmap visualizations.
|
|
77
|
+
*/
|
|
69
78
|
min?: number;
|
|
70
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* The maximum value of the axis. If undefined the max value is automatically calculated.
|
|
81
|
+
*
|
|
82
|
+
* The value type depends on the axis scale:
|
|
83
|
+
* - For `linear` and `logarithmic` axes: numeric value
|
|
84
|
+
* - For `datetime` axes: timestamp (milliseconds since Unix epoch)
|
|
85
|
+
* - For `category` axes: index of the element in the categories array (which has been processed according to the specified `order` property)
|
|
86
|
+
*
|
|
87
|
+
* Note: min/max is not supported for category axes in waterfall and heatmap visualizations.
|
|
88
|
+
*/
|
|
71
89
|
max?: number;
|
|
72
90
|
/** The grid lines settings.
|
|
73
91
|
* Unavailable for some visualizations, such as a heatmap.
|
|
@@ -33,4 +33,33 @@ export interface ChartZoom {
|
|
|
33
33
|
fillOpacity?: number;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Reset zoom button configuration.
|
|
38
|
+
* The button appears only after the zoom has been applied.
|
|
39
|
+
*/
|
|
40
|
+
resetButton?: {
|
|
41
|
+
/**
|
|
42
|
+
* The alignment of the button.
|
|
43
|
+
*
|
|
44
|
+
* @default 'top-right'
|
|
45
|
+
*/
|
|
46
|
+
align?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
|
|
47
|
+
/**
|
|
48
|
+
* The offset of the button.
|
|
49
|
+
*
|
|
50
|
+
* @default {x: 0, y: 0}
|
|
51
|
+
*/
|
|
52
|
+
offset?: {
|
|
53
|
+
x?: number;
|
|
54
|
+
y?: number;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* The box to which the button is positioned relative to.
|
|
58
|
+
* - `chart-box` refers to the entire chart area, including titles and legends.
|
|
59
|
+
* - `plot-box` refers to the area where the series are drawn.
|
|
60
|
+
*
|
|
61
|
+
* @default 'chart-box'
|
|
62
|
+
*/
|
|
63
|
+
relativeTo?: 'chart-box' | 'plot-box';
|
|
64
|
+
};
|
|
36
65
|
}
|
|
@@ -105,7 +105,7 @@ export function getClosestPoints(args) {
|
|
|
105
105
|
case 'bar-y': {
|
|
106
106
|
const points = list;
|
|
107
107
|
const sorted = sort(points, (p) => p.y);
|
|
108
|
-
const closestYIndex = bisector((p) => p.y).center(sorted, pointerY);
|
|
108
|
+
const closestYIndex = bisector((p) => p.y + p.height / 2).center(sorted, pointerY);
|
|
109
109
|
const closestYPoint = sorted[closestYIndex];
|
|
110
110
|
let selectedPoints = [];
|
|
111
111
|
let closestPointXValue = -1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChartAxis, ChartSeries } from '../../../types';
|
|
2
|
-
export declare function getSortedSeriesData({ seriesData,
|
|
2
|
+
export declare function getSortedSeriesData({ seriesData, xAxis, yAxis, }: {
|
|
3
3
|
seriesData: ChartSeries[];
|
|
4
|
-
yAxes?: ChartAxis[];
|
|
5
4
|
xAxis?: ChartAxis;
|
|
5
|
+
yAxis?: ChartAxis[];
|
|
6
6
|
}): ChartSeries[];
|
|
@@ -20,11 +20,11 @@ function applyAxisCategoriesOrder({ series, axis, key, }) {
|
|
|
20
20
|
});
|
|
21
21
|
return Object.assign(Object.assign({}, series), { data: newSeriesData });
|
|
22
22
|
}
|
|
23
|
-
export function getSortedSeriesData({ seriesData,
|
|
23
|
+
export function getSortedSeriesData({ seriesData, xAxis, yAxis, }) {
|
|
24
24
|
return seriesData.map((s) => {
|
|
25
|
-
const
|
|
25
|
+
const yAxisItem = yAxis === null || yAxis === void 0 ? void 0 : yAxis[0];
|
|
26
26
|
let sortedSeries = s;
|
|
27
|
-
sortedSeries = applyAxisCategoriesOrder({ series: sortedSeries, axis:
|
|
27
|
+
sortedSeries = applyAxisCategoriesOrder({ series: sortedSeries, axis: yAxisItem, key: 'y' });
|
|
28
28
|
sortedSeries = applyAxisCategoriesOrder({ series: sortedSeries, axis: xAxis, key: 'x' });
|
|
29
29
|
switch (sortedSeries.type) {
|
|
30
30
|
case SeriesType.Area: {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { select } from 'd3-selection';
|
|
2
|
+
import { block } from '../cn';
|
|
3
|
+
const b = block('chart');
|
|
2
4
|
export function handleOverflowingText(tSpan, maxWidth, textWidth) {
|
|
3
5
|
var _a, _b, _c;
|
|
4
6
|
if (!tSpan) {
|
|
@@ -186,29 +188,30 @@ function unescapeHtml(str) {
|
|
|
186
188
|
return result.replace(value, key);
|
|
187
189
|
}, str);
|
|
188
190
|
}
|
|
191
|
+
function getCssStyle(prop, el = document.body) {
|
|
192
|
+
return window.getComputedStyle(el, null).getPropertyValue(prop);
|
|
193
|
+
}
|
|
194
|
+
let measureCanvas = null;
|
|
189
195
|
export function getTextSizeFn({ style }) {
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
var _a;
|
|
197
|
+
const canvas = measureCanvas || (measureCanvas = document.createElement('canvas'));
|
|
198
|
+
const context = canvas.getContext('2d');
|
|
199
|
+
if (!context) {
|
|
200
|
+
throw new Error("Couldn't get canvas context");
|
|
201
|
+
}
|
|
202
|
+
const element = (_a = document.getElementsByClassName(b())[0]) !== null && _a !== void 0 ? _a : document.body;
|
|
203
|
+
const defaultFontFamily = getCssStyle('font-family', element);
|
|
204
|
+
const defaultFontSize = getCssStyle('font-size', element);
|
|
205
|
+
const defaultFontWeight = getCssStyle('font-weight', element);
|
|
199
206
|
return async (str) => {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
width += map[s].width;
|
|
209
|
-
height = Math.max(height, map[s].height);
|
|
210
|
-
}
|
|
211
|
-
return { width, height };
|
|
207
|
+
var _a, _b;
|
|
208
|
+
await document.fonts.ready;
|
|
209
|
+
context.font = `${(_a = style === null || style === void 0 ? void 0 : style.fontWeight) !== null && _a !== void 0 ? _a : defaultFontWeight} ${(_b = style === null || style === void 0 ? void 0 : style.fontSize) !== null && _b !== void 0 ? _b : defaultFontSize} ${defaultFontFamily}`;
|
|
210
|
+
const textMetric = context.measureText(unescapeHtml(str));
|
|
211
|
+
return {
|
|
212
|
+
width: textMetric.width,
|
|
213
|
+
height: textMetric.fontBoundingBoxDescent + textMetric.fontBoundingBoxAscent,
|
|
214
|
+
};
|
|
212
215
|
};
|
|
213
216
|
}
|
|
214
217
|
// We ignore an inaccuracy of less than a pixel.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import type { PreparedAxis, PreparedSeries } from '../../hooks';
|
|
1
2
|
import type { ZoomState } from '../../hooks/useZoom/types';
|
|
2
|
-
import type {
|
|
3
|
+
import type { ChartXAxis, ChartYAxis } from '../../types';
|
|
3
4
|
export declare function getZoomedSeriesData(args: {
|
|
4
|
-
seriesData:
|
|
5
|
+
seriesData: PreparedSeries[];
|
|
5
6
|
zoomState: Partial<ZoomState>;
|
|
6
|
-
xAxis?: ChartXAxis;
|
|
7
|
-
|
|
7
|
+
xAxis?: ChartXAxis | PreparedAxis | null;
|
|
8
|
+
yAxis?: ChartYAxis[] | PreparedAxis[] | null;
|
|
8
9
|
}): {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
preparedSeries: PreparedSeries[];
|
|
11
|
+
preparedShapesSeries: PreparedSeries[];
|
|
11
12
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SeriesType } from '../../constants';
|
|
2
|
-
import { getAxisCategories } from '../../hooks/useChartOptions/utils';
|
|
3
2
|
const SERIES_TYPE_WITH_HIDDEN_POINTS = [SeriesType.Area, SeriesType.Line];
|
|
4
3
|
// eslint-disable-next-line complexity
|
|
5
4
|
function isValueInRange(args) {
|
|
@@ -21,7 +20,7 @@ function isValueInRange(args) {
|
|
|
21
20
|
return numValue >= numMin && numValue <= numMax;
|
|
22
21
|
}
|
|
23
22
|
case 'category': {
|
|
24
|
-
const categories =
|
|
23
|
+
const categories = (axis === null || axis === void 0 ? void 0 : axis.categories) || [];
|
|
25
24
|
if (typeof value === 'string' && typeof min === 'number' && typeof max === 'number') {
|
|
26
25
|
const valueIndex = categories.indexOf(value);
|
|
27
26
|
if (min === -1 || max === -1 || valueIndex === -1) {
|
|
@@ -42,10 +41,13 @@ function isValueInRange(args) {
|
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
}
|
|
44
|
+
function isPreparedZoomableSeries(series) {
|
|
45
|
+
return Array.isArray(series.data);
|
|
46
|
+
}
|
|
45
47
|
export function getZoomedSeriesData(args) {
|
|
46
|
-
const { seriesData, xAxis,
|
|
48
|
+
const { seriesData, xAxis, yAxis, zoomState } = args;
|
|
47
49
|
if (Object.keys(zoomState).length <= 0) {
|
|
48
|
-
return {
|
|
50
|
+
return { preparedSeries: seriesData, preparedShapesSeries: seriesData };
|
|
49
51
|
}
|
|
50
52
|
const zoomedSeriesData = [];
|
|
51
53
|
const zoomedShapesSeriesData = [];
|
|
@@ -56,6 +58,9 @@ export function getZoomedSeriesData(args) {
|
|
|
56
58
|
const filteredShapesData = SERIES_TYPE_WITH_HIDDEN_POINTS.includes(seriesItem.type) && (xAxis === null || xAxis === void 0 ? void 0 : xAxis.type) !== 'category'
|
|
57
59
|
? []
|
|
58
60
|
: undefined;
|
|
61
|
+
if (!isPreparedZoomableSeries(seriesItem)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
59
64
|
seriesItem.data.forEach((point, i) => {
|
|
60
65
|
const prevPoint = seriesItem.data[i - 1];
|
|
61
66
|
const isFirstPoint = i === 0;
|
|
@@ -81,7 +86,7 @@ export function getZoomedSeriesData(args) {
|
|
|
81
86
|
const [yMin, yMax] = zoomStateY;
|
|
82
87
|
const y = 'y' in point ? point.y : undefined;
|
|
83
88
|
inYRange = isValueInRange({
|
|
84
|
-
axis:
|
|
89
|
+
axis: yAxis === null || yAxis === void 0 ? void 0 : yAxis[yAxisIndex],
|
|
85
90
|
value: y,
|
|
86
91
|
min: yMin,
|
|
87
92
|
max: yMax,
|
|
@@ -111,5 +116,8 @@ export function getZoomedSeriesData(args) {
|
|
|
111
116
|
zoomedSeriesData.push(Object.assign(Object.assign({}, seriesItem), { data: filteredData }));
|
|
112
117
|
zoomedShapesSeriesData.push(Object.assign(Object.assign({}, seriesItem), { data: filteredShapesData || filteredData }));
|
|
113
118
|
});
|
|
114
|
-
return {
|
|
119
|
+
return {
|
|
120
|
+
preparedSeries: zoomedSeriesData,
|
|
121
|
+
preparedShapesSeries: zoomedShapesSeriesData,
|
|
122
|
+
};
|
|
115
123
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/charts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"description": "React component used to render charts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -83,22 +83,13 @@
|
|
|
83
83
|
"@gravity-ui/stylelint-config": "^4.0.1",
|
|
84
84
|
"@gravity-ui/tsconfig": "^1.0.0",
|
|
85
85
|
"@gravity-ui/uikit": "^7.4.0",
|
|
86
|
-
"@playwright/experimental-ct-react": "^1.
|
|
87
|
-
"@playwright/test": "^1.
|
|
88
|
-
"@storybook/addon-a11y": "^
|
|
89
|
-
"@storybook/addon-
|
|
90
|
-
"@storybook/addon-essentials": "^8.2.9",
|
|
91
|
-
"@storybook/addon-knobs": "^8.0.1",
|
|
92
|
-
"@storybook/addon-storysource": "^8.2.9",
|
|
93
|
-
"@storybook/addon-viewport": "^8.2.9",
|
|
86
|
+
"@playwright/experimental-ct-react": "^1.56.1",
|
|
87
|
+
"@playwright/test": "^1.56.1",
|
|
88
|
+
"@storybook/addon-a11y": "^9.1.16",
|
|
89
|
+
"@storybook/addon-docs": "^9.1.16",
|
|
94
90
|
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
|
|
95
|
-
"@storybook/blocks": "^8.2.9",
|
|
96
|
-
"@storybook/manager-api": "^8.2.9",
|
|
97
91
|
"@storybook/preset-scss": "^1.0.3",
|
|
98
|
-
"@storybook/react": "^
|
|
99
|
-
"@storybook/react-webpack5": "^8.2.9",
|
|
100
|
-
"@storybook/theming": "^8.2.9",
|
|
101
|
-
"@storybook/types": "^8.2.9",
|
|
92
|
+
"@storybook/react-webpack5": "^9.1.16",
|
|
102
93
|
"@testing-library/dom": "^10.1.0",
|
|
103
94
|
"@testing-library/jest-dom": "^6.4.6",
|
|
104
95
|
"@testing-library/react": "^16.0.0",
|
|
@@ -129,7 +120,7 @@
|
|
|
129
120
|
"react-dom": "^18.3.1",
|
|
130
121
|
"rimraf": "^5.0.7",
|
|
131
122
|
"sass": "^1.77.1",
|
|
132
|
-
"storybook": "^
|
|
123
|
+
"storybook": "^9.1.16",
|
|
133
124
|
"stylelint": "^15.11.0",
|
|
134
125
|
"stylelint-use-logical": "^2.1.2",
|
|
135
126
|
"ts-jest": "^29.2.5",
|