@easyv/charts 1.0.58 → 1.0.59
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/Label.js
CHANGED
|
@@ -72,6 +72,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
72
72
|
_ref2$data = _ref2.data,
|
|
73
73
|
x = _ref2$data.x,
|
|
74
74
|
y = _ref2$data.y,
|
|
75
|
+
showY = _ref2$data.showY,
|
|
75
76
|
s = _ref2$data.s;
|
|
76
77
|
|
|
77
78
|
var y1 = yScaler(isVertical ? end : start);
|
|
@@ -108,7 +109,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
108
109
|
cy: attr.y,
|
|
109
110
|
config: icon
|
|
110
111
|
}), showLabel && /*#__PURE__*/React.createElement(Label, (0, _extends2["default"])({
|
|
111
|
-
value:
|
|
112
|
+
value: showY,
|
|
112
113
|
config: label
|
|
113
114
|
}, attr)));
|
|
114
115
|
}));
|
|
@@ -81,7 +81,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
81
81
|
transform: (0, _utils.getTranslate3d)(translateXAxis)
|
|
82
82
|
}, font)
|
|
83
83
|
}, x), data.map(function (_ref2, index) {
|
|
84
|
-
var
|
|
84
|
+
var showY = _ref2.showY,
|
|
85
85
|
s = _ref2.s;
|
|
86
86
|
|
|
87
87
|
var _series$find = series.find(function (series) {
|
|
@@ -112,7 +112,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
112
112
|
style: (0, _utils.getFontStyle)(name)
|
|
113
113
|
}, displayName || s)), /*#__PURE__*/React.createElement("span", {
|
|
114
114
|
style: (0, _utils.getFontStyle)(value)
|
|
115
|
-
},
|
|
115
|
+
}, showY));
|
|
116
116
|
})));
|
|
117
117
|
});
|
|
118
118
|
|
|
@@ -101,7 +101,12 @@ var _default = function _default(_ref) {
|
|
|
101
101
|
}, [series]);
|
|
102
102
|
return [{
|
|
103
103
|
series: _series,
|
|
104
|
-
data: _data
|
|
104
|
+
data: _data.map(function (d) {
|
|
105
|
+
return _objectSpread(_objectSpread({}, d), {}, {
|
|
106
|
+
y: parseFloat(d.y),
|
|
107
|
+
showY: d.y
|
|
108
|
+
});
|
|
109
|
+
})
|
|
105
110
|
}, onClick];
|
|
106
111
|
};
|
|
107
112
|
|
package/package.json
CHANGED
package/src/components/Label.js
CHANGED
|
@@ -40,11 +40,10 @@ export default memo(
|
|
|
40
40
|
paddingInner * seriesStep;
|
|
41
41
|
const isVertical = direction === 'vertical';
|
|
42
42
|
const _position = label.position;
|
|
43
|
-
|
|
44
43
|
return (
|
|
45
44
|
<g className='__easyv-label'>
|
|
46
45
|
{data.map(
|
|
47
|
-
({ index, bound: [start, end], data, data: { x, y, s } }, i) => {
|
|
46
|
+
({ index, bound: [start, end], data, data: { x, y, showY, s } }, i) => {
|
|
48
47
|
|
|
49
48
|
const y1 = yScaler(isVertical ? end : start);
|
|
50
49
|
const y2 = start ? yScaler(isVertical ? start : end - start) : yScaler(isVertical ? start : end);
|
|
@@ -84,7 +83,7 @@ export default memo(
|
|
|
84
83
|
data-data={JSON.stringify(data)}
|
|
85
84
|
>
|
|
86
85
|
{showIcon && <Icon cx={attr.x} cy={attr.y} config={icon} />}
|
|
87
|
-
{showLabel && <Label value={
|
|
86
|
+
{showLabel && <Label value={showY} config={label} {...attr} />}
|
|
88
87
|
</g>
|
|
89
88
|
);
|
|
90
89
|
}
|
|
@@ -81,7 +81,7 @@ export default memo(
|
|
|
81
81
|
>
|
|
82
82
|
{x}
|
|
83
83
|
</dt>
|
|
84
|
-
{data.map(({
|
|
84
|
+
{data.map(({ showY, s }, index) => {
|
|
85
85
|
const { type, icon, displayName } = series.find(
|
|
86
86
|
(series) => series.name == s
|
|
87
87
|
);
|
|
@@ -105,7 +105,7 @@ export default memo(
|
|
|
105
105
|
<span style={_icon} />
|
|
106
106
|
<span style={getFontStyle(name)}>{displayName || s}</span>
|
|
107
107
|
</span>
|
|
108
|
-
<span style={getFontStyle(value)}>{
|
|
108
|
+
<span style={getFontStyle(value)}>{showY}</span>
|
|
109
109
|
</dd>
|
|
110
110
|
);
|
|
111
111
|
})}
|
|
@@ -29,7 +29,7 @@ const getSelected = (selected, name) => {
|
|
|
29
29
|
|
|
30
30
|
export default ({ data, series }) => {
|
|
31
31
|
const [selected, setSelected] = useState(getInitialSelected(series));
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
const _series = useMemo(() => {
|
|
34
34
|
const tmp = new Map();
|
|
35
35
|
series.forEach((currentSeries, key) => {
|
|
@@ -55,10 +55,17 @@ export default ({ data, series }) => {
|
|
|
55
55
|
useEffect(() => {
|
|
56
56
|
setSelected(getInitialSelected(series));
|
|
57
57
|
}, [series]);
|
|
58
|
+
|
|
58
59
|
return [
|
|
59
60
|
{
|
|
60
61
|
series: _series,
|
|
61
|
-
data: _data
|
|
62
|
+
data: _data.map(d=>{
|
|
63
|
+
return {
|
|
64
|
+
...d,
|
|
65
|
+
y:parseFloat(d.y),
|
|
66
|
+
showY:d.y
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
62
69
|
},
|
|
63
70
|
onClick,
|
|
64
71
|
];
|