@easyv/charts 1.9.28 → 1.10.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.
@@ -34,8 +34,8 @@ var getCanvasContext = function getCanvasContext() {
34
34
  return canvasContext;
35
35
  };
36
36
 
37
- //计算文本宽度的函数
38
- var calculateTextWidth = exports.calculateTextWidth = function calculateTextWidth(text, fontConfig) {
37
+ //计算文本宽度/高度的函数
38
+ var calculateTextWidth = exports.calculateTextWidth = function calculateTextWidth(text, fontConfig, isVertical) {
39
39
  if (!text) return 0;
40
40
  var ctx = getCanvasContext();
41
41
  ctx.save();
@@ -47,16 +47,19 @@ var calculateTextWidth = exports.calculateTextWidth = function calculateTextWidt
47
47
  var letterSpacingWithUnit = "".concat(letterSpacing, "px");
48
48
  ctx.font = "".concat(fontWeight, " ").concat(fontStyle, " ").concat(fontSize, " ").concat(fontFamily);
49
49
  ctx.letterSpacing = letterSpacingWithUnit;
50
- var totalWidth;
50
+ var totalWidth = 0;
51
+ var totalHeight = 0;
52
+ var textMetrics = ctx.measureText(text);
51
53
  if (typeof ctx.letterSpacing !== "undefined") {
52
- totalWidth = ctx.measureText(text).width;
54
+ totalWidth = textMetrics.width;
53
55
  } else {
54
- var baseWidth = ctx.measureText(text).width;
55
- var spacingWidth = text.length * letterSpacing;
56
+ var baseWidth = textMetrics.width;
57
+ var spacingWidth = (text.length - 1) * letterSpacing;
56
58
  totalWidth = baseWidth + spacingWidth;
57
59
  }
60
+ totalHeight = textMetrics.fontBoundingBoxAscent + textMetrics.fontBoundingBoxDescent;
58
61
  ctx.restore();
59
- return totalWidth;
62
+ return isVertical ? totalHeight : totalWidth;
60
63
  };
61
64
  var defaultEvent = function defaultEvent() {};
62
65
  var defaultAppearance = {
@@ -190,7 +193,7 @@ var Unit = function Unit(_ref4) {
190
193
  textAnchor: textAnchor
191
194
  }, dataUnit || text);
192
195
  };
193
- function maxLabelFT(data, config, formatter, font) {
196
+ function maxLabelFT(data, config, formatter, font, isVertical) {
194
197
  var max = 0;
195
198
  data.length ? data.forEach(function (item) {
196
199
  if (calculateTextWidth(formatter(item, _objectSpread(_objectSpread({}, config), {}, {
@@ -198,12 +201,12 @@ function maxLabelFT(data, config, formatter, font) {
198
201
  type: config.format,
199
202
  showType: config.showType
200
203
  }
201
- })), font) > max) max = calculateTextWidth(formatter(item, _objectSpread(_objectSpread({}, config), {}, {
204
+ })), font, isVertical) > max) max = calculateTextWidth(formatter(item, _objectSpread(_objectSpread({}, config), {}, {
202
205
  format: {
203
206
  type: config.format,
204
207
  showType: config.showType
205
208
  }
206
- })), font);
209
+ })), font, isVertical);
207
210
  }) : "";
208
211
  return max;
209
212
  }
@@ -341,6 +344,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(
341
344
  var cHeight = controlInfo.cHeight,
342
345
  isC = controlInfo.isC,
343
346
  cPercent = controlInfo.cPercent;
347
+ var isVertical = orientation == "left" || orientation == "right";
344
348
  var x = orientation == "right" ? width : 0;
345
349
  var y = orientation == "bottom" ? height - cHeight : 0;
346
350
  var LabelWidth = 1;
@@ -348,10 +352,10 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(/*#__PURE__*/(
348
352
  LabelWidth = label.appearance.width;
349
353
  } else {
350
354
  if (allTicks.length && typeof allTicks[0] == "string") {
351
- LabelWidth = maxLabelFT(allTicks, label, formatter, label.font);
355
+ LabelWidth = maxLabelFT(allTicks, label, formatter, label.font, isVertical);
352
356
  }
353
357
  }
354
- var LabelNum = Math.floor(width / (isC ? cPercent : 1) * (1 - paddingOuter) / LabelWidth);
358
+ var LabelNum = !isVertical ? Math.floor(width / (isC ? cPercent : 1) * (1 - paddingOuter) / LabelWidth) : Math.floor(height / LabelWidth);
355
359
  var ticks = !label.adaptive ? tickss : getEvenlySpacedElements(allTicks, LabelNum < allTicks.length ? LabelNum > allTicks.length / 2 ? Math.ceil(allTicks.length / 2) : LabelNum : allTicks.length, label.showLast);
356
360
  if (!(on && ticks.length > 0)) return null;
357
361
 
@@ -33,6 +33,8 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
33
33
  _ref$config$tip$data$2 = _ref$config$tip$data.data,
34
34
  lineHeight = _ref$config$tip$data$2.lineHeight,
35
35
  dataGap = _ref$config$tip$data$2.gap,
36
+ iconGapName = _ref$config$tip$data$2.iconGapName,
37
+ nameGapData = _ref$config$tip$data$2.nameGapData,
36
38
  iconSize = _ref$config$tip$data$2.iconSize,
37
39
  dataBg = _ref$config$tip$data$2.background,
38
40
  name = _ref$config$tip$data$2.name,
@@ -168,10 +170,13 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
168
170
  }, /*#__PURE__*/React.createElement("span", {
169
171
  style: _objectSpread(_objectSpread({}, _icon), {}, {
170
172
  width: iconSize + "px",
171
- height: iconSize + "px"
173
+ height: iconSize + "px",
174
+ marginRight: iconGapName
172
175
  })
173
176
  }), /*#__PURE__*/React.createElement("span", {
174
- style: (0, _utils.getFontStyle)(name)
177
+ style: _objectSpread(_objectSpread({}, (0, _utils.getFontStyle)(name)), {}, {
178
+ marginRight: nameGapData
179
+ })
175
180
  }, displayName || s)), /*#__PURE__*/React.createElement("span", {
176
181
  style: (0, _utils.getFontStyle)(value)
177
182
  }, showY, showSuffix && /*#__PURE__*/React.createElement("span", {
@@ -23,6 +23,8 @@ var PieTooltip = exports.PieTooltip = /*#__PURE__*/(0, _react.memo)(function (pr
23
23
  _props$config$tip$dat = _props$config$tip.data,
24
24
  lineHeight = _props$config$tip$dat.lineHeight,
25
25
  iconSize = _props$config$tip$dat.iconSize,
26
+ iconGapName = _props$config$tip$dat.iconGapName,
27
+ nameGapData = _props$config$tip$dat.nameGapData,
26
28
  name = _props$config$tip$dat.name,
27
29
  _props$config$tip$dat2 = _props$config$tip$dat.value,
28
30
  valueIsShow = _props$config$tip$dat2.show,
@@ -102,15 +104,16 @@ var PieTooltip = exports.PieTooltip = /*#__PURE__*/(0, _react.memo)(function (pr
102
104
  }
103
105
  }, /*#__PURE__*/_react["default"].createElement("span", {
104
106
  style: _objectSpread(_objectSpread({}, _icon), {}, {
107
+ marginRight: iconGapName,
105
108
  width: iconSize + "px",
106
109
  height: iconSize + "px"
107
110
  })
108
111
  }), /*#__PURE__*/_react["default"].createElement("span", {
109
- style: (0, _utils.getFontStyle)(name)
110
- }, displayName || s)), valueIsShow && /*#__PURE__*/_react["default"].createElement("span", {
111
- style: _objectSpread(_objectSpread({}, (0, _utils.getFontStyle)(valueFont)), {}, {
112
- marginLeft: "10px"
112
+ style: _objectSpread(_objectSpread({}, (0, _utils.getFontStyle)(name)), {}, {
113
+ marginRight: nameGapData
113
114
  })
115
+ }, displayName || s)), valueIsShow && /*#__PURE__*/_react["default"].createElement("span", {
116
+ style: _objectSpread({}, (0, _utils.getFontStyle)(valueFont))
114
117
  }, y, valueSuffixIsShow && renderSuffix(valueSuffix)), percentageIsShow && /*#__PURE__*/_react["default"].createElement("span", {
115
118
  style: _objectSpread(_objectSpread({}, (0, _utils.getFontStyle)(percentageFont)), {}, {
116
119
  marginLeft: "10px"
@@ -57,7 +57,7 @@ var pieLegendFormatter = exports.pieLegendFormatter = function pieLegendFormatte
57
57
  var seriesColorType = seriesColor.type,
58
58
  pure = seriesColor.pure,
59
59
  stops = seriesColor.linear.stops;
60
- var _color = seriesColorType == 'pure' ? pure : stops[0].color;
60
+ var _color = seriesColorType == "pure" ? pure : stops[0].color;
61
61
  var textMarginLeft = 5;
62
62
 
63
63
  // 1. 计算每列宽度(加上间距)
@@ -74,7 +74,7 @@ var pieLegendFormatter = exports.pieLegendFormatter = function pieLegendFormatte
74
74
  className: showName && showValue && showPercent ? _indexModule["default"].showAllStyle : _indexModule["default"].notShowAllStyle,
75
75
  style: {
76
76
  width: "calc( 100% + ".concat(textMarginLeft + valueGap + percentGap, "px )"),
77
- gridTemplateColumns: columns.join(' ')
77
+ gridTemplateColumns: columns.join(" ")
78
78
  }
79
79
  }, showName && /*#__PURE__*/React.createElement(_components.TextOverflow, {
80
80
  value: displayName,
@@ -94,8 +94,8 @@ var pieLegendFormatter = exports.pieLegendFormatter = function pieLegendFormatte
94
94
  marginLeft: valueGap,
95
95
  transform: "translate(".concat(valueX, "px,").concat(valueY, "px)"),
96
96
  color: valueSameColor ? _color : valueFont.color,
97
- alignItems: 'center',
98
- justifyContent: valueAlign == "left" ? "flex-start" : valueAlign == "right" ? "flex-end" : 'center',
97
+ alignItems: "center",
98
+ justifyContent: valueAlign == "left" ? "flex-start" : valueAlign == "right" ? "flex-end" : "center",
99
99
  textAlign: valueAlign === "left" ? "left" : valueAlign === "right" ? "right" : "center"
100
100
  })
101
101
  }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(_components.SplitText, {
@@ -105,7 +105,7 @@ var pieLegendFormatter = exports.pieLegendFormatter = function pieLegendFormatte
105
105
  style: {
106
106
  whiteSpace: "nowrap",
107
107
  fontSize: fontSize,
108
- transform: 'translate3d(' + x + 'px, ' + y + 'px, 0px)'
108
+ transform: "translate3d(" + x + "px, " + y + "px, 0px)"
109
109
  }
110
110
  }, text)), showPercent && /*#__PURE__*/React.createElement("span", {
111
111
  style: _objectSpread(_objectSpread({
@@ -114,9 +114,9 @@ var pieLegendFormatter = exports.pieLegendFormatter = function pieLegendFormatte
114
114
  marginLeft: percentGap,
115
115
  transform: "translate(".concat(percentX, "px,").concat(percentY, "px)"),
116
116
  color: percentSameColor ? _color : percentFont.color,
117
- alignItems: 'center',
118
- justifyContent: percentAlign == "left" ? "flex-start" : percentAlign == "right" ? "flex-end" : 'center',
117
+ alignItems: "center",
118
+ justifyContent: percentAlign == "left" ? "flex-start" : percentAlign == "right" ? "flex-end" : "center",
119
119
  textAlign: percentAlign === "left" ? "left" : percentAlign === "right" ? "right" : "center"
120
120
  })
121
- }, percent + '%')));
121
+ }, percent + "%")));
122
122
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.9.28",
3
+ "version": "1.10.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -28,8 +28,12 @@ const getCanvasContext = (): CanvasRenderingContext2D => {
28
28
  return canvasContext;
29
29
  };
30
30
 
31
- //计算文本宽度的函数
32
- export const calculateTextWidth = (text: string, fontConfig: any): number => {
31
+ //计算文本宽度/高度的函数
32
+ export const calculateTextWidth = (
33
+ text: string,
34
+ fontConfig: any,
35
+ isVertical: any
36
+ ): number => {
33
37
  if (!text) return 0;
34
38
  const ctx = getCanvasContext();
35
39
  ctx.save();
@@ -45,16 +49,22 @@ export const calculateTextWidth = (text: string, fontConfig: any): number => {
45
49
  const letterSpacingWithUnit = `${letterSpacing}px`;
46
50
  ctx.font = `${fontWeight} ${fontStyle} ${fontSize} ${fontFamily}`;
47
51
  ctx.letterSpacing = letterSpacingWithUnit;
48
- let totalWidth;
52
+
53
+ let totalWidth = 0;
54
+ let totalHeight = 0;
55
+ const textMetrics = ctx.measureText(text);
56
+
49
57
  if (typeof ctx.letterSpacing !== "undefined") {
50
- totalWidth = ctx.measureText(text).width;
58
+ totalWidth = textMetrics.width;
51
59
  } else {
52
- const baseWidth = ctx.measureText(text).width;
53
- const spacingWidth = text.length * letterSpacing;
60
+ const baseWidth = textMetrics.width;
61
+ const spacingWidth = (text.length - 1) * letterSpacing;
54
62
  totalWidth = baseWidth + spacingWidth;
55
63
  }
64
+ totalHeight =
65
+ textMetrics.fontBoundingBoxAscent + textMetrics.fontBoundingBoxDescent;
56
66
  ctx.restore();
57
- return totalWidth;
67
+ return isVertical ? totalHeight : totalWidth;
58
68
  };
59
69
  const defaultEvent = () => {};
60
70
  const defaultAppearance = {
@@ -238,7 +248,13 @@ type LabelType = {
238
248
  LabelWidth: any;
239
249
  };
240
250
 
241
- function maxLabelFT(data: any, config: any, formatter: any, font: any) {
251
+ function maxLabelFT(
252
+ data: any,
253
+ config: any,
254
+ formatter: any,
255
+ font: any,
256
+ isVertical: any
257
+ ) {
242
258
  let max = 0;
243
259
  data.length
244
260
  ? data.forEach((item: any) => {
@@ -248,7 +264,8 @@ function maxLabelFT(data: any, config: any, formatter: any, font: any) {
248
264
  ...config,
249
265
  format: { type: config.format, showType: config.showType },
250
266
  }),
251
- font
267
+ font,
268
+ isVertical
252
269
  ) > max
253
270
  )
254
271
  max = calculateTextWidth(
@@ -256,7 +273,8 @@ function maxLabelFT(data: any, config: any, formatter: any, font: any) {
256
273
  ...config,
257
274
  format: { type: config.format, showType: config.showType },
258
275
  }),
259
- font
276
+ font,
277
+ isVertical
260
278
  );
261
279
  })
262
280
  : "";
@@ -395,6 +413,7 @@ export default memo(
395
413
  ) => {
396
414
  const { width, height, isIOS } = useContext(chartContext);
397
415
  const { cHeight, isC, cPercent } = controlInfo;
416
+ const isVertical = orientation == "left" || orientation == "right";
398
417
  const x = orientation == "right" ? width : 0;
399
418
  const y = orientation == "bottom" ? height - cHeight : 0;
400
419
  let LabelWidth = 1;
@@ -402,12 +421,21 @@ export default memo(
402
421
  LabelWidth = label.appearance.width;
403
422
  } else {
404
423
  if (allTicks.length && typeof allTicks[0] == "string") {
405
- LabelWidth = maxLabelFT(allTicks, label, formatter, label.font);
424
+ LabelWidth = maxLabelFT(
425
+ allTicks,
426
+ label,
427
+ formatter,
428
+ label.font,
429
+ isVertical
430
+ );
406
431
  }
407
432
  }
408
- const LabelNum = Math.floor(
409
- ((width / (isC ? cPercent : 1)) * (1 - paddingOuter)) / LabelWidth
410
- );
433
+ const LabelNum = !isVertical
434
+ ? Math.floor(
435
+ ((width / (isC ? cPercent : 1)) * (1 - paddingOuter)) / LabelWidth
436
+ )
437
+ : Math.floor(height / LabelWidth);
438
+
411
439
  const ticks: any = !label.adaptive
412
440
  ? tickss
413
441
  : getEvenlySpacedElements(
@@ -17,6 +17,8 @@ export const PieTooltip = memo((props) => {
17
17
  data: {
18
18
  lineHeight,
19
19
  iconSize,
20
+ iconGapName,
21
+ nameGapData,
20
22
  name,
21
23
  value: {
22
24
  show: valueIsShow,
@@ -106,14 +108,17 @@ export const PieTooltip = memo((props) => {
106
108
  <span
107
109
  style={{
108
110
  ..._icon,
111
+ marginRight: iconGapName,
109
112
  width: iconSize + "px",
110
113
  height: iconSize + "px",
111
114
  }}
112
115
  />
113
- <span style={getFontStyle(name)}>{displayName || s}</span>
116
+ <span style={{ ...getFontStyle(name), marginRight: nameGapData }}>
117
+ {displayName || s}
118
+ </span>
114
119
  </span>
115
120
  {valueIsShow && (
116
- <span style={{ ...getFontStyle(valueFont), marginLeft: "10px" }}>
121
+ <span style={{ ...getFontStyle(valueFont) }}>
117
122
  {y}
118
123
  {valueSuffixIsShow && renderSuffix(valueSuffix)}
119
124
  </span>
@@ -21,6 +21,8 @@ export default memo(
21
21
  data: {
22
22
  lineHeight,
23
23
  gap: dataGap,
24
+ iconGapName,
25
+ nameGapData,
24
26
  iconSize,
25
27
  background: dataBg,
26
28
  name,
@@ -194,9 +196,17 @@ export default memo(
194
196
  ..._icon,
195
197
  width: iconSize + "px",
196
198
  height: iconSize + "px",
199
+ marginRight: iconGapName,
197
200
  }}
198
201
  />
199
- <span style={getFontStyle(name)}>{displayName || s}</span>
202
+ <span
203
+ style={{
204
+ ...getFontStyle(name),
205
+ marginRight: nameGapData,
206
+ }}
207
+ >
208
+ {displayName || s}
209
+ </span>
200
210
  </span>
201
211
  <span style={getFontStyle(value)}>
202
212
  {showY}
@@ -1,51 +1,54 @@
1
- import css from '../css/index.module.css';
2
- import { getFontStyle } from '../utils';
3
- import { TextOverflow, SplitText } from '../components';
1
+ import css from "../css/index.module.css";
2
+ import { getFontStyle } from "../utils";
3
+ import { TextOverflow, SplitText } from "../components";
4
4
 
5
- export const pieLegendFormatter = (
6
- series,
7
- props
8
- ) => {
9
- const { displayName, data, percent, series: { color: seriesColor, icon="" } } = series,
10
- {
11
- name: { show: showName, font: nameFont, textOverflow, speed, maxWidth, translate: { x:nameX, y:nameY } },
12
- value: {
13
- show: showValue,
14
- font: valueFont,
15
- sameColor: valueSameColor,
16
- gap: valueGap,
17
- align: valueAlign,
18
- translate: {
19
- x:valueX,
20
- y:valueY
5
+ export const pieLegendFormatter = (series, props) => {
6
+ const {
7
+ displayName,
8
+ data,
9
+ percent,
10
+ series: { color: seriesColor, icon = "" },
11
+ } = series,
12
+ {
13
+ name: {
14
+ show: showName,
15
+ font: nameFont,
16
+ textOverflow,
17
+ speed,
18
+ maxWidth,
19
+ translate: { x: nameX, y: nameY },
20
+ },
21
+ value: {
22
+ show: showValue,
23
+ font: valueFont,
24
+ sameColor: valueSameColor,
25
+ gap: valueGap,
26
+ align: valueAlign,
27
+ translate: { x: valueX, y: valueY },
28
+ splitConfig,
29
+ suffix: {
30
+ show: showSuffix,
31
+ text,
32
+ fontSize,
33
+ translate: { x, y },
34
+ },
21
35
  },
22
- splitConfig,
23
- suffix: {
24
- show: showSuffix,
25
- text,
26
- fontSize,
27
- translate: { x, y },
36
+ percent: {
37
+ show: showPercent,
38
+ font: percentFont,
39
+ sameColor: percentSameColor,
40
+ gap: percentGap,
41
+ align: percentAlign,
42
+ translate: { x: percentX, y: percentY },
28
43
  },
29
- },
30
- percent: {
31
- show: showPercent,
32
- font: percentFont,
33
- sameColor: percentSameColor,
34
- gap: percentGap,
35
- align: percentAlign,
36
- translate: {
37
- x:percentX,
38
- y:percentY
39
- }
40
- },
41
- } = props;
44
+ } = props;
42
45
  const {
43
46
  type: seriesColorType,
44
47
  pure,
45
48
  linear: { stops },
46
49
  } = seriesColor;
47
50
 
48
- const _color = seriesColorType == 'pure' ? pure : stops[0].color;
51
+ const _color = seriesColorType == "pure" ? pure : stops[0].color;
49
52
  const textMarginLeft = 5;
50
53
 
51
54
  // 1. 计算每列宽度(加上间距)
@@ -55,7 +58,15 @@ export const pieLegendFormatter = (
55
58
  if (showPercent) columns.push(`${props.percentMaxWidth + percentGap}px`);
56
59
  return (
57
60
  <>
58
- {icon &&<span style={{ ...icon, marginRight: icon.marginRight, transform:`translate(${nameX}px, ${nameY}px)` }} />}
61
+ {icon && (
62
+ <span
63
+ style={{
64
+ ...icon,
65
+ marginRight: icon.marginRight,
66
+ transform: `translate(${nameX}px, ${nameY}px)`,
67
+ }}
68
+ />
69
+ )}
59
70
  <div
60
71
  className={
61
72
  showName && showValue && showPercent
@@ -63,36 +74,56 @@ export const pieLegendFormatter = (
63
74
  : css.notShowAllStyle
64
75
  }
65
76
  style={{
66
- width:`calc( 100% + ${textMarginLeft+valueGap+percentGap}px )`,
67
- gridTemplateColumns: columns.join(' ')
77
+ width: `calc( 100% + ${textMarginLeft + valueGap + percentGap}px )`,
78
+ gridTemplateColumns: columns.join(" "),
68
79
  }}
69
80
  >
70
81
  {showName && (
71
- <TextOverflow value={displayName} type={textOverflow} speed={speed} style={{
72
- width:maxWidth, marginLeft: textMarginLeft, ...getFontStyle(nameFont), transform:`translate(${nameX}px, ${nameY}px)`
73
- }}></TextOverflow>
82
+ <TextOverflow
83
+ value={displayName}
84
+ type={textOverflow}
85
+ speed={speed}
86
+ style={{
87
+ width: maxWidth,
88
+ marginLeft: textMarginLeft,
89
+ ...getFontStyle(nameFont),
90
+ transform: `translate(${nameX}px, ${nameY}px)`,
91
+ }}
92
+ ></TextOverflow>
74
93
  )}
75
94
  {showValue && (
76
95
  <span
77
96
  style={{
78
- display:"flex",
79
- whiteSpace:"nowrap",
97
+ display: "flex",
98
+ whiteSpace: "nowrap",
80
99
  ...getFontStyle(valueFont),
81
100
  marginLeft: valueGap,
82
- transform:`translate(${valueX}px,${valueY}px)`,
101
+ transform: `translate(${valueX}px,${valueY}px)`,
83
102
  color: valueSameColor ? _color : valueFont.color,
84
- alignItems: 'center',
85
- justifyContent: valueAlign=="left"?"flex-start":valueAlign=="right"?"flex-end":'center',
86
- textAlign: valueAlign === "left" ? "left" : valueAlign === "right" ? "right" : "center",
103
+ alignItems: "center",
104
+ justifyContent:
105
+ valueAlign == "left"
106
+ ? "flex-start"
107
+ : valueAlign == "right"
108
+ ? "flex-end"
109
+ : "center",
110
+ textAlign:
111
+ valueAlign === "left"
112
+ ? "left"
113
+ : valueAlign === "right"
114
+ ? "right"
115
+ : "center",
87
116
  }}
88
117
  >
89
- <span><SplitText value={data.y} config={splitConfig} /></span>
118
+ <span>
119
+ <SplitText value={data.y} config={splitConfig} />
120
+ </span>
90
121
  {showSuffix && (
91
122
  <span
92
123
  style={{
93
- whiteSpace:"nowrap",
124
+ whiteSpace: "nowrap",
94
125
  fontSize,
95
- transform: 'translate3d(' + x + 'px, ' + y + 'px, 0px)',
126
+ transform: "translate3d(" + x + "px, " + y + "px, 0px)",
96
127
  }}
97
128
  >
98
129
  {text}
@@ -103,17 +134,27 @@ export const pieLegendFormatter = (
103
134
  {showPercent && (
104
135
  <span
105
136
  style={{
106
- whiteSpace:"nowrap",
137
+ whiteSpace: "nowrap",
107
138
  ...getFontStyle(percentFont),
108
139
  marginLeft: percentGap,
109
- transform:`translate(${percentX}px,${percentY}px)`,
140
+ transform: `translate(${percentX}px,${percentY}px)`,
110
141
  color: percentSameColor ? _color : percentFont.color,
111
- alignItems: 'center',
112
- justifyContent: percentAlign=="left"?"flex-start":percentAlign=="right"?"flex-end":'center',
113
- textAlign: percentAlign === "left" ? "left" : percentAlign === "right" ? "right" : "center",
142
+ alignItems: "center",
143
+ justifyContent:
144
+ percentAlign == "left"
145
+ ? "flex-start"
146
+ : percentAlign == "right"
147
+ ? "flex-end"
148
+ : "center",
149
+ textAlign:
150
+ percentAlign === "left"
151
+ ? "left"
152
+ : percentAlign === "right"
153
+ ? "right"
154
+ : "center",
114
155
  }}
115
156
  >
116
- {percent + '%'}
157
+ {percent + "%"}
117
158
  </span>
118
159
  )}
119
160
  </div>