@progress/kendo-charts 2.12.2 → 2.12.3-develop.1

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.
@@ -153,7 +153,6 @@ class CurveProcessor {
153
153
  controlPoints(p0, p1, p2) {
154
154
  let xField = X;
155
155
  let yField = Y;
156
- let restrict = false;
157
156
  let switchOrientation = false;
158
157
  let tangent;
159
158
 
@@ -166,8 +165,11 @@ class CurveProcessor {
166
165
  };
167
166
 
168
167
  if (monotonic.x && monotonic.y) {
169
- tangent = this.tangent(p0, p2, X, Y);
170
- restrict = true;
168
+ const h0 = p1[xField] - p0[xField];
169
+ const h1 = p2[xField] - p1[xField];
170
+ const d0 = (p1[yField] - p0[yField]) / h0;
171
+ const d1 = (p2[yField] - p1[yField]) / h1;
172
+ tangent = 3 * (h0 + h1) / ((2 * h1 + h0) / d0 + (h1 + 2 * h0) / d1);
171
173
  } else {
172
174
  if (this.invertAxis(p0, p1, p2)) {
173
175
  xField = Y;
@@ -201,34 +203,9 @@ class CurveProcessor {
201
203
 
202
204
  const firstControlPoint = this.firstControlPoint(tangent, p1, p2, xField, yField);
203
205
 
204
- if (restrict) {
205
- this.restrictControlPoint(p0, p1, secondControlPoint, tangent);
206
- this.restrictControlPoint(p1, p2, firstControlPoint, tangent);
207
- }
208
-
209
206
  return [ secondControlPoint, firstControlPoint ];
210
207
  }
211
208
 
212
- restrictControlPoint(p1, p2, cp, tangent) {
213
- if (p1.y < p2.y) {
214
- if (p2.y < cp.y) {
215
- cp.x = p1.x + (p2.y - p1.y) / tangent;
216
- cp.y = p2.y;
217
- } else if (cp.y < p1.y) {
218
- cp.x = p2.x - (p2.y - p1.y) / tangent;
219
- cp.y = p1.y;
220
- }
221
- } else {
222
- if (cp.y < p2.y) {
223
- cp.x = p1.x - (p1.y - p2.y) / tangent;
224
- cp.y = p2.y;
225
- } else if (p1.y < cp.y) {
226
- cp.x = p2.x + (p1.y - p2.y) / tangent;
227
- cp.y = p1.y;
228
- }
229
- }
230
- }
231
-
232
209
  tangent(p0, p1, xField, yField) {
233
210
  const x = p1[xField] - p0[xField];
234
211
  const y = p1[yField] - p0[yField];
@@ -287,4 +264,4 @@ function numberSign(value) {
287
264
  return value <= 0 ? -1 : 1;
288
265
  }
289
266
 
290
- export default CurveProcessor;
267
+ export default CurveProcessor;
@@ -153,7 +153,6 @@ class CurveProcessor {
153
153
  controlPoints(p0, p1, p2) {
154
154
  let xField = X;
155
155
  let yField = Y;
156
- let restrict = false;
157
156
  let switchOrientation = false;
158
157
  let tangent;
159
158
 
@@ -166,8 +165,11 @@ class CurveProcessor {
166
165
  };
167
166
 
168
167
  if (monotonic.x && monotonic.y) {
169
- tangent = this.tangent(p0, p2, X, Y);
170
- restrict = true;
168
+ const h0 = p1[xField] - p0[xField];
169
+ const h1 = p2[xField] - p1[xField];
170
+ const d0 = (p1[yField] - p0[yField]) / h0;
171
+ const d1 = (p2[yField] - p1[yField]) / h1;
172
+ tangent = 3 * (h0 + h1) / ((2 * h1 + h0) / d0 + (h1 + 2 * h0) / d1);
171
173
  } else {
172
174
  if (this.invertAxis(p0, p1, p2)) {
173
175
  xField = Y;
@@ -201,34 +203,9 @@ class CurveProcessor {
201
203
 
202
204
  const firstControlPoint = this.firstControlPoint(tangent, p1, p2, xField, yField);
203
205
 
204
- if (restrict) {
205
- this.restrictControlPoint(p0, p1, secondControlPoint, tangent);
206
- this.restrictControlPoint(p1, p2, firstControlPoint, tangent);
207
- }
208
-
209
206
  return [ secondControlPoint, firstControlPoint ];
210
207
  }
211
208
 
212
- restrictControlPoint(p1, p2, cp, tangent) {
213
- if (p1.y < p2.y) {
214
- if (p2.y < cp.y) {
215
- cp.x = p1.x + (p2.y - p1.y) / tangent;
216
- cp.y = p2.y;
217
- } else if (cp.y < p1.y) {
218
- cp.x = p2.x - (p2.y - p1.y) / tangent;
219
- cp.y = p1.y;
220
- }
221
- } else {
222
- if (cp.y < p2.y) {
223
- cp.x = p1.x - (p1.y - p2.y) / tangent;
224
- cp.y = p2.y;
225
- } else if (p1.y < cp.y) {
226
- cp.x = p2.x + (p1.y - p2.y) / tangent;
227
- cp.y = p1.y;
228
- }
229
- }
230
- }
231
-
232
209
  tangent(p0, p1, xField, yField) {
233
210
  const x = p1[xField] - p0[xField];
234
211
  const y = p1[yField] - p0[yField];
@@ -287,4 +264,4 @@ function numberSign(value) {
287
264
  return value <= 0 ? -1 : 1;
288
265
  }
289
266
 
290
- export default CurveProcessor;
267
+ export default CurveProcessor;