@easyv/charts 1.9.6 → 1.9.8
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/lib/components/Band.js +6 -6
- package/lib/components/Chart.js +1 -1
- package/lib/components/Legend.js +11 -7
- package/lib/formatter/legend.js +0 -1
- package/package.json +1 -1
- package/src/components/Band.tsx +6 -6
- package/src/components/Chart.js +1 -1
- package/src/components/Legend.js +6 -6
- package/src/formatter/legend.js +0 -1
package/lib/components/Band.js
CHANGED
|
@@ -55,15 +55,15 @@ var getAttr = function getAttr(_ref) {
|
|
|
55
55
|
var len = length ? length : 0.1; //柱子长度
|
|
56
56
|
if (isVertical) {
|
|
57
57
|
return {
|
|
58
|
-
width: len,
|
|
59
|
-
height: seriesWidth,
|
|
58
|
+
width: Math.max(0, len),
|
|
59
|
+
height: Math.max(0, seriesWidth),
|
|
60
60
|
x: y,
|
|
61
61
|
y: x,
|
|
62
62
|
bgAttr: {
|
|
63
63
|
x: 0,
|
|
64
64
|
y: x,
|
|
65
|
-
width: len + x,
|
|
66
|
-
height: seriesWidth
|
|
65
|
+
width: Math.max(0, len + x),
|
|
66
|
+
height: Math.max(0, seriesWidth)
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
} else {
|
|
@@ -75,8 +75,8 @@ var getAttr = function getAttr(_ref) {
|
|
|
75
75
|
bgAttr: {
|
|
76
76
|
x: x,
|
|
77
77
|
y: 0,
|
|
78
|
-
width: seriesWidth,
|
|
79
|
-
height: y + len
|
|
78
|
+
width: Math.max(0, seriesWidth),
|
|
79
|
+
height: Math.max(0, y + len)
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
}
|
package/lib/components/Chart.js
CHANGED
|
@@ -53,7 +53,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
|
53
53
|
emit = _ref2.emit,
|
|
54
54
|
emitEvent = _ref2.emitEvent,
|
|
55
55
|
props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
|
|
56
|
-
console.log("
|
|
56
|
+
console.log("999");
|
|
57
57
|
var width = props.width,
|
|
58
58
|
height = props.height;
|
|
59
59
|
var isIOS = (0, _react.useRef)(/iPad|iPhone|iPod|iOS/i.test(navigator.userAgent) || /Mac OS X/i.test(navigator.userAgent) && !/Chrome/i.test(navigator.userAgent));
|
package/lib/components/Legend.js
CHANGED
|
@@ -116,11 +116,13 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
116
116
|
_alignment = _alignment$split2[0],
|
|
117
117
|
position = _alignment$split2[1];
|
|
118
118
|
var length = _series.length;
|
|
119
|
-
var onClick = (0, _react.useCallback)(function (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
var onClick = (0, _react.useCallback)(function (fieldName) {
|
|
120
|
+
return function (e) {
|
|
121
|
+
var dataset = e.currentTarget.dataset;
|
|
122
|
+
var name = dataset.name;
|
|
123
|
+
filterData && interactive && filterData(fieldName || name);
|
|
124
|
+
pieClick && pieClick(e);
|
|
125
|
+
};
|
|
124
126
|
}, [interactive, filterData, pieClick]);
|
|
125
127
|
if (judge == 0) {
|
|
126
128
|
_series.forEach(function (d) {
|
|
@@ -190,13 +192,14 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
190
192
|
var type = series.type,
|
|
191
193
|
name = series.name,
|
|
192
194
|
displayName = series.displayName,
|
|
195
|
+
fieldName = series.fieldName,
|
|
193
196
|
icon = series.icon,
|
|
194
197
|
selected = series.selected,
|
|
195
198
|
index = series.index;
|
|
196
199
|
var _icon = (0, _utils.getIcon)(type, icon, series === null || series === void 0 || (_series$config = series.config) === null || _series$config === void 0 || (_series$config = _series$config.line) === null || _series$config === void 0 ? void 0 : _series$config.type);
|
|
197
200
|
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
198
201
|
key: i,
|
|
199
|
-
onClick: onClick,
|
|
202
|
+
onClick: onClick(fieldName),
|
|
200
203
|
"data-name": displayName || name,
|
|
201
204
|
"data-index": index,
|
|
202
205
|
style: {
|
|
@@ -242,13 +245,14 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
242
245
|
var type = series.type,
|
|
243
246
|
name = series.name,
|
|
244
247
|
displayName = series.displayName,
|
|
248
|
+
fieldName = series.fieldName,
|
|
245
249
|
icon = series.icon,
|
|
246
250
|
selected = series.selected,
|
|
247
251
|
index = series.index;
|
|
248
252
|
var _icon = (0, _utils.getIcon)(type, icon, series === null || series === void 0 || (_series$config2 = series.config) === null || _series$config2 === void 0 || (_series$config2 = _series$config2.line) === null || _series$config2 === void 0 ? void 0 : _series$config2.type);
|
|
249
253
|
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
250
254
|
key: i,
|
|
251
|
-
onClick: onClick,
|
|
255
|
+
onClick: onClick(fieldName),
|
|
252
256
|
"data-name": displayName || name,
|
|
253
257
|
"data-index": index,
|
|
254
258
|
style: {
|
package/lib/formatter/legend.js
CHANGED
|
@@ -65,7 +65,6 @@ var pieLegendFormatter = exports.pieLegendFormatter = function pieLegendFormatte
|
|
|
65
65
|
if (showName) columns.push("".concat(props.nameMaxWidth, "px"));
|
|
66
66
|
if (showValue) columns.push("".concat(props.valueMaxWidth + valueGap, "px"));
|
|
67
67
|
if (showPercent) columns.push("".concat(props.percentMaxWidth + percentGap, "px"));
|
|
68
|
-
columns[columns.length - 1] = "auto";
|
|
69
68
|
return /*#__PURE__*/React.createElement(React.Fragment, null, icon && /*#__PURE__*/React.createElement("span", {
|
|
70
69
|
style: _objectSpread(_objectSpread({}, icon), {}, {
|
|
71
70
|
marginRight: icon.marginRight,
|
package/package.json
CHANGED
package/src/components/Band.tsx
CHANGED
|
@@ -40,15 +40,15 @@ const getAttr = ({
|
|
|
40
40
|
const len = length ? length : 0.1; //柱子长度
|
|
41
41
|
if (isVertical) {
|
|
42
42
|
return {
|
|
43
|
-
width: len,
|
|
44
|
-
height: seriesWidth,
|
|
43
|
+
width: Math.max(0,len),
|
|
44
|
+
height: Math.max(0,seriesWidth),
|
|
45
45
|
x: y,
|
|
46
46
|
y: x,
|
|
47
47
|
bgAttr: {
|
|
48
48
|
x: 0,
|
|
49
49
|
y: x,
|
|
50
|
-
width: len + x,
|
|
51
|
-
height: seriesWidth,
|
|
50
|
+
width: Math.max(0,len + x),
|
|
51
|
+
height: Math.max(0,seriesWidth),
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
54
|
} else {
|
|
@@ -60,8 +60,8 @@ const getAttr = ({
|
|
|
60
60
|
bgAttr: {
|
|
61
61
|
x,
|
|
62
62
|
y: 0,
|
|
63
|
-
width: seriesWidth,
|
|
64
|
-
height: y + len,
|
|
63
|
+
width: Math.max(0,seriesWidth),
|
|
64
|
+
height: Math.max(0,y + len),
|
|
65
65
|
},
|
|
66
66
|
};
|
|
67
67
|
}
|
package/src/components/Chart.js
CHANGED
package/src/components/Legend.js
CHANGED
|
@@ -88,10 +88,10 @@ export default memo(
|
|
|
88
88
|
const length = _series.length;
|
|
89
89
|
|
|
90
90
|
const onClick = useCallback(
|
|
91
|
-
(e) => {
|
|
91
|
+
(fieldName) => (e) => {
|
|
92
92
|
const { dataset } = e.currentTarget;
|
|
93
93
|
const { name } = dataset;
|
|
94
|
-
filterData && interactive && filterData(name);
|
|
94
|
+
filterData && interactive && filterData(fieldName||name);
|
|
95
95
|
pieClick && pieClick(e);
|
|
96
96
|
},
|
|
97
97
|
[interactive, filterData, pieClick]
|
|
@@ -211,12 +211,12 @@ export default memo(
|
|
|
211
211
|
}}
|
|
212
212
|
>
|
|
213
213
|
{_series.map((series, i) => {
|
|
214
|
-
const { type, name, displayName, icon, selected, index } = series;
|
|
214
|
+
const { type, name, displayName,fieldName, icon, selected, index } = series;
|
|
215
215
|
const _icon = getIcon(type, icon, series?.config?.line?.type);
|
|
216
216
|
return (
|
|
217
217
|
<li
|
|
218
218
|
key={i}
|
|
219
|
-
onClick={onClick}
|
|
219
|
+
onClick={onClick(fieldName)}
|
|
220
220
|
data-name={displayName || name}
|
|
221
221
|
data-index={index}
|
|
222
222
|
style={{
|
|
@@ -281,13 +281,13 @@ export default memo(
|
|
|
281
281
|
>
|
|
282
282
|
{_series.map((series, i) => {
|
|
283
283
|
if (Math.floor(i / gridTemplateColumns) == indexs) {
|
|
284
|
-
const { type, name, displayName, icon, selected, index } =
|
|
284
|
+
const { type, name, displayName,fieldName, icon, selected, index } =
|
|
285
285
|
series;
|
|
286
286
|
const _icon = getIcon(type, icon, series?.config?.line?.type);
|
|
287
287
|
return (
|
|
288
288
|
<li
|
|
289
289
|
key={i}
|
|
290
|
-
onClick={onClick}
|
|
290
|
+
onClick={onClick(fieldName)}
|
|
291
291
|
data-name={displayName || name}
|
|
292
292
|
data-index={index}
|
|
293
293
|
style={{
|
package/src/formatter/legend.js
CHANGED
|
@@ -53,7 +53,6 @@ export const pieLegendFormatter = (
|
|
|
53
53
|
if (showName) columns.push(`${props.nameMaxWidth}px`);
|
|
54
54
|
if (showValue) columns.push(`${props.valueMaxWidth + valueGap}px`);
|
|
55
55
|
if (showPercent) columns.push(`${props.percentMaxWidth + percentGap}px`);
|
|
56
|
-
columns[columns.length-1]="auto"
|
|
57
56
|
return (
|
|
58
57
|
<>
|
|
59
58
|
{icon &&<span style={{ ...icon, marginRight: icon.marginRight, transform:`translate(${nameX}px, ${nameY}px)` }} />}
|