123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- var clazzUtil = require("../util/clazz");
- function Scale(setting) {
- this._setting = setting || {};
-
- this._extent = [Infinity, -Infinity];
-
- this._interval = 0;
- this.init && this.init.apply(this, arguments);
- }
- Scale.prototype.parse = function (val) {
-
-
-
-
- return val;
- };
- Scale.prototype.getSetting = function (name) {
- return this._setting[name];
- };
- Scale.prototype.contain = function (val) {
- var extent = this._extent;
- return val >= extent[0] && val <= extent[1];
- };
- Scale.prototype.normalize = function (val) {
- var extent = this._extent;
- if (extent[1] === extent[0]) {
- return 0.5;
- }
- return (val - extent[0]) / (extent[1] - extent[0]);
- };
- Scale.prototype.scale = function (val) {
- var extent = this._extent;
- return val * (extent[1] - extent[0]) + extent[0];
- };
- Scale.prototype.unionExtent = function (other) {
- var extent = this._extent;
- other[0] < extent[0] && (extent[0] = other[0]);
- other[1] > extent[1] && (extent[1] = other[1]);
-
- };
- Scale.prototype.unionExtentFromData = function (data, dim) {
- this.unionExtent(data.getApproximateExtent(dim));
- };
- Scale.prototype.getExtent = function () {
- return this._extent.slice();
- };
- Scale.prototype.setExtent = function (start, end) {
- var thisExtent = this._extent;
- if (!isNaN(start)) {
- thisExtent[0] = start;
- }
- if (!isNaN(end)) {
- thisExtent[1] = end;
- }
- };
- Scale.prototype.isBlank = function () {
- return this._isBlank;
- },
- Scale.prototype.setBlank = function (isBlank) {
- this._isBlank = isBlank;
- };
- Scale.prototype.getLabel = null;
- clazzUtil.enableClassExtend(Scale);
- clazzUtil.enableClassManagement(Scale, {
- registerWhenExtend: true
- });
- var _default = Scale;
- module.exports = _default;
|