@easyv/charts 1.5.11 → 1.5.13

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.
@@ -235,7 +235,10 @@ var Label = function Label(_ref5) {
235
235
  "data-data": JSON.stringify({
236
236
  x: label
237
237
  }),
238
- style: _objectSpread(_objectSpread({}, _style), (0, _utils.getFontStyle)(font))
238
+ style: _objectSpread(_objectSpread(_objectSpread({}, _style), (0, _utils.getFontStyle)(font)), {}, {
239
+ /** Safari Bug **/
240
+ position: "fixed"
241
+ })
239
242
  }, /*#__PURE__*/_react["default"].createElement(_TextOverflow["default"], {
240
243
  type: textOverflow,
241
244
  speed: speed,
@@ -266,7 +266,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
266
266
  height: "100%",
267
267
 
268
268
  /** Safari Bug **/
269
- position: "fixed",
269
+ // position: "fixed",
270
270
  clipPath: setClipPath(),
271
271
  opacity: fillType == "pattern" ? opacity : 1,
272
272
  background: fillType == "pattern" ? "50% 50% / ".concat(size.width, "px ").concat(size.height, "px repeat ") + "url(" + url + ")" : (0, _utils.getBandBackground)(pattern, extent === flag ? highlightFill : fill),
@@ -464,6 +464,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
464
464
  ref: seriesEl,
465
465
  style: {
466
466
  overflow: "visible",
467
+ position: "fixed",
467
468
  transform: isVertical ? "translateX(".concat(marginRight, "px)") : "translateY(".concat(marginTop, "px)")
468
469
  }
469
470
  }, /*#__PURE__*/_react["default"].createElement("g", null, control && ctlIndicatorList.map(function (item, index) {
@@ -11,8 +11,6 @@ exports["default"] = void 0;
11
11
 
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
14
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
15
-
16
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
15
 
18
16
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
@@ -127,32 +125,20 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
127
125
  return function () {
128
126
  document.removeEventListener("switchActive_".concat(id), activeHandler);
129
127
  };
130
- }, []); //对轴类图表进行
131
-
132
- var data = originData;
133
-
134
- if (axes) {
135
- var xAxis = axes.find(function (d) {
136
- return d.axisType == "x";
137
- });
138
-
139
- if (xAxis) {
140
- var _xAxis$config$label = xAxis.config.label,
141
- autoSort = _xAxis$config$label.autoSort,
142
- _type = _xAxis$config$label.format.type;
143
-
144
- if (_type == "date" && autoSort) {
145
- var groupBySeries = (0, _d3v.group)(data, function (d) {
146
- return d.s;
147
- });
148
- data = (0, _toConsumableArray2["default"])(groupBySeries).flatMap(function (d) {
149
- return d[1].sort(function (a, b) {
150
- return a.x > b.x ? 1 : -1;
151
- });
152
- });
153
- }
154
- }
155
- }
128
+ }, []);
129
+ var data = originData; //对轴类图表进行自动排序
130
+ // if(axes){
131
+ // const xAxis = axes.find(d=>d.axisType=="x");
132
+ // if(xAxis){
133
+ // const { config:{ label:{ autoSort, format:{ type } } } } = xAxis;
134
+ // if(type=="date" && autoSort){
135
+ // const groupBySeries = group(data, (d) => d.s);
136
+ // data=[...groupBySeries].flatMap(d=>{
137
+ // return d[1].sort((a,b)=>a.x>b.x?1:-1)
138
+ // });
139
+ // }
140
+ // }
141
+ // }
156
142
 
157
143
  return /*#__PURE__*/_react["default"].createElement(_context.chartContext.Provider, {
158
144
  value: context
@@ -93,7 +93,26 @@ var _default = function _default(_ref) {
93
93
  }).keys());
94
94
  }, [data]);
95
95
  var y = stackData(dataY, _series.y);
96
- var z = stackData(dataZ, _series.z); //clipAxisMode如果是auto根据clipDifferenceValue设置clipValue
96
+ var z = stackData(dataZ, _series.z);
97
+ var xAxis = axes.find(function (d) {
98
+ return d.axisType == "x";
99
+ });
100
+
101
+ if (xAxis) {
102
+ var _xAxis$config$label = xAxis.config.label,
103
+ autoSort = _xAxis$config$label.autoSort,
104
+ type = _xAxis$config$label.format.type;
105
+
106
+ if (type == "date" && autoSort) {
107
+ x.sort(function (a, b) {
108
+ return a > b ? 1 : -1;
109
+ }); // const groupBySeries = group(data, (d) => d.s);
110
+ // data=[...groupBySeries].flatMap(d=>{
111
+ // return d[1].sort((a,b)=>a.x>b.x?1:-1)
112
+ // });
113
+ }
114
+ } //clipAxisMode如果是auto根据clipDifferenceValue设置clipValue
115
+
97
116
 
98
117
  return axes.map(function (item) {
99
118
  var axisType = item.axisType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.5.11",
3
+ "version": "1.5.13",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -238,6 +238,8 @@ const Label: (
238
238
  style={{
239
239
  ..._style,
240
240
  ...getFontStyle(font),
241
+ /** Safari Bug **/
242
+ position:"fixed"
241
243
  }}
242
244
  >
243
245
  <TextOverflow
@@ -227,7 +227,7 @@ export default memo(
227
227
  width: "100%",
228
228
  height: "100%",
229
229
  /** Safari Bug **/
230
- position: "fixed",
230
+ // position: "fixed",
231
231
  clipPath: setClipPath(),
232
232
  opacity: fillType == "pattern" ? opacity : 1,
233
233
  background:
@@ -414,6 +414,7 @@ const Chart = memo(
414
414
  ref={seriesEl}
415
415
  style={{
416
416
  overflow: "visible",
417
+ position: "fixed",
417
418
  transform: isVertical
418
419
  ? `translateX(${marginRight}px)`
419
420
  : `translateY(${marginTop}px)`,
@@ -102,20 +102,20 @@ const Chart = memo(
102
102
  }
103
103
  },[]);
104
104
 
105
- //对轴类图表进行
106
105
  let data = originData;
107
- if(axes){
108
- const xAxis = axes.find(d=>d.axisType=="x");
109
- if(xAxis){
110
- const { config:{ label:{ autoSort, format:{ type } } } } = xAxis;
111
- if(type=="date" && autoSort){
112
- const groupBySeries = group(data, (d) => d.s);
113
- data=[...groupBySeries].flatMap(d=>{
114
- return d[1].sort((a,b)=>a.x>b.x?1:-1)
115
- });
116
- }
117
- }
118
- }
106
+ //对轴类图表进行自动排序
107
+ // if(axes){
108
+ // const xAxis = axes.find(d=>d.axisType=="x");
109
+ // if(xAxis){
110
+ // const { config:{ label:{ autoSort, format:{ type } } } } = xAxis;
111
+ // if(type=="date" && autoSort){
112
+ // const groupBySeries = group(data, (d) => d.s);
113
+ // data=[...groupBySeries].flatMap(d=>{
114
+ // return d[1].sort((a,b)=>a.x>b.x?1:-1)
115
+ // });
116
+ // }
117
+ // }
118
+ // }
119
119
 
120
120
  return (
121
121
  <chartContext.Provider value={context}>
@@ -4,8 +4,8 @@
4
4
  import { memo } from 'react';
5
5
  import { useExtentData } from '../hooks';
6
6
  export default (Component) =>
7
- memo(({ config: { axes, series, ...config }, data, ...props }) => (
8
- <Component
7
+ memo(({ config: { axes, series, ...config }, data, ...props }) => {
8
+ return <Component
9
9
  {...props}
10
10
  config={{
11
11
  ...config,
@@ -14,4 +14,5 @@ export default (Component) =>
14
14
  }}
15
15
  data={data}
16
16
  />
17
- ));
17
+ }
18
+ );
@@ -18,7 +18,7 @@ const isValidData = (data) =>
18
18
  Object.prototype.toString.call(obj) === '[object Object]' &&
19
19
  Object.keys(obj).length !== 0
20
20
  ).length > 0
21
- );
21
+ );
22
22
 
23
23
  export default (Component) =>
24
24
  memo(({ config: { series, ...config }, data: originData, ...rest }) => {
@@ -47,8 +47,7 @@ export default (Component) =>
47
47
  data.forEach(({ key }) => {
48
48
  const current = series.find(({ fieldName }) => fieldName == key);
49
49
  const result = current || lastSeries;
50
- const name =
51
- (current ? current.fieldName || current.displayName : key) || '';
50
+ const name = (current ? current.fieldName || current.displayName : key) || '';
52
51
  tmp.set(name, {
53
52
  ...result,
54
53
  name,
@@ -57,10 +57,20 @@ export default ({ axes, series, data }) => {
57
57
  () => dataYOrZ(data, _series),
58
58
  [data, _series]
59
59
  );
60
-
61
60
  const x = useMemo(() => [...group(data, (d) => d.x).keys()], [data]);
62
61
  const y = stackData(dataY, _series.y);
63
62
  const z = stackData(dataZ, _series.z);
63
+ const xAxis = axes.find(d=>d.axisType=="x");
64
+ if(xAxis){
65
+ const { config:{ label:{ autoSort, format:{ type } } } } = xAxis;
66
+ if(type=="date" && autoSort){
67
+ x.sort((a,b)=>a>b?1:-1);
68
+ // const groupBySeries = group(data, (d) => d.s);
69
+ // data=[...groupBySeries].flatMap(d=>{
70
+ // return d[1].sort((a,b)=>a.x>b.x?1:-1)
71
+ // });
72
+ }
73
+ }
64
74
  //clipAxisMode如果是auto根据clipDifferenceValue设置clipValue
65
75
  return axes.map((item) => {
66
76
  const { axisType, domain, type } = item;