@gravity-ui/charts 1.41.0 → 1.41.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/AxisX.js +2 -1
- package/dist/cjs/components/AxisY/AxisY.js +2 -1
- package/dist/cjs/components/ChartInner/useChartInnerHandlers.d.ts +1 -1
- package/dist/cjs/components/ChartInner/useChartInnerHandlers.js +1 -1
- package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +1 -1
- package/dist/cjs/components/ChartInner/useChartInnerState.d.ts +1 -1
- package/dist/cjs/components/ChartInner/useDefaultState.d.ts +1 -1
- package/dist/cjs/components/Legend/index.js +3 -1
- package/dist/cjs/components/RangeSlider/utils.js +1 -1
- package/dist/cjs/components/Tooltip/index.d.ts +1 -1
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/utils/index.js +1 -1
- package/dist/cjs/hooks/useAxis/x-axis.js +5 -2
- package/dist/cjs/hooks/useAxisScales/types.d.ts +1 -1
- package/dist/cjs/hooks/useAxisScales/x-scale.js +2 -1
- package/dist/cjs/hooks/useAxisScales/y-scale.js +2 -1
- package/dist/cjs/hooks/useBrush/index.js +2 -1
- package/dist/cjs/hooks/useBrush/types.d.ts +1 -1
- package/dist/cjs/hooks/useBrush/utils.d.ts +1 -1
- package/dist/cjs/hooks/useBrush/utils.js +2 -1
- package/dist/cjs/hooks/useCrosshair/index.d.ts +1 -1
- package/dist/cjs/hooks/useCrosshair/index.js +2 -1
- package/dist/cjs/hooks/useCrosshair/useCrosshairHover.d.ts +1 -1
- package/dist/cjs/hooks/useRangeSlider/index.js +1 -1
- package/dist/cjs/hooks/useSeries/index.js +2 -1
- package/dist/cjs/hooks/useSeries/prepare-area.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-bar-x.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-bar-y.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-funnel.js +1 -1
- package/dist/cjs/hooks/useSeries/prepare-heatmap.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-line.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-pie.js +1 -1
- package/dist/cjs/hooks/useSeries/prepare-radar.js +1 -1
- package/dist/cjs/hooks/useSeries/prepare-sankey.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-scatter.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-treemap.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepare-waterfall.d.ts +1 -1
- package/dist/cjs/hooks/useSeries/prepareSeries.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/area/index.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/area/index.js +3 -1
- package/dist/cjs/hooks/useShapes/area/prepare-data.d.ts +0 -1
- package/dist/cjs/hooks/useShapes/area/prepare-data.js +61 -31
- package/dist/cjs/hooks/useShapes/bar-x/index.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/bar-x/index.js +2 -1
- package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +1 -1
- package/dist/cjs/hooks/useShapes/bar-y/index.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/bar-y/index.js +2 -1
- package/dist/cjs/hooks/useShapes/bar-y/prepare-data.js +1 -1
- package/dist/cjs/hooks/useShapes/funnel/index.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/funnel/index.js +2 -1
- package/dist/cjs/hooks/useShapes/funnel/prepare-data.js +1 -1
- package/dist/cjs/hooks/useShapes/funnel/types.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/heatmap/index.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/heatmap/index.js +2 -1
- package/dist/cjs/hooks/useShapes/index.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/index.js +1 -2
- package/dist/cjs/hooks/useShapes/line/index.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/line/index.js +3 -1
- package/dist/cjs/hooks/useShapes/marker.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/marker.js +1 -1
- package/dist/cjs/hooks/useShapes/pie/index.d.ts +2 -1
- package/dist/cjs/hooks/useShapes/pie/index.js +3 -1
- package/dist/cjs/hooks/useShapes/pie/prepare-data.js +2 -1
- package/dist/cjs/hooks/useShapes/pie/types.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/pie/utils.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/pie/utils.js +1 -1
- package/dist/cjs/hooks/useShapes/radar/index.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/radar/index.js +3 -1
- package/dist/cjs/hooks/useShapes/radar/prepare-data.js +3 -1
- package/dist/cjs/hooks/useShapes/sankey/index.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/sankey/index.js +1 -1
- package/dist/cjs/hooks/useShapes/scatter/index.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/scatter/index.js +1 -1
- package/dist/cjs/hooks/useShapes/treemap/index.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/treemap/index.js +2 -1
- package/dist/cjs/hooks/useShapes/treemap/prepare-data.js +2 -1
- package/dist/cjs/hooks/useShapes/treemap/types.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/utils.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/utils.js +2 -1
- package/dist/cjs/hooks/useShapes/waterfall/index.d.ts +1 -1
- package/dist/cjs/hooks/useShapes/waterfall/index.js +3 -1
- package/dist/cjs/hooks/useTooltip/index.d.ts +1 -1
- package/dist/cjs/hooks/useZoom/index.js +1 -1
- package/dist/cjs/hooks/useZoom/utils.d.ts +1 -1
- package/dist/cjs/hooks/utils/bar-y.js +1 -1
- package/dist/cjs/hooks/utils/get-band-size.d.ts +1 -1
- package/dist/cjs/types/chart/pie.d.ts +1 -1
- package/dist/cjs/utils/chart/axis/common.d.ts +2 -1
- package/dist/cjs/utils/chart/axis/common.js +1 -1
- package/dist/cjs/utils/chart/axis-generators/bottom.d.ts +2 -1
- package/dist/cjs/utils/chart/axis-generators/bottom.js +2 -1
- package/dist/cjs/utils/chart/color.js +2 -1
- package/dist/cjs/utils/chart/common.js +2 -1
- package/dist/cjs/utils/chart/format.d.ts +1 -1
- package/dist/cjs/utils/chart/get-closest-data.js +2 -1
- package/dist/cjs/utils/chart/legend.d.ts +1 -1
- package/dist/cjs/utils/chart/series/sorting.js +1 -1
- package/dist/cjs/utils/chart/symbol.js +1 -1
- package/dist/cjs/utils/chart/text.d.ts +1 -1
- package/dist/cjs/utils/chart/ticks/datetime.js +2 -1
- package/dist/cjs/utils/chart/ticks/index.d.ts +1 -1
- package/dist/cjs/utils/dispatcher.js +1 -1
- package/dist/esm/components/AxisX/AxisX.js +2 -1
- package/dist/esm/components/AxisY/AxisY.js +2 -1
- package/dist/esm/components/ChartInner/useChartInnerHandlers.d.ts +1 -1
- package/dist/esm/components/ChartInner/useChartInnerHandlers.js +1 -1
- package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +1 -1
- package/dist/esm/components/ChartInner/useChartInnerState.d.ts +1 -1
- package/dist/esm/components/ChartInner/useDefaultState.d.ts +1 -1
- package/dist/esm/components/Legend/index.js +3 -1
- package/dist/esm/components/RangeSlider/utils.js +1 -1
- package/dist/esm/components/Tooltip/index.d.ts +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/utils/index.js +1 -1
- package/dist/esm/hooks/useAxis/x-axis.js +5 -2
- package/dist/esm/hooks/useAxisScales/types.d.ts +1 -1
- package/dist/esm/hooks/useAxisScales/x-scale.js +2 -1
- package/dist/esm/hooks/useAxisScales/y-scale.js +2 -1
- package/dist/esm/hooks/useBrush/index.js +2 -1
- package/dist/esm/hooks/useBrush/types.d.ts +1 -1
- package/dist/esm/hooks/useBrush/utils.d.ts +1 -1
- package/dist/esm/hooks/useBrush/utils.js +2 -1
- package/dist/esm/hooks/useCrosshair/index.d.ts +1 -1
- package/dist/esm/hooks/useCrosshair/index.js +2 -1
- package/dist/esm/hooks/useCrosshair/useCrosshairHover.d.ts +1 -1
- package/dist/esm/hooks/useRangeSlider/index.js +1 -1
- package/dist/esm/hooks/useSeries/index.js +2 -1
- package/dist/esm/hooks/useSeries/prepare-area.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-bar-x.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-bar-y.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-funnel.js +1 -1
- package/dist/esm/hooks/useSeries/prepare-heatmap.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-line.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-pie.js +1 -1
- package/dist/esm/hooks/useSeries/prepare-radar.js +1 -1
- package/dist/esm/hooks/useSeries/prepare-sankey.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-scatter.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-treemap.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepare-waterfall.d.ts +1 -1
- package/dist/esm/hooks/useSeries/prepareSeries.d.ts +1 -1
- package/dist/esm/hooks/useShapes/area/index.d.ts +1 -1
- package/dist/esm/hooks/useShapes/area/index.js +3 -1
- package/dist/esm/hooks/useShapes/area/prepare-data.d.ts +0 -1
- package/dist/esm/hooks/useShapes/area/prepare-data.js +61 -31
- package/dist/esm/hooks/useShapes/bar-x/index.d.ts +1 -1
- package/dist/esm/hooks/useShapes/bar-x/index.js +2 -1
- package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +1 -1
- package/dist/esm/hooks/useShapes/bar-y/index.d.ts +1 -1
- package/dist/esm/hooks/useShapes/bar-y/index.js +2 -1
- package/dist/esm/hooks/useShapes/bar-y/prepare-data.js +1 -1
- package/dist/esm/hooks/useShapes/funnel/index.d.ts +1 -1
- package/dist/esm/hooks/useShapes/funnel/index.js +2 -1
- package/dist/esm/hooks/useShapes/funnel/prepare-data.js +1 -1
- package/dist/esm/hooks/useShapes/funnel/types.d.ts +1 -1
- package/dist/esm/hooks/useShapes/heatmap/index.d.ts +1 -1
- package/dist/esm/hooks/useShapes/heatmap/index.js +2 -1
- package/dist/esm/hooks/useShapes/index.d.ts +1 -1
- package/dist/esm/hooks/useShapes/index.js +1 -2
- package/dist/esm/hooks/useShapes/line/index.d.ts +1 -1
- package/dist/esm/hooks/useShapes/line/index.js +3 -1
- package/dist/esm/hooks/useShapes/marker.d.ts +1 -1
- package/dist/esm/hooks/useShapes/marker.js +1 -1
- package/dist/esm/hooks/useShapes/pie/index.d.ts +2 -1
- package/dist/esm/hooks/useShapes/pie/index.js +3 -1
- package/dist/esm/hooks/useShapes/pie/prepare-data.js +2 -1
- package/dist/esm/hooks/useShapes/pie/types.d.ts +1 -1
- package/dist/esm/hooks/useShapes/pie/utils.d.ts +1 -1
- package/dist/esm/hooks/useShapes/pie/utils.js +1 -1
- package/dist/esm/hooks/useShapes/radar/index.d.ts +1 -1
- package/dist/esm/hooks/useShapes/radar/index.js +3 -1
- package/dist/esm/hooks/useShapes/radar/prepare-data.js +3 -1
- package/dist/esm/hooks/useShapes/sankey/index.d.ts +1 -1
- package/dist/esm/hooks/useShapes/sankey/index.js +1 -1
- package/dist/esm/hooks/useShapes/scatter/index.d.ts +1 -1
- package/dist/esm/hooks/useShapes/scatter/index.js +1 -1
- package/dist/esm/hooks/useShapes/treemap/index.d.ts +1 -1
- package/dist/esm/hooks/useShapes/treemap/index.js +2 -1
- package/dist/esm/hooks/useShapes/treemap/prepare-data.js +2 -1
- package/dist/esm/hooks/useShapes/treemap/types.d.ts +1 -1
- package/dist/esm/hooks/useShapes/utils.d.ts +1 -1
- package/dist/esm/hooks/useShapes/utils.js +2 -1
- package/dist/esm/hooks/useShapes/waterfall/index.d.ts +1 -1
- package/dist/esm/hooks/useShapes/waterfall/index.js +3 -1
- package/dist/esm/hooks/useTooltip/index.d.ts +1 -1
- package/dist/esm/hooks/useZoom/index.js +1 -1
- package/dist/esm/hooks/useZoom/utils.d.ts +1 -1
- package/dist/esm/hooks/utils/bar-y.js +1 -1
- package/dist/esm/hooks/utils/get-band-size.d.ts +1 -1
- package/dist/esm/types/chart/pie.d.ts +1 -1
- package/dist/esm/utils/chart/axis/common.d.ts +2 -1
- package/dist/esm/utils/chart/axis/common.js +1 -1
- package/dist/esm/utils/chart/axis-generators/bottom.d.ts +2 -1
- package/dist/esm/utils/chart/axis-generators/bottom.js +2 -1
- package/dist/esm/utils/chart/color.js +2 -1
- package/dist/esm/utils/chart/common.js +2 -1
- package/dist/esm/utils/chart/format.d.ts +1 -1
- package/dist/esm/utils/chart/get-closest-data.js +2 -1
- package/dist/esm/utils/chart/legend.d.ts +1 -1
- package/dist/esm/utils/chart/series/sorting.js +1 -1
- package/dist/esm/utils/chart/symbol.js +1 -1
- package/dist/esm/utils/chart/text.d.ts +1 -1
- package/dist/esm/utils/chart/ticks/datetime.js +2 -1
- package/dist/esm/utils/chart/ticks/index.d.ts +1 -1
- package/dist/esm/utils/dispatcher.js +1 -1
- package/package.json +14 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ScaleOrdinal } from 'd3';
|
|
1
|
+
import type { ScaleOrdinal } from 'd3-scale';
|
|
2
2
|
import type { ChartSeriesOptions, LineSeries } from '../../types';
|
|
3
3
|
import type { PreparedLegend, PreparedLineSeries } from './types';
|
|
4
4
|
export declare const DEFAULT_LEGEND_SYMBOL_SIZE = 16;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { color } from 'd3-color';
|
|
3
|
+
import { select } from 'd3-selection';
|
|
4
|
+
import { area as areaGenerator, line as lineGenerator } from 'd3-shape';
|
|
3
5
|
import get from 'lodash/get';
|
|
4
6
|
import { block, filterOverlappingLabels } from '../../../utils';
|
|
5
7
|
import { HtmlLayer } from '../HtmlLayer';
|
|
@@ -9,7 +9,6 @@ export declare const prepareAreaData: (args: {
|
|
|
9
9
|
xScale: ChartScale;
|
|
10
10
|
yAxis: PreparedYAxis[];
|
|
11
11
|
yScale: (ChartScale | undefined)[];
|
|
12
|
-
boundsHeight: number;
|
|
13
12
|
split: PreparedSplit;
|
|
14
13
|
isOutsideBounds: (x: number, y: number) => boolean;
|
|
15
14
|
isRangeSlider?: boolean;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { group } from 'd3';
|
|
1
|
+
import { group } from 'd3-array';
|
|
2
|
+
import isNil from 'lodash/isNil';
|
|
3
|
+
import round from 'lodash/round';
|
|
2
4
|
import { getDataCategoryValue, getLabelsSize, getTextSizeFn } from '../../../utils';
|
|
3
5
|
import { getFormattedValue } from '../../../utils/chart/format';
|
|
4
6
|
import { getXValue, getYValue } from '../utils';
|
|
@@ -75,7 +77,7 @@ async function prepareDataLabels({ series, points, xMax, yAxisTop, isOutsideBoun
|
|
|
75
77
|
}
|
|
76
78
|
export const prepareAreaData = async (args) => {
|
|
77
79
|
var _a, _b, _c;
|
|
78
|
-
const { series, xAxis, xScale, yAxis, yScale,
|
|
80
|
+
const { series, xAxis, xScale, yAxis, yScale, split, isOutsideBounds, isRangeSlider } = args;
|
|
79
81
|
const [_xMin, xRangeMax] = xScale.range();
|
|
80
82
|
const xMax = xRangeMax;
|
|
81
83
|
const result = [];
|
|
@@ -92,6 +94,38 @@ export const prepareAreaData = async (args) => {
|
|
|
92
94
|
for (let i = 0; i < list.length; i++) {
|
|
93
95
|
const [_stackId, seriesStack] = list[i];
|
|
94
96
|
const xValues = getXValues(seriesStack, xAxis, xScale);
|
|
97
|
+
const isPercentStacking = seriesStack.some((s) => s.stacking === 'percent');
|
|
98
|
+
const stackValues = Object.fromEntries(xValues.map(([key]) => [key, 0]));
|
|
99
|
+
const ratio = Object.fromEntries(xValues.map(([key]) => [key, 1]));
|
|
100
|
+
if (isPercentStacking) {
|
|
101
|
+
seriesStack.forEach((s) => {
|
|
102
|
+
const yAxisIndex = s.yAxis;
|
|
103
|
+
const seriesYScale = yScale[yAxisIndex];
|
|
104
|
+
if (!seriesYScale) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
s.data.forEach((d, index) => {
|
|
108
|
+
var _a, _b, _c;
|
|
109
|
+
const yDataValue = (_a = d.y) !== null && _a !== void 0 ? _a : null;
|
|
110
|
+
if (yDataValue &&
|
|
111
|
+
!(isNil((_b = s.data[index - 1]) === null || _b === void 0 ? void 0 : _b.y) && isNil((_c = s.data[index + 1]) === null || _c === void 0 ? void 0 : _c.y))) {
|
|
112
|
+
const x = String(xAxis.type === 'category'
|
|
113
|
+
? getDataCategoryValue({
|
|
114
|
+
axisDirection: 'x',
|
|
115
|
+
categories: xAxis.categories || [],
|
|
116
|
+
data: d,
|
|
117
|
+
})
|
|
118
|
+
: d.x);
|
|
119
|
+
stackValues[x] += Number(yDataValue);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
xValues.forEach(([x]) => {
|
|
124
|
+
if (stackValues[x]) {
|
|
125
|
+
ratio[x] = 100 / stackValues[x];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
95
129
|
const positiveStackValues = new Map();
|
|
96
130
|
const negativeStackValues = new Map();
|
|
97
131
|
xValues.forEach(([key]) => {
|
|
@@ -132,12 +166,22 @@ export const prepareAreaData = async (args) => {
|
|
|
132
166
|
x,
|
|
133
167
|
y: 0,
|
|
134
168
|
};
|
|
135
|
-
|
|
169
|
+
let yDataValue = (_b = d.y) !== null && _b !== void 0 ? _b : null;
|
|
136
170
|
if (s.nullMode === 'connect' && yDataValue === null) {
|
|
137
171
|
return pointsAcc;
|
|
138
172
|
}
|
|
139
|
-
|
|
173
|
+
if (yDataValue && isPercentStacking) {
|
|
174
|
+
yDataValue = Number(yDataValue) * ratio[x];
|
|
175
|
+
}
|
|
176
|
+
let yValue = getYValue({
|
|
177
|
+
point: {
|
|
178
|
+
y: yDataValue,
|
|
179
|
+
},
|
|
180
|
+
yAxis: seriesYAxis,
|
|
181
|
+
yScale: seriesYScale,
|
|
182
|
+
});
|
|
140
183
|
if (typeof yDataValue === 'number' && yValue !== null) {
|
|
184
|
+
yValue = round(yValue, 2);
|
|
141
185
|
const prevPoint = seriesData.get((_c = xValues[index - 1]) === null || _c === void 0 ? void 0 : _c[0]);
|
|
142
186
|
const nextPoint = seriesData.get((_d = xValues[index + 1]) === null || _d === void 0 ? void 0 : _d[0]);
|
|
143
187
|
const currentPointStackHeight = Math.abs(yMin - yValue);
|
|
@@ -145,21 +189,30 @@ export const prepareAreaData = async (args) => {
|
|
|
145
189
|
const positiveStackHeights = positiveStackValues.get(x);
|
|
146
190
|
let prevSectionStackHeight = (_e = positiveStackHeights === null || positiveStackHeights === void 0 ? void 0 : positiveStackHeights.prev) !== null && _e !== void 0 ? _e : 0;
|
|
147
191
|
let nextSectionStackHeight = (_f = positiveStackHeights === null || positiveStackHeights === void 0 ? void 0 : positiveStackHeights.next) !== null && _f !== void 0 ? _f : 0;
|
|
148
|
-
|
|
192
|
+
const point = {
|
|
149
193
|
y0: yAxisTop + yMin - prevSectionStackHeight,
|
|
150
194
|
x: xValue,
|
|
151
195
|
y: yAxisTop + yValue - prevSectionStackHeight,
|
|
152
196
|
data: d,
|
|
153
197
|
series: s,
|
|
154
|
-
}
|
|
198
|
+
};
|
|
199
|
+
pointsAcc.push(point);
|
|
155
200
|
if (prevSectionStackHeight !== nextSectionStackHeight) {
|
|
156
|
-
|
|
201
|
+
const point2 = {
|
|
157
202
|
y0: yAxisTop + yMin - nextSectionStackHeight,
|
|
158
203
|
x: xValue,
|
|
159
204
|
y: yAxisTop + yValue - nextSectionStackHeight,
|
|
160
205
|
data: d,
|
|
161
206
|
series: s,
|
|
162
|
-
}
|
|
207
|
+
};
|
|
208
|
+
pointsAcc.push(point2);
|
|
209
|
+
if (isPercentStacking) {
|
|
210
|
+
const newYValue = yAxisTop +
|
|
211
|
+
yValue -
|
|
212
|
+
Math.max(prevSectionStackHeight, nextSectionStackHeight);
|
|
213
|
+
point.y = newYValue;
|
|
214
|
+
point2.y = newYValue;
|
|
215
|
+
}
|
|
163
216
|
}
|
|
164
217
|
if ((prevPoint === null || prevPoint === void 0 ? void 0 : prevPoint.y) !== null) {
|
|
165
218
|
prevSectionStackHeight =
|
|
@@ -253,29 +306,6 @@ export const prepareAreaData = async (args) => {
|
|
|
253
306
|
htmlElements: [],
|
|
254
307
|
});
|
|
255
308
|
}
|
|
256
|
-
if (seriesStack.some((s) => s.stacking === 'percent')) {
|
|
257
|
-
xValues.forEach(([x], index) => {
|
|
258
|
-
var _a;
|
|
259
|
-
const stackHeight = ((_a = positiveStackValues.get(x)) === null || _a === void 0 ? void 0 : _a.prev) || 0;
|
|
260
|
-
let acc = 0;
|
|
261
|
-
const ratio = plotHeight / stackHeight;
|
|
262
|
-
seriesStackData.forEach((item) => {
|
|
263
|
-
const point = item.points[index];
|
|
264
|
-
if (point.y !== null && point.y !== undefined) {
|
|
265
|
-
const height = (point.y0 - point.y) * ratio;
|
|
266
|
-
const nextAcc = acc + height;
|
|
267
|
-
point.y0 = plotHeight - acc;
|
|
268
|
-
point.y = plotHeight - nextAcc;
|
|
269
|
-
acc = nextAcc;
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
seriesStackData.forEach((item) => {
|
|
274
|
-
item.markers.forEach((marker) => {
|
|
275
|
-
marker.clipped = isOutsideBounds(marker.point.x, marker.point.y);
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
309
|
for (let itemIndex = 0; itemIndex < seriesStackData.length; itemIndex++) {
|
|
280
310
|
const item = seriesStackData[itemIndex];
|
|
281
311
|
const currentYAxis = yAxis[item.series.yAxis];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Dispatch } from 'd3';
|
|
2
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
3
3
|
import type { PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
4
|
import type { PreparedBarXData } from './types';
|
|
5
5
|
export { prepareBarXData } from './prepare-data';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { color
|
|
2
|
+
import { color } from 'd3-color';
|
|
3
|
+
import { select } from 'd3-selection';
|
|
3
4
|
import get from 'lodash/get';
|
|
4
5
|
import { block, filterOverlappingLabels } from '../../../utils';
|
|
5
6
|
import { HtmlLayer } from '../HtmlLayer';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ascending, descending, max, reverse, sort } from 'd3';
|
|
1
|
+
import { ascending, descending, max, reverse, sort } from 'd3-array';
|
|
2
2
|
import get from 'lodash/get';
|
|
3
3
|
import { getDataCategoryValue, getLabelsSize } from '../../../utils';
|
|
4
4
|
import { getFormattedValue } from '../../../utils/chart/format';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Dispatch } from 'd3';
|
|
2
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
3
3
|
import type { PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
4
|
import type { BarYShapesArgs } from './types';
|
|
5
5
|
export { prepareBarYData } from './prepare-data';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ascending, descending, sort } from 'd3';
|
|
1
|
+
import { ascending, descending, sort } from 'd3-array';
|
|
2
2
|
import get from 'lodash/get';
|
|
3
3
|
import { filterOverlappingLabels, getHtmlLabelConstraintedPosition, getLabelsSize, getSvgLabelConstraintedPosition, getTextSizeFn, } from '../../../utils';
|
|
4
4
|
import { getFormattedValue } from '../../../utils/chart/format';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Dispatch } from 'd3';
|
|
2
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
3
3
|
import type { PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
4
|
import type { PreparedFunnelData } from './types';
|
|
5
5
|
export { prepareFunnelData } from './prepare-data';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { color
|
|
2
|
+
import { color } from 'd3-color';
|
|
3
|
+
import { select } from 'd3-selection';
|
|
3
4
|
import { block, getLineDashArray } from '../../../utils';
|
|
4
5
|
export { prepareFunnelData } from './prepare-data';
|
|
5
6
|
export * from './types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Dispatch } from 'd3';
|
|
2
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
3
3
|
import type { PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
4
|
import type { PreparedHeatmapData } from './types';
|
|
5
5
|
export { prepareHeatmapData } from './prepare-data';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { color
|
|
2
|
+
import { color } from 'd3-color';
|
|
3
|
+
import { select } from 'd3-selection';
|
|
3
4
|
import { block } from '../../../utils';
|
|
4
5
|
import { HtmlLayer } from '../HtmlLayer';
|
|
5
6
|
export { prepareHeatmapData } from './prepare-data';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Dispatch } from 'd3';
|
|
2
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
3
3
|
import type { SeriesType } from '../../constants';
|
|
4
4
|
import type { PreparedXAxis, PreparedYAxis } from '../useAxis/types';
|
|
5
5
|
import type { ChartScale } from '../useAxisScales/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { group } from 'd3';
|
|
2
|
+
import { group } from 'd3-array';
|
|
3
3
|
import { SERIES_TYPE } from '../../constants';
|
|
4
4
|
import { ChartError } from '../../libs';
|
|
5
5
|
import { getOnlyVisibleSeries } from '../../utils';
|
|
@@ -119,7 +119,6 @@ export async function getShapes(args) {
|
|
|
119
119
|
xScale,
|
|
120
120
|
yAxis,
|
|
121
121
|
yScale,
|
|
122
|
-
boundsHeight,
|
|
123
122
|
split,
|
|
124
123
|
isOutsideBounds,
|
|
125
124
|
isRangeSlider,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { color
|
|
2
|
+
import { color } from 'd3-color';
|
|
3
|
+
import { select } from 'd3-selection';
|
|
4
|
+
import { line as lineGenerator } from 'd3-shape';
|
|
3
5
|
import get from 'lodash/get';
|
|
4
6
|
import { block, filterOverlappingLabels, getLineDashArray } from '../../../utils';
|
|
5
7
|
import { HtmlLayer } from '../HtmlLayer';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseType, Selection } from 'd3';
|
|
1
|
+
import type { BaseType, Selection } from 'd3-selection';
|
|
2
2
|
import { SymbolType } from '../../constants';
|
|
3
3
|
import type { MarkerData as AreaMarkerData } from './area/types';
|
|
4
4
|
import type { MarkerData as LineMarkerData } from './line/types';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Dispatch
|
|
2
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
3
|
+
import type { PieArcDatum } from 'd3-shape';
|
|
3
4
|
import type { PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
5
|
import type { PreparedPieData, SegmentData } from './types';
|
|
5
6
|
type PreparePieSeriesArgs = {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { color } from 'd3-color';
|
|
3
|
+
import { select } from 'd3-selection';
|
|
4
|
+
import { arc } from 'd3-shape';
|
|
3
5
|
import get from 'lodash/get';
|
|
4
6
|
import { block, setEllipsisForOverflowTexts } from '../../../utils';
|
|
5
7
|
import { HtmlLayer } from '../HtmlLayer';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { group, max } from 'd3-array';
|
|
2
|
+
import { arc, line as lineGenerator } from 'd3-shape';
|
|
2
3
|
import merge from 'lodash/merge';
|
|
3
4
|
import { DEFAULT_DATALABELS_STYLE } from '../../../constants';
|
|
4
5
|
import { calculateNumericProperty, getLabelsSize, getLeftPosition, getTextSizeFn, isLabelsOverlapping, } from '../../../utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CurveFactory } from 'd3';
|
|
1
|
+
import type { CurveFactory } from 'd3-shape';
|
|
2
2
|
import type { PointPosition } from '../../../types';
|
|
3
3
|
import type { PreparedPieData, SegmentData } from './types';
|
|
4
4
|
export declare const pieGenerator: import("d3-shape").Pie<any, SegmentData>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { color
|
|
2
|
+
import { color } from 'd3-color';
|
|
3
|
+
import { select } from 'd3-selection';
|
|
4
|
+
import { line } from 'd3-shape';
|
|
3
5
|
import get from 'lodash/get';
|
|
4
6
|
import { block } from '../../../utils';
|
|
5
7
|
import { HtmlLayer } from '../HtmlLayer';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { range } from 'd3-array';
|
|
2
|
+
import { scaleLinear } from 'd3-scale';
|
|
3
|
+
import { curveLinearClosed, line } from 'd3-shape';
|
|
2
4
|
import { getLabelsSize } from '../../../utils';
|
|
3
5
|
import { getFormattedValue } from '../../../utils/chart/format';
|
|
4
6
|
export async function prepareRadarData(args) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Dispatch } from 'd3';
|
|
2
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
3
3
|
import type { PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
4
|
import type { PreparedScatterData } from './types';
|
|
5
5
|
export { prepareScatterData } from './prepare-data';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ascending, descending, sort
|
|
1
|
+
import { ascending, descending, sort } from 'd3-array';
|
|
2
|
+
import { stratify, treemap, treemapBinary, treemapDice, treemapSlice, treemapSliceDice, treemapSquarify, } from 'd3-hierarchy';
|
|
2
3
|
import { LayoutAlgorithm } from '../../../constants';
|
|
3
4
|
import { getLabelsSize, getTextSizeFn, getTextWithElipsis } from '../../../utils';
|
|
4
5
|
import { getFormattedValue } from '../../../utils/chart/format';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HierarchyRectangularNode } from 'd3';
|
|
1
|
+
import type { HierarchyRectangularNode } from 'd3-hierarchy';
|
|
2
2
|
import type { HtmlItem, TreemapSeriesData } from '../../../types';
|
|
3
3
|
import type { PreparedTreemapSeries } from '../../useSeries/types';
|
|
4
4
|
export type TreemapLabelData = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseType } from 'd3';
|
|
1
|
+
import type { BaseType } from 'd3-selection';
|
|
2
2
|
import type { BasicInactiveState } from '../../types';
|
|
3
3
|
import type { PreparedXAxis, PreparedYAxis } from '../useAxis/types';
|
|
4
4
|
import type { ChartScale } from '../useAxisScales/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Dispatch } from 'd3';
|
|
2
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
3
3
|
import type { PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
4
|
import type { PreparedWaterfallData } from './types';
|
|
5
5
|
export { prepareWaterfallData } from './prepare-data';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { color
|
|
2
|
+
import { color } from 'd3-color';
|
|
3
|
+
import { select } from 'd3-selection';
|
|
4
|
+
import { line as lineGenerator } from 'd3-shape';
|
|
3
5
|
import get from 'lodash/get';
|
|
4
6
|
import { DASH_STYLE } from '../../../constants';
|
|
5
7
|
import { block, filterOverlappingLabels, getLineDashArray, getWaterfallPointColor, } from '../../../utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Dispatch } from 'd3';
|
|
1
|
+
import type { Dispatch } from 'd3-dispatch';
|
|
2
2
|
import type { AxisPlotBand, AxisPlotLine, PointPosition, TooltipDataChunk } from '../../types';
|
|
3
3
|
import type { PreparedTooltip } from '../types';
|
|
4
4
|
import type { PreparedXAxis, PreparedYAxis } from '../useAxis/types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BrushSelection } from 'd3';
|
|
1
|
+
import type { BrushSelection } from 'd3-brush';
|
|
2
2
|
import type { ZoomType } from '../../constants';
|
|
3
3
|
import type { PreparedXAxis, PreparedYAxis } from '../useAxis/types';
|
|
4
4
|
import type { ChartScale } from '../useAxisScales/types';
|