@easyv/charts 1.5.11 → 1.5.12
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/Chart.js
CHANGED
|
@@ -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
|
-
|
|
133
|
-
|
|
134
|
-
if
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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);
|
|
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
package/src/components/Chart.js
CHANGED
|
@@ -102,20 +102,20 @@ const Chart = memo(
|
|
|
102
102
|
}
|
|
103
103
|
},[]);
|
|
104
104
|
|
|
105
|
-
//对轴类图表进行
|
|
106
105
|
let data = originData;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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;
|