@devexpress/dx-chart-core
Advanced tools
Comparing version 2.0.1 to 2.0.2
/** | ||
* Bundle of @devexpress/dx-chart-core | ||
* Generated: 2019-07-19 | ||
* Version: 2.0.1 | ||
* Generated: 2019-08-01 | ||
* Version: 2.0.2 | ||
* License: https://js.devexpress.com/Licensing | ||
@@ -221,22 +221,47 @@ */ | ||
}; | ||
// Defines how much linear scale can be zoomed it. | ||
// I.e. if original scale domain has size of 1, then fully zoomed scale domain has size | ||
// of 1 / LINEAR_SCALE_ZOOMING_THRESHOLD. | ||
var LINEAR_SCALE_ZOOMING_THRESHOLD = 1000; | ||
var growLinearScaleBounds = function (scale, bounds, delta, anchor) { | ||
var fullRange = scale.range(); | ||
var minRangeThreshold = (fullRange[1] - fullRange[0]) / LINEAR_SCALE_ZOOMING_THRESHOLD; | ||
var sign = Math.sign(fullRange[1] - fullRange[0]); | ||
var range = scaleBounds(scale, bounds); | ||
// If zooming in and initial range is already too small then do nothing. | ||
if (delta > 0 && Math.abs(range[1] - range[0]) <= Math.abs(minRangeThreshold)) { | ||
return bounds; | ||
} | ||
// If zooming out and initial range is already too large then do nothing. | ||
if (delta < 0 && Math.abs(range[1] - range[0]) >= Math.abs(fullRange[1] - fullRange[0])) { | ||
return bounds; | ||
} | ||
var t = Math.abs((anchor - range[0]) / (range[1] - range[0])); | ||
var r0 = range[0] + sign * delta * 2 * t; | ||
var r1 = range[1] - sign * delta * 2 * (1 - t); | ||
// Check if new range is outside of the left border. | ||
// If new range is outside of the left border then clamp it. | ||
if (Math.sign(r0 - fullRange[0]) !== sign) { | ||
r0 = fullRange[0]; | ||
} | ||
// Check if new range is outside of the right border. | ||
// If new range is outside of the right border then clamp it. | ||
if (Math.sign(fullRange[1] - r1) !== sign) { | ||
r1 = fullRange[1]; | ||
} | ||
var minRangeThreshold = (fullRange[1] - fullRange[0]) / 100; | ||
// Check if new range is too small. | ||
// If new range is too small then make it no less than minimal available. | ||
if (Math.sign(r1 - r0) !== sign || Math.abs(r1 - r0) < Math.abs(minRangeThreshold)) { | ||
r0 = anchor - minRangeThreshold / 2; | ||
r1 = anchor + minRangeThreshold / 2; | ||
if (Math.abs(r0 - range[0]) < Math.abs(minRangeThreshold / 2)) { | ||
// Dock it to the start. | ||
r0 = range[0]; | ||
r1 = r0 + minRangeThreshold; | ||
} | ||
else if (Math.abs(r1 - range[1]) < Math.abs(minRangeThreshold / 2)) { | ||
// Dock it to the end. | ||
r1 = range[1]; | ||
r0 = r1 - minRangeThreshold; | ||
} | ||
else { | ||
// Dock it to the anchor. | ||
r0 = anchor - minRangeThreshold / 2; | ||
r1 = anchor + minRangeThreshold / 2; | ||
} | ||
} | ||
@@ -243,0 +268,0 @@ var newBounds = [scale.invert(r0), scale.invert(r1)]; |
{ | ||
"name": "@devexpress/dx-chart-core", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Core library for the DevExtreme Reactive Chart component", | ||
@@ -51,3 +51,3 @@ "author": { | ||
"rollup-plugin-replace": "^2.2.0", | ||
"rollup-plugin-typescript2": "^0.22.0", | ||
"rollup-plugin-typescript2": "^0.22.1", | ||
"ts-jest": "^24.0.2", | ||
@@ -60,6 +60,6 @@ "tslint": "^5.18.0", | ||
"d3-array": "^2.2.0", | ||
"d3-scale": "^3.0.0", | ||
"d3-scale": "^3.0.1", | ||
"d3-shape": "^1.3.5" | ||
}, | ||
"gitHead": "7bb662371274270b29ed478ec6750649eb92c80d" | ||
"gitHead": "781df644dad87a3308ced4a4bbb25e077d9cf094" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
377296
2953
Updatedd3-scale@^3.0.1