@easyv/charts 1.3.8 → 1.3.10

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.
@@ -102,6 +102,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
102
102
  showHighlight = _ref3$config$highligh.show,
103
103
  extent = _ref3$config$highligh.extent,
104
104
  highlightFill = _ref3$config$highligh.fill,
105
+ headDecorate = _ref3$config.headDecorate,
105
106
  _ref3$bandLength = _ref3.bandLength,
106
107
  bandLength = _ref3$bandLength === void 0 ? 0 : _ref3$bandLength,
107
108
  data = _ref3.data,
@@ -142,6 +143,12 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
142
143
  var y1 = yScaler(isVertical ? end : start);
143
144
  var y2 = yScaler(isVertical ? start : end);
144
145
  var positionX = xScaler(x) - step / 2 + seriesStart + index * seriesStep;
146
+ var showHead, headUrl, headWidth, headHeight, headTranslate;
147
+
148
+ if (headDecorate) {
149
+ showHead = headDecorate.show, headUrl = headDecorate.url, headWidth = headDecorate.size.width, headHeight = headDecorate.size.height, headTranslate = headDecorate.headTranslate;
150
+ }
151
+
145
152
  if (isNaN(positionX)) return null;
146
153
  var positionY = y < 0 ? y1 : y2;
147
154
  var attr = getAttr({
@@ -152,10 +159,24 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
152
159
  seriesWidth: seriesWidth
153
160
  });
154
161
  return /*#__PURE__*/_react["default"].createElement("foreignObject", (0, _extends2["default"])({
155
- key: i
162
+ key: i,
163
+ style: {
164
+ overflow: "visible",
165
+ position: "relative"
166
+ }
156
167
  }, attr, {
157
168
  onClick: triggerClick,
158
169
  "data-data": JSON.stringify(data)
170
+ }), headUrl && showHead && /*#__PURE__*/_react["default"].createElement("div", {
171
+ style: {
172
+ position: "absolute",
173
+ background: "url(".concat(window.appConfig.ASSETS_URL + headUrl, ") 0 0/100% 100%"),
174
+ width: headWidth,
175
+ height: headHeight,
176
+ left: "50%",
177
+ zIndex: 1,
178
+ transform: "translate(calc(-50% + ".concat(headTranslate.x, "px), ").concat(headTranslate.y, "px)")
179
+ }
159
180
  }), /*#__PURE__*/_react["default"].createElement("div", {
160
181
  style: {
161
182
  width: '100%',
@@ -136,7 +136,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
136
136
  axis: axisX,
137
137
  config: background,
138
138
  bandLength: bandLength
139
- }), (0, _toConsumableArray2["default"])(axes.values()).map(function (item, index) {
139
+ }), (0, _toConsumableArray2["default"])(axes.values()).reverse().map(function (item, index) {
140
140
  var config = item.axisType == 'x' ? axisX : item;
141
141
  return /*#__PURE__*/_react["default"].createElement(_.Axis, (0, _extends2["default"])({
142
142
  triggerClick: onInteraction
@@ -49,17 +49,18 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
49
49
 
50
50
  var _useContext = (0, _react.useContext)(_context.chartContext),
51
51
  width = _useContext.width,
52
- height = _useContext.height; // const { seriesStep, seriesWidth, seriesStart } = getSeriesInfo({
53
- // step,
54
- // bandLength,
55
- // paddingInner,
56
- // paddingOuter,
57
- // });
52
+ height = _useContext.height;
53
+
54
+ var _getSeriesInfo = (0, _utils.getSeriesInfo)({
55
+ step: step,
56
+ bandLength: bandLength,
57
+ paddingInner: paddingInner,
58
+ paddingOuter: paddingOuter
59
+ }),
60
+ seriesStep = _getSeriesInfo.seriesStep,
61
+ seriesWidth = _getSeriesInfo.seriesWidth,
62
+ seriesStart = _getSeriesInfo.seriesStart;
58
63
 
59
-
60
- var seriesStep = (1 + paddingInner) * step,
61
- seriesWidth = step,
62
- seriesStart = paddingOuter * step;
63
64
  var isVertical = direction === 'vertical';
64
65
  var _position = label.position;
65
66
  return /*#__PURE__*/React.createElement("g", {
@@ -120,6 +120,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref6) {
120
120
  curve = _ref6$config$line.curve,
121
121
  tension = _ref6$config$line.tension,
122
122
  connectNulls = _ref6$config$line.connectNulls,
123
+ lineShadow = _ref6$config$line.lineShadow,
123
124
  lighter = _ref6$config$line.lighter,
124
125
  _ref6$line = _ref6.line,
125
126
  lineId = _ref6$line.id,
@@ -169,11 +170,16 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref6) {
169
170
  }, [direction, xScaler, yScaler, tension, curve]);
170
171
  var path = lineGen(_data);
171
172
  var showLighter = lighter && lighter.show;
173
+ var show = lineShadow && lineShadow.show;
174
+ var shadow = lineShadow && lineShadow.shadow;
172
175
  return /*#__PURE__*/_react["default"].createElement("g", {
173
176
  className: "__easyv-line"
174
177
  }, /*#__PURE__*/_react["default"].createElement("path", {
175
178
  d: path,
176
179
  stroke: stroke,
180
+ style: {
181
+ filter: show ? "drop-shadow(".concat(shadow.hShadow, "px ").concat(shadow.vShadow, "px ").concat(shadow.blur, "px ").concat(shadow.color, ")") : "none"
182
+ },
177
183
  fill: "none",
178
184
  strokeDasharray: lineType === 'dash' ? '3 3' : null,
179
185
  strokeWidth: lineWidth
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -89,8 +89,8 @@ const getLayout: (
89
89
  }
90
90
  };
91
91
  const AxisLine: ({
92
- orientation: Orientation,
93
- config: ChartLine,
92
+ orientation,
93
+ config,
94
94
  }: any) => ReactComponentElement<ComponentType> | null = ({
95
95
  orientation = defaultOrientation,
96
96
  config: { show, color, lineWidth },
@@ -108,11 +108,11 @@ const AxisLine: ({
108
108
 
109
109
  const Unit: ({
110
110
  config: {
111
- show: boolean,
112
- text: string,
113
- font: Font,
114
- translate: Translate,
115
- align: Align,
111
+ show,
112
+ text,
113
+ font,
114
+ translate,
115
+ align,
116
116
  },
117
117
  }: any) => ReactComponentElement<ComponentType> | null = ({
118
118
  config: {
@@ -78,6 +78,7 @@ export default memo(
78
78
  fill,
79
79
  opacity,
80
80
  highlight: { show: showHighlight, extent, fill: highlightFill },
81
+ headDecorate
81
82
  },
82
83
  bandLength = 0,
83
84
  data,
@@ -115,6 +116,15 @@ export default memo(
115
116
  const positionX =
116
117
  xScaler(x) - step / 2 + seriesStart + index * seriesStep;
117
118
 
119
+ let showHead , headUrl, headWidth, headHeight, headTranslate;
120
+ if(headDecorate){
121
+ showHead = headDecorate.show,
122
+ headUrl = headDecorate.url,
123
+ headWidth = headDecorate.size.width,
124
+ headHeight = headDecorate.size.height,
125
+ headTranslate = headDecorate.headTranslate;
126
+ }
127
+
118
128
  if (isNaN(positionX)) return null;
119
129
  const positionY = y < 0 ? y1 : y2;
120
130
  const attr = getAttr({
@@ -124,14 +134,26 @@ export default memo(
124
134
  length: Math.abs(y1 - y2),
125
135
  seriesWidth,
126
136
  });
127
-
128
137
  return (
129
138
  <foreignObject
130
139
  key={i}
140
+ style={{
141
+ overflow:"visible",
142
+ position:"relative"
143
+ }}
131
144
  {...attr}
132
145
  onClick={triggerClick}
133
146
  data-data={JSON.stringify(data)}
134
147
  >
148
+ {headUrl && showHead && <div style={{
149
+ position:"absolute",
150
+ background:`url(${window.appConfig.ASSETS_URL+headUrl}) 0 0/100% 100%`,
151
+ width:headWidth,
152
+ height:headHeight,
153
+ left:"50%",
154
+ zIndex:1,
155
+ transform:`translate(calc(-50% + ${headTranslate.x}px), ${headTranslate.y}px)`
156
+ }}></div>}
135
157
  <div
136
158
  style={{
137
159
  width: '100%',
@@ -138,7 +138,8 @@ const Chart = memo(
138
138
  bandLength={bandLength}
139
139
  />
140
140
  )}
141
- {[...axes.values()].map((item, index) => {
141
+
142
+ {[...axes.values()].reverse().map((item, index) => {
142
143
  const config = item.axisType == 'x' ? axisX : item;
143
144
  return (
144
145
  <Axis triggerClick={onInteraction} {...config} key={index} />
@@ -146,6 +147,7 @@ const Chart = memo(
146
147
  })}
147
148
 
148
149
  {showTooltip && <Indicator {...indicator} {...indicatorAttr} />}
150
+
149
151
  {series.map(({ Component, yOrZ, ...config }, index) => {
150
152
  const yAxis = axes.get(yOrZ);
151
153
  return (
@@ -27,15 +27,13 @@ export default memo(
27
27
  if (!(data.length && (showIcon || showLabel))) return null;
28
28
  const { width, height } = useContext(chartContext);
29
29
 
30
- // const { seriesStep, seriesWidth, seriesStart } = getSeriesInfo({
31
- // step,
32
- // bandLength,
33
- // paddingInner,
34
- // paddingOuter,
35
- // });
30
+ const { seriesStep, seriesWidth, seriesStart } = getSeriesInfo({
31
+ step,
32
+ bandLength,
33
+ paddingInner,
34
+ paddingOuter,
35
+ });
36
36
 
37
- const seriesStep = (1 + paddingInner) * step,
38
- seriesWidth = step, seriesStart = paddingOuter * step;
39
37
  const isVertical = direction === 'vertical';
40
38
  const _position = label.position;
41
39
  return (
@@ -72,6 +72,7 @@ export default memo(
72
72
  curve,
73
73
  tension,
74
74
  connectNulls,
75
+ lineShadow,
75
76
  lighter,
76
77
  },
77
78
  // icon,
@@ -119,13 +120,17 @@ export default memo(
119
120
  }, [direction, xScaler, yScaler, tension, curve]);
120
121
 
121
122
  const path = lineGen(_data);
122
-
123
123
  const showLighter = lighter && lighter.show;
124
+ const show = lineShadow && lineShadow.show;
125
+ const shadow = lineShadow && lineShadow.shadow;
124
126
  return (
125
127
  <g className='__easyv-line'>
126
128
  <path
127
129
  d={path}
128
130
  stroke={stroke}
131
+ style={{
132
+ filter:show?`drop-shadow(${shadow.hShadow}px ${shadow.vShadow}px ${shadow.blur}px ${shadow.color})`:"none"
133
+ }}
129
134
  fill='none'
130
135
  strokeDasharray={lineType === 'dash' ? '3 3' : null}
131
136
  strokeWidth={lineWidth}