@easyv/charts 1.6.7 → 1.6.8

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,18 +102,22 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
102
102
  var controlBarWidth = 0;
103
103
  var dragPercent = 1;
104
104
  var controlHeight = 0;
105
+ var controlX = 0;
105
106
 
106
107
  if (control) {
107
108
  var _height = control.height,
108
109
  _control$margin = control.margin,
109
110
  left = _control$margin.left,
110
111
  right = _control$margin.right,
111
- dragWidth = control.drag.width;
112
+ _control$drag = control.drag,
113
+ start = _control$drag.start,
114
+ dragWidth = _control$drag.width;
112
115
  isControl = true;
113
116
  controlHeight = _height;
114
117
  controlWidth = width - left - right;
115
118
  dragPercent = dragWidth / 100;
116
119
  controlBarWidth = controlWidth * dragPercent;
120
+ controlX = (controlWidth - controlBarWidth) * start / 100;
117
121
  }
118
122
 
119
123
  var _useState3 = (0, _react.useState)({
@@ -122,7 +126,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
122
126
  cHeight: controlHeight,
123
127
  cBarWidth: controlBarWidth,
124
128
  cPercent: dragPercent,
125
- cBarX: 0
129
+ cBarX: controlX
126
130
  }),
127
131
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
128
132
  controlInfo = _useState4[0],
@@ -141,7 +145,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
141
145
  cHeight: controlHeight,
142
146
  cBarWidth: controlBarWidth,
143
147
  cPercent: dragPercent,
144
- cBarX: 0
148
+ cBarX: controlX
145
149
  });
146
150
  }, [JSON.stringify(control)]);
147
151
  var svg = (0, _react.useRef)();
@@ -216,7 +216,6 @@ var getTicksOfAxis = function getTicksOfAxis(domain, ticksCount, showLast) {
216
216
  return i % step === 0;
217
217
  });
218
218
  } else {
219
- console.log("noLast");
220
219
  ticksArr = domain.filter(function (d, i) {
221
220
  return i % (step + 1) === 0;
222
221
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.6.7",
3
+ "version": "1.6.8",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -83,15 +83,17 @@ const Chart = memo(
83
83
  let controlBarWidth = 0;
84
84
  let dragPercent = 1;
85
85
  let controlHeight = 0;
86
+ let controlX = 0;
86
87
  if(control){
87
- const { height, margin:{ left, right }, drag:{ width:dragWidth } } = control;
88
+ const { height, margin:{ left, right }, drag:{ start, width:dragWidth } } = control;
88
89
  isControl = true;
89
90
  controlHeight = height;
90
91
  controlWidth = width-left-right;
91
92
  dragPercent = dragWidth/100;
92
93
  controlBarWidth = controlWidth*dragPercent;
94
+ controlX = (controlWidth-controlBarWidth)*start/100
93
95
  }
94
- const [controlInfo, setControlInfo] = useState({ isC:isControl, cWidth:controlWidth, cHeight:controlHeight, cBarWidth:controlBarWidth, cPercent:dragPercent, cBarX:0 });
96
+ const [controlInfo, setControlInfo] = useState({ isC:isControl, cWidth:controlWidth, cHeight:controlHeight, cBarWidth:controlBarWidth, cPercent:dragPercent, cBarX:controlX });
95
97
  const { cWidth, cHeight, cBarWidth, cPercent, cBarX } = controlInfo;
96
98
  yLineRange -= cHeight;
97
99
  useEffect(()=>{
@@ -101,7 +103,7 @@ const Chart = memo(
101
103
  cHeight:controlHeight,
102
104
  cBarWidth:controlBarWidth,
103
105
  cPercent:dragPercent,
104
- cBarX:0
106
+ cBarX:controlX
105
107
  });
106
108
  },[JSON.stringify(control)]);
107
109
 
@@ -172,7 +172,6 @@ const getTicksOfAxis = (domain, ticksCount, showLast) => {
172
172
  return i % step === 0;
173
173
  });
174
174
  }else{
175
- console.log("noLast")
176
175
  ticksArr = domain.filter(function (d, i) {
177
176
  return i % (step + 1) === 0;
178
177
  });