@easyv/charts 1.9.29 → 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.
@@ -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.29",
3
+ "version": "1.10.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -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>