@easyv/charts 1.3.21 → 1.3.22

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.
@@ -19,6 +19,8 @@ var _react = _interopRequireWildcard(require("react"));
19
19
 
20
20
  var _utils = require("../utils");
21
21
 
22
+ var _TextOverflow = _interopRequireDefault(require("./TextOverflow"));
23
+
22
24
  var _excluded = ["italic", "bold"];
23
25
 
24
26
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -42,6 +44,9 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
42
44
  _ref$config$order = _ref$config.order,
43
45
  order = _ref$config$order === void 0 ? '' : _ref$config$order,
44
46
  interactive = _ref$config.interactive,
47
+ maxWidth = _ref$config.maxWidth,
48
+ textOverflow = _ref$config.textOverflow,
49
+ speed = _ref$config.speed,
45
50
  _ref$config$layout = _ref$config.layout,
46
51
  _ref$config$layout$al = _ref$config$layout.alignment,
47
52
  alignment = _ref$config$layout$al === void 0 ? 'right center' : _ref$config$layout$al,
@@ -123,12 +128,16 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
123
128
  }
124
129
  }, formatter ? formatter(series, config) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("span", {
125
130
  style: _icon
126
- }), /*#__PURE__*/_react["default"].createElement("span", {
131
+ }), /*#__PURE__*/_react["default"].createElement(_TextOverflow["default"], {
132
+ type: textOverflow,
133
+ value: displayName || name,
127
134
  style: _objectSpread(_objectSpread({}, font), {}, {
135
+ width: maxWidth,
128
136
  fontStyle: italic ? 'italic' : 'normal',
129
137
  fontWeight: bold ? 'bold' : 'normal'
130
- })
131
- }, displayName || name)));
138
+ }),
139
+ speed: speed
140
+ })));
132
141
  })));
133
142
  });
134
143
 
@@ -145,7 +145,7 @@ var _default = function _default(_ref) {
145
145
  if (type == 'linear' && config.on) {
146
146
  var zeroPosition = scaler(0);
147
147
 
148
- if (zeroPosition !== range[0]) {
148
+ if (zeroPosition !== range[0] && !isNaN(zeroPosition)) {
149
149
  if (direction === 'horizontal') {
150
150
  xAxisPositions.push({
151
151
  x: zeroPosition,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.3.21",
3
+ "version": "1.3.22",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import React, { memo, useCallback } from 'react';
5
5
  import { getIcon, sortPie } from '../utils';
6
+ import TextOverflow from './TextOverflow';
6
7
 
7
8
  const defaultFont = {
8
9
  fontStyle: 'normal',
@@ -17,6 +18,9 @@ export default memo(
17
18
  show,
18
19
  order = '',
19
20
  interactive,
21
+ maxWidth,
22
+ textOverflow,
23
+ speed,
20
24
  layout: {
21
25
  alignment = 'right center',
22
26
  gridTemplateColumns,
@@ -45,7 +49,6 @@ export default memo(
45
49
  );
46
50
 
47
51
  //木然判断数据都为零时做的,此处并不严谨,待想到好方法在进一步解决
48
-
49
52
  if (judge == 0) {
50
53
  _series.forEach((d) => {
51
54
  d.percent=0
@@ -91,15 +94,13 @@ export default memo(
91
94
  ) : (
92
95
  <>
93
96
  <span style={_icon} />
94
- <span
95
- style={{
97
+ <TextOverflow type={textOverflow} value={displayName || name} style={{
96
98
  ...font,
99
+ width:maxWidth,
97
100
  fontStyle: italic ? 'italic' : 'normal',
98
101
  fontWeight: bold ? 'bold' : 'normal',
99
- }}
100
- >
101
- {displayName || name}
102
- </span>
102
+ }} speed={speed}></TextOverflow>
103
+
103
104
  </>
104
105
  )}
105
106
  </li>
@@ -33,13 +33,11 @@ export default memo((props) => {
33
33
  }
34
34
  };
35
35
 
36
-
37
36
  const styles = {
38
37
  ...getTextOverflow(type),
39
38
  ...style
40
39
  }
41
40
 
42
-
43
41
  return type == 'marquee' ? (
44
42
  <Marquee
45
43
  value={value}
@@ -141,7 +141,7 @@ export default ({ axes, context: { width, height } }) => {
141
141
 
142
142
  if (type == 'linear' && config.on) {
143
143
  const zeroPosition = scaler(0);
144
- if (zeroPosition !== range[0]) {
144
+ if (zeroPosition !== range[0] && !isNaN(zeroPosition)) {
145
145
  if (direction === 'horizontal') {
146
146
  xAxisPositions.push({
147
147
  x: zeroPosition,