@gravity-ui/charts 1.43.0 → 1.43.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/ChartInner/index.js +3 -3
- package/dist/cjs/components/ChartInner/useChartInnerHandlers.d.ts +3 -3
- package/dist/cjs/components/ChartInner/useChartInnerHandlers.js +10 -12
- package/dist/cjs/components/ChartInner/useChartInnerProps.js +8 -4
- package/dist/cjs/components/ChartInner/utils/title.d.ts +3 -2
- package/dist/cjs/components/ChartInner/utils/title.js +19 -14
- package/dist/cjs/components/Title/index.d.ts +1 -3
- package/dist/cjs/components/Title/index.js +2 -2
- package/dist/cjs/core/constants/index.d.ts +0 -1
- package/dist/cjs/core/constants/index.js +0 -1
- package/dist/cjs/core/utils/labels.d.ts +1 -1
- package/dist/cjs/core/utils/labels.js +3 -2
- package/dist/cjs/hooks/useSeries/index.js +8 -2
- package/dist/cjs/hooks/useShapes/area/index.js +2 -2
- package/dist/cjs/hooks/useShapes/area/prepare-data.js +4 -4
- package/dist/cjs/hooks/useShapes/area/types.d.ts +2 -2
- package/dist/cjs/hooks/useShapes/bar-x/index.js +2 -2
- package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +15 -12
- package/dist/cjs/hooks/useShapes/bar-x/types.d.ts +2 -2
- package/dist/cjs/hooks/useShapes/index.js +18 -5
- package/dist/cjs/hooks/useShapes/line/index.js +7 -16
- package/dist/cjs/hooks/useShapes/line/prepare-data.d.ts +2 -0
- package/dist/cjs/hooks/useShapes/line/prepare-data.js +11 -7
- package/dist/cjs/hooks/useShapes/line/types.d.ts +2 -2
- package/dist/cjs/types/chart-ui.d.ts +4 -0
- package/dist/esm/components/ChartInner/index.js +3 -3
- package/dist/esm/components/ChartInner/useChartInnerHandlers.d.ts +3 -3
- package/dist/esm/components/ChartInner/useChartInnerHandlers.js +10 -12
- package/dist/esm/components/ChartInner/useChartInnerProps.js +8 -4
- package/dist/esm/components/ChartInner/utils/title.d.ts +3 -2
- package/dist/esm/components/ChartInner/utils/title.js +19 -14
- package/dist/esm/components/Title/index.d.ts +1 -3
- package/dist/esm/components/Title/index.js +2 -2
- package/dist/esm/core/constants/index.d.ts +0 -1
- package/dist/esm/core/constants/index.js +0 -1
- package/dist/esm/core/utils/labels.d.ts +1 -1
- package/dist/esm/core/utils/labels.js +3 -2
- package/dist/esm/hooks/useSeries/index.js +8 -2
- package/dist/esm/hooks/useShapes/area/index.js +2 -2
- package/dist/esm/hooks/useShapes/area/prepare-data.js +4 -4
- package/dist/esm/hooks/useShapes/area/types.d.ts +2 -2
- package/dist/esm/hooks/useShapes/bar-x/index.js +2 -2
- package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +15 -12
- package/dist/esm/hooks/useShapes/bar-x/types.d.ts +2 -2
- package/dist/esm/hooks/useShapes/index.js +18 -5
- package/dist/esm/hooks/useShapes/line/index.js +7 -16
- package/dist/esm/hooks/useShapes/line/prepare-data.d.ts +2 -0
- package/dist/esm/hooks/useShapes/line/prepare-data.js +11 -7
- package/dist/esm/hooks/useShapes/line/types.d.ts +2 -2
- package/dist/esm/types/chart-ui.d.ts +4 -0
- package/package.json +1 -1
- package/dist/cjs/core/constants/misc.d.ts +0 -1
- package/dist/cjs/core/constants/misc.js +0 -7
- package/dist/esm/core/constants/misc.d.ts +0 -1
- package/dist/esm/core/constants/misc.js +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getLabelsSize, getTextSizeFn } from '../../../core/utils';
|
|
1
|
+
import { filterOverlappingLabels, getLabelsSize, getTextSizeFn } from '../../../core/utils';
|
|
2
2
|
import { getFormattedValue } from '../../../core/utils/format';
|
|
3
3
|
import { getXValue, getYValue } from '../utils';
|
|
4
4
|
async function getHtmlLabel(point, series, xMax) {
|
|
@@ -16,7 +16,7 @@ async function getHtmlLabel(point, series, xMax) {
|
|
|
16
16
|
}
|
|
17
17
|
export const prepareLineData = async (args) => {
|
|
18
18
|
var _a, _b, _c, _d;
|
|
19
|
-
const { series, xAxis, yAxis, xScale, yScale, split, isOutsideBounds, isRangeSlider } = args;
|
|
19
|
+
const { series, xAxis, yAxis, xScale, yScale, split, isOutsideBounds, isRangeSlider, otherLayers, } = args;
|
|
20
20
|
const [_xMin, xRangeMax] = xScale.range();
|
|
21
21
|
const xMax = xRangeMax;
|
|
22
22
|
const acc = [];
|
|
@@ -44,8 +44,8 @@ export const prepareLineData = async (args) => {
|
|
|
44
44
|
series: s,
|
|
45
45
|
};
|
|
46
46
|
});
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
let htmlElements = [];
|
|
48
|
+
let svgLabels = [];
|
|
49
49
|
if (s.dataLabels.enabled && !isRangeSlider) {
|
|
50
50
|
if (s.dataLabels.html) {
|
|
51
51
|
const list = await Promise.all(points.reduce((result, p) => {
|
|
@@ -83,11 +83,15 @@ export const prepareLineData = async (args) => {
|
|
|
83
83
|
series: s,
|
|
84
84
|
active: true,
|
|
85
85
|
};
|
|
86
|
-
|
|
86
|
+
svgLabels.push(labelData);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
+
if (!s.dataLabels.allowOverlap) {
|
|
92
|
+
svgLabels = filterOverlappingLabels(svgLabels, otherLayers.map((l) => l.svgLabels).flat());
|
|
93
|
+
htmlElements = filterOverlappingLabels(htmlElements, otherLayers.map((l) => l.htmlLabels).flat());
|
|
94
|
+
}
|
|
91
95
|
let markers = [];
|
|
92
96
|
const hasPerPointNormalMarkers = s.data.some((d) => { var _a, _b, _c; return (_c = (_b = (_a = d.marker) === null || _a === void 0 ? void 0 : _a.states) === null || _b === void 0 ? void 0 : _b.normal) === null || _c === void 0 ? void 0 : _c.enabled; });
|
|
93
97
|
if (s.marker.states.normal.enabled || hasPerPointNormalMarkers) {
|
|
@@ -111,12 +115,12 @@ export const prepareLineData = async (args) => {
|
|
|
111
115
|
const result = {
|
|
112
116
|
points,
|
|
113
117
|
markers,
|
|
114
|
-
|
|
118
|
+
svgLabels: svgLabels,
|
|
115
119
|
series: s,
|
|
116
120
|
hovered: false,
|
|
117
121
|
active: true,
|
|
118
122
|
id: s.id,
|
|
119
|
-
htmlElements,
|
|
123
|
+
htmlLabels: htmlElements,
|
|
120
124
|
color: s.color,
|
|
121
125
|
lineWidth: (_c = (isRangeSlider ? s.rangeSlider.lineWidth : undefined)) !== null && _c !== void 0 ? _c : s.lineWidth,
|
|
122
126
|
dashStyle: s.dashStyle,
|
|
@@ -25,8 +25,8 @@ export type PreparedLineData = {
|
|
|
25
25
|
series: PreparedLineSeries;
|
|
26
26
|
hovered: boolean;
|
|
27
27
|
active: boolean;
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
svgLabels: LabelData[];
|
|
29
|
+
htmlLabels: HtmlItem[];
|
|
30
30
|
color: string;
|
|
31
31
|
dashStyle: DashStyle;
|
|
32
32
|
linecap: LineCap;
|
|
@@ -25,6 +25,10 @@ export interface HtmlItem {
|
|
|
25
25
|
};
|
|
26
26
|
style?: BaseTextStyle & React.CSSProperties;
|
|
27
27
|
}
|
|
28
|
+
export interface ShapeDataWithLabels {
|
|
29
|
+
svgLabels: LabelData[];
|
|
30
|
+
htmlLabels: HtmlItem[];
|
|
31
|
+
}
|
|
28
32
|
export interface ShapeDataWithHtmlItems {
|
|
29
33
|
htmlElements: HtmlItem[];
|
|
30
34
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const IS_TOUCH_ENABLED: boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const IS_TOUCH_ENABLED: boolean;
|