@antv/scale
Advanced tools
Comparing version 0.3.0-beta.4 to 0.3.0-beta.5
@@ -25,3 +25,4 @@ import { __extends, __spreadArrays } from "tslib"; | ||
var order = this.translate(value); | ||
if (order < this.min || order > this.max) { | ||
// 分类数据允许 0.5 范围内调整 | ||
if (order < this.min - 0.5 || order > this.max + 0.5) { | ||
return NaN; | ||
@@ -28,0 +29,0 @@ } |
@@ -10,2 +10,3 @@ import Base from '../base'; | ||
scale(value: any): number; | ||
protected init(): void; | ||
protected setDomain(): void; | ||
@@ -12,0 +13,0 @@ protected calculateTicks(): any[]; |
@@ -29,2 +29,15 @@ import { __extends } from "tslib"; | ||
}; | ||
Continuous.prototype.init = function () { | ||
_super.prototype.init.call(this); | ||
// init 完成后保证 min, max 包含 ticks 的范围 | ||
var ticks = this.ticks; | ||
var firstTick = head(ticks); | ||
var lastTick = last(ticks); | ||
if (firstTick < this.min) { | ||
this.min = firstTick; | ||
} | ||
if (lastTick > this.max) { | ||
this.max = lastTick; | ||
} | ||
}; | ||
Continuous.prototype.setDomain = function () { | ||
@@ -51,12 +64,2 @@ var _a = getRange(this.values), min = _a.min, max = _a.max; | ||
} | ||
else { // nice = true 时,矫正 min ,max | ||
var firstTick = head(ticks); | ||
var lastTick = last(ticks); | ||
if (firstTick < this.min) { | ||
this.min = firstTick; | ||
} | ||
if (lastTick > this.max) { | ||
this.max = lastTick; | ||
} | ||
} | ||
return ticks; | ||
@@ -63,0 +66,0 @@ }; |
@@ -27,3 +27,4 @@ "use strict"; | ||
var order = this.translate(value); | ||
if (order < this.min || order > this.max) { | ||
// 分类数据允许 0.5 范围内调整 | ||
if (order < this.min - 0.5 || order > this.max + 0.5) { | ||
return NaN; | ||
@@ -30,0 +31,0 @@ } |
@@ -10,2 +10,3 @@ import Base from '../base'; | ||
scale(value: any): number; | ||
protected init(): void; | ||
protected setDomain(): void; | ||
@@ -12,0 +13,0 @@ protected calculateTicks(): any[]; |
@@ -31,2 +31,15 @@ "use strict"; | ||
}; | ||
Continuous.prototype.init = function () { | ||
_super.prototype.init.call(this); | ||
// init 完成后保证 min, max 包含 ticks 的范围 | ||
var ticks = this.ticks; | ||
var firstTick = util_1.head(ticks); | ||
var lastTick = util_1.last(ticks); | ||
if (firstTick < this.min) { | ||
this.min = firstTick; | ||
} | ||
if (lastTick > this.max) { | ||
this.max = lastTick; | ||
} | ||
}; | ||
Continuous.prototype.setDomain = function () { | ||
@@ -53,12 +66,2 @@ var _a = util_1.getRange(this.values), min = _a.min, max = _a.max; | ||
} | ||
else { // nice = true 时,矫正 min ,max | ||
var firstTick = util_1.head(ticks); | ||
var lastTick = util_1.last(ticks); | ||
if (firstTick < this.min) { | ||
this.min = firstTick; | ||
} | ||
if (lastTick > this.max) { | ||
this.max = lastTick; | ||
} | ||
} | ||
return ticks; | ||
@@ -65,0 +68,0 @@ }; |
{ | ||
"name": "@antv/scale", | ||
"version": "0.3.0-beta.4", | ||
"version": "0.3.0-beta.5", | ||
"description": "The scale module for G2", | ||
@@ -5,0 +5,0 @@ "author": "https://github.com/orgs/antvis/people", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
219750
3657