@gravity-ui/charts 1.6.6 → 1.6.7
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.
|
@@ -21,7 +21,8 @@ export function pieCenterText(text, options) {
|
|
|
21
21
|
if (padding < args.series.innerRadius) {
|
|
22
22
|
availableSpace -= padding * 2;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
const minFontSize = (_b = options === null || options === void 0 ? void 0 : options.minFontSize) !== null && _b !== void 0 ? _b : MIN_FONT_SIZE;
|
|
25
|
+
fontSize = Math.max(minFontSize, Math.ceil((fontSize * availableSpace) / Math.max(textSize.maxWidth, textSize.maxHeight)));
|
|
25
26
|
const tempWrapper = select(document.body).append('svg');
|
|
26
27
|
const container = tempWrapper.append('g');
|
|
27
28
|
const textSelection = container
|
|
@@ -34,7 +35,9 @@ export function pieCenterText(text, options) {
|
|
|
34
35
|
.attr('text-anchor', 'middle')
|
|
35
36
|
.attr('dominant-baseline', 'middle')
|
|
36
37
|
.text(text);
|
|
37
|
-
|
|
38
|
+
if (fontSize <= minFontSize) {
|
|
39
|
+
handleOverflowingText(tspan.node(), availableSpace);
|
|
40
|
+
}
|
|
38
41
|
const result = container.node();
|
|
39
42
|
tempWrapper.remove();
|
|
40
43
|
return result;
|
|
@@ -21,7 +21,8 @@ export function pieCenterText(text, options) {
|
|
|
21
21
|
if (padding < args.series.innerRadius) {
|
|
22
22
|
availableSpace -= padding * 2;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
const minFontSize = (_b = options === null || options === void 0 ? void 0 : options.minFontSize) !== null && _b !== void 0 ? _b : MIN_FONT_SIZE;
|
|
25
|
+
fontSize = Math.max(minFontSize, Math.ceil((fontSize * availableSpace) / Math.max(textSize.maxWidth, textSize.maxHeight)));
|
|
25
26
|
const tempWrapper = select(document.body).append('svg');
|
|
26
27
|
const container = tempWrapper.append('g');
|
|
27
28
|
const textSelection = container
|
|
@@ -34,7 +35,9 @@ export function pieCenterText(text, options) {
|
|
|
34
35
|
.attr('text-anchor', 'middle')
|
|
35
36
|
.attr('dominant-baseline', 'middle')
|
|
36
37
|
.text(text);
|
|
37
|
-
|
|
38
|
+
if (fontSize <= minFontSize) {
|
|
39
|
+
handleOverflowingText(tspan.node(), availableSpace);
|
|
40
|
+
}
|
|
38
41
|
const result = container.node();
|
|
39
42
|
tempWrapper.remove();
|
|
40
43
|
return result;
|