@easyv/charts 1.5.24 → 1.5.26
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/Axis.js +7 -3
- package/lib/components/CartesianChart.js +13 -2
- package/lib/components/Legend.js +1 -0
- package/lib/components/StereoBar.js +2 -1
- package/package.json +1 -1
- package/src/components/Axis.tsx +6 -2
- package/src/components/CartesianChart.js +8 -3
- package/src/components/Legend.js +1 -0
- package/src/components/StereoBar.tsx +1 -0
package/lib/components/Axis.js
CHANGED
|
@@ -163,7 +163,8 @@ var Unit = function Unit(_ref4) {
|
|
|
163
163
|
translateY = _ref4$config$translat.y,
|
|
164
164
|
_ref4$config$align = _ref4$config.align;
|
|
165
165
|
_ref4$config$align = _ref4$config$align === void 0 ? defaultAlign : _ref4$config$align;
|
|
166
|
-
var textAnchor = _ref4$config$align.textAnchor
|
|
166
|
+
var textAnchor = _ref4$config$align.textAnchor,
|
|
167
|
+
dataUnit = _ref4.dataUnit;
|
|
167
168
|
if (!show) return null;
|
|
168
169
|
return /*#__PURE__*/_react["default"].createElement("text", {
|
|
169
170
|
className: "__easyv-unit",
|
|
@@ -175,7 +176,7 @@ var Unit = function Unit(_ref4) {
|
|
|
175
176
|
fontStyle: italic ? "italic" : "normal",
|
|
176
177
|
letterSpacing: letterSpacing,
|
|
177
178
|
textAnchor: textAnchor
|
|
178
|
-
}, text);
|
|
179
|
+
}, dataUnit || text);
|
|
179
180
|
};
|
|
180
181
|
|
|
181
182
|
var Label = function Label(_ref5) {
|
|
@@ -242,6 +243,7 @@ var Label = function Label(_ref5) {
|
|
|
242
243
|
style: _objectSpread(_objectSpread(_objectSpread({}, _style), (0, _utils.getFontStyle)(font)), {}, {
|
|
243
244
|
/** Safari Bug **/
|
|
244
245
|
position: "absolute",
|
|
246
|
+
cursor: "pointer",
|
|
245
247
|
left: x + (isIOS ? iosX : 0),
|
|
246
248
|
top: y + (isIOS ? iosY : 0)
|
|
247
249
|
})
|
|
@@ -279,6 +281,7 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
279
281
|
marginTop = _ref6$margin.marginTop,
|
|
280
282
|
positions = _ref6.positions,
|
|
281
283
|
xLineRange = _ref6.xLineRange,
|
|
284
|
+
dataUnit = _ref6.dataUnit,
|
|
282
285
|
range = _ref6.range,
|
|
283
286
|
axisType = _ref6.axisType,
|
|
284
287
|
_ref6$isClipAxis = _ref6.isClipAxis,
|
|
@@ -451,7 +454,8 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
451
454
|
clipAxisRange: clipAxisRange,
|
|
452
455
|
cPercent: cPercent
|
|
453
456
|
}), isC && tickLine && drawAxisTickLine(), unit && /*#__PURE__*/_react["default"].createElement(Unit, {
|
|
454
|
-
config: unit
|
|
457
|
+
config: unit,
|
|
458
|
+
dataUnit: dataUnit
|
|
455
459
|
})))));
|
|
456
460
|
}));
|
|
457
461
|
|
|
@@ -442,7 +442,17 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
442
442
|
config: background,
|
|
443
443
|
bandLength: bandLength
|
|
444
444
|
}))), (0, _toConsumableArray2["default"])(axes.values()).reverse().map(function (item, index) {
|
|
445
|
-
var
|
|
445
|
+
var axisType = item.axisType;
|
|
446
|
+
var dataUnit = "";
|
|
447
|
+
var config = axisType == "x" ? axisX : item;
|
|
448
|
+
var target = series.find(function (d) {
|
|
449
|
+
return d.yOrZ == axisType;
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
if (target && target.data[0]) {
|
|
453
|
+
dataUnit = target.data[0].data.__unit__;
|
|
454
|
+
}
|
|
455
|
+
|
|
446
456
|
return /*#__PURE__*/_react["default"].createElement(_.Axis, (0, _extends2["default"])({
|
|
447
457
|
ref: function ref(d) {
|
|
448
458
|
axisElList.current[index] = d;
|
|
@@ -454,7 +464,8 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
454
464
|
margin: {
|
|
455
465
|
marginLeft: marginLeft,
|
|
456
466
|
marginTop: marginTop
|
|
457
|
-
}
|
|
467
|
+
},
|
|
468
|
+
dataUnit: dataUnit
|
|
458
469
|
}, config, {
|
|
459
470
|
key: index
|
|
460
471
|
}));
|
package/lib/components/Legend.js
CHANGED
|
@@ -124,6 +124,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
124
124
|
display: 'flex',
|
|
125
125
|
opacity: selected === false ? opacity / 100 : 1,
|
|
126
126
|
alignItems: 'center',
|
|
127
|
+
cursor: "pointer",
|
|
127
128
|
gap: _icon.gap
|
|
128
129
|
}
|
|
129
130
|
}, formatter ? formatter(series, config) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
@@ -199,7 +199,8 @@ var Column3DSkin = function Column3DSkin(props) {
|
|
|
199
199
|
style: {
|
|
200
200
|
transform: "skew(0deg, 23deg)",
|
|
201
201
|
transformOrigin: "".concat(x + width / 2, "px ").concat(y + height / 2, "px"),
|
|
202
|
-
opacity: opacity
|
|
202
|
+
opacity: opacity,
|
|
203
|
+
cursor: "pointer"
|
|
203
204
|
}
|
|
204
205
|
}, color.defs, /*#__PURE__*/_react["default"].createElement("rect", {
|
|
205
206
|
width: width / 2,
|
package/package.json
CHANGED
package/src/components/Axis.tsx
CHANGED
|
@@ -137,6 +137,7 @@ const AxisLine: ({
|
|
|
137
137
|
|
|
138
138
|
const Unit: ({
|
|
139
139
|
config: { show, text, font, translate, align },
|
|
140
|
+
dataUnit
|
|
140
141
|
}: any) => ReactComponentElement<ComponentType> | null = ({
|
|
141
142
|
config: {
|
|
142
143
|
show,
|
|
@@ -145,6 +146,7 @@ const Unit: ({
|
|
|
145
146
|
translate: { x: translateX, y: translateY },
|
|
146
147
|
align: { textAnchor } = defaultAlign,
|
|
147
148
|
},
|
|
149
|
+
dataUnit
|
|
148
150
|
}) => {
|
|
149
151
|
if (!show) return null;
|
|
150
152
|
return (
|
|
@@ -159,7 +161,7 @@ const Unit: ({
|
|
|
159
161
|
letterSpacing={letterSpacing}
|
|
160
162
|
textAnchor={textAnchor}
|
|
161
163
|
>
|
|
162
|
-
{text}
|
|
164
|
+
{dataUnit || text}
|
|
163
165
|
</text>
|
|
164
166
|
);
|
|
165
167
|
};
|
|
@@ -242,6 +244,7 @@ const Label: (
|
|
|
242
244
|
...getFontStyle(font),
|
|
243
245
|
/** Safari Bug **/
|
|
244
246
|
position:"absolute",
|
|
247
|
+
cursor:"pointer",
|
|
245
248
|
left:x+(isIOS?iosX:0),
|
|
246
249
|
top:y+(isIOS?iosY:0)
|
|
247
250
|
}}
|
|
@@ -277,6 +280,7 @@ export default memo(
|
|
|
277
280
|
margin:{ marginLeft, marginTop },
|
|
278
281
|
positions,
|
|
279
282
|
xLineRange,
|
|
283
|
+
dataUnit,
|
|
280
284
|
range,
|
|
281
285
|
axisType,
|
|
282
286
|
//断轴图相关
|
|
@@ -499,7 +503,7 @@ export default memo(
|
|
|
499
503
|
cPercent={cPercent}
|
|
500
504
|
/>}
|
|
501
505
|
{isC && tickLine && drawAxisTickLine()}
|
|
502
|
-
{unit && <Unit config={unit} />}
|
|
506
|
+
{unit && <Unit config={unit} dataUnit={dataUnit}/>}
|
|
503
507
|
</g>
|
|
504
508
|
</g>
|
|
505
509
|
</svg>
|
|
@@ -379,7 +379,13 @@ const Chart = memo(
|
|
|
379
379
|
)}
|
|
380
380
|
{/* 坐标轴 */}
|
|
381
381
|
{[...axes.values()].reverse().map((item, index) => {
|
|
382
|
-
const
|
|
382
|
+
const { axisType } = item;
|
|
383
|
+
let dataUnit = "";
|
|
384
|
+
const config = axisType == "x" ? axisX : item;
|
|
385
|
+
const target = series.find(d=>d.yOrZ==axisType);
|
|
386
|
+
if(target && target.data[0]){
|
|
387
|
+
dataUnit = target.data[0].data.__unit__;
|
|
388
|
+
}
|
|
383
389
|
return (
|
|
384
390
|
<Axis
|
|
385
391
|
ref={(d) => {
|
|
@@ -390,6 +396,7 @@ const Chart = memo(
|
|
|
390
396
|
yLineRange={yLineRange}
|
|
391
397
|
controlInfo={controlInfo}
|
|
392
398
|
margin={{marginLeft,marginTop}}
|
|
399
|
+
dataUnit={dataUnit}
|
|
393
400
|
{...config}
|
|
394
401
|
key={index}
|
|
395
402
|
/>
|
|
@@ -398,7 +405,6 @@ const Chart = memo(
|
|
|
398
405
|
{showTooltip && !control && (
|
|
399
406
|
<Indicator {...indicator} {...indicatorAttr} />
|
|
400
407
|
)}
|
|
401
|
-
|
|
402
408
|
<foreignObject
|
|
403
409
|
style={
|
|
404
410
|
{
|
|
@@ -481,7 +487,6 @@ const Chart = memo(
|
|
|
481
487
|
})}
|
|
482
488
|
</svg>
|
|
483
489
|
</foreignObject>
|
|
484
|
-
|
|
485
490
|
{baseLineData &&
|
|
486
491
|
baseLineData.length > 0 &&
|
|
487
492
|
baseLineData.map((item, index) => {
|
package/src/components/Legend.js
CHANGED