New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@antv/scale

Package Overview
Dependencies
Maintainers
23
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/scale - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

2

esm/base.d.ts

@@ -49,2 +49,4 @@ export declare type ScaleType = 'base' | 'linear' | 'cat' | 'log' | 'pow' | 'identity' | 'time' | 'timeCat';

tickCount: number;
/** ticks最大值,默认值为10 */
maxTickCount: number;
/** tick格式化函数,会影响数据在坐标轴 axis、图例 legend、tooltip 上的显示 */

@@ -51,0 +53,0 @@ formatter: (v: any, k?: number) => string;

4

esm/category.js

@@ -69,5 +69,5 @@ import { __extends, __spreadArrays } from "tslib";

// 简单过滤,部分情况下小数的倍数也可以是整数
var Q_1 = ALL_Q.filter(function (n) { return Number.isInteger(n); });
var Q = ALL_Q.filter(function (n) { return Number.isInteger(n); });
// tslint:disable-next-line: no-shadowed-variable
var ticks_1 = extended(this.min, this.max, this.tickCount, false, Q_1).ticks;
var ticks_1 = extended(this.min, this.max, this.tickCount, false, Q).ticks;
var valid = _.filter(ticks_1, function (tick) { return tick >= _this.min && tick <= _this.max; });

@@ -74,0 +74,0 @@ return valid.map(function (index) { return _this.values[index]; });

@@ -8,3 +8,3 @@ import Base from './base';

export default class Identity extends Base {
readonly _unknown: any;
get _unknown(): any;
isIdentity: boolean;

@@ -11,0 +11,0 @@ values: number[];

@@ -11,2 +11,3 @@ import Base, { ScaleConfig, ScaleType } from './base';

tickCount?: ScaleConfig['tickCount'];
maxTickCount?: ScaleConfig['maxTickCount'];
minTickInterval?: ScaleConfig['minTickInterval'];

@@ -13,0 +14,0 @@ nice?: ScaleConfig['nice'];

@@ -41,2 +41,3 @@ import { __extends } from "tslib";

this.tickCount = 5;
this.maxTickCount = 10;
};

@@ -71,2 +72,3 @@ Linear.prototype._init = function () {

var adjustTicks = [];
var tickCnt = m;
var minLimit = this.minLimit;

@@ -92,23 +94,35 @@ var maxLimit = this.maxLimit;

}
var _d = extended(tickMin, tickMax, m, onlyLoose, Q, w), min = _d.min, max = _d.max, ticks = _d.ticks;
if (this.nice) {
this.min = min;
this.max = max;
}
// 修正min/max
if (!_.isNil(minLimit)) {
this.min = minLimit;
}
if (!_.isNil(maxLimit)) {
this.max = maxLimit;
}
adjustTicks.push(this.min);
_.each(ticks, function (tick) {
if (tick > _this.min && tick < _this.max) {
adjustTicks.push(tick);
do {
var _d = extended(tickMin, tickMax, tickCnt, onlyLoose, Q, w), min = _d.min, max = _d.max, ticks = _d.ticks;
adjustTicks = [];
if (this.nice) {
this.min = min;
this.max = max;
}
});
if (adjustTicks[adjustTicks.length - 1] < this.max) {
adjustTicks.push(this.max);
}
// 修正min/max
if (!_.isNil(minLimit)) {
this.min = minLimit;
}
if (!_.isNil(maxLimit)) {
this.max = maxLimit;
}
adjustTicks.push(this.min);
_.each(ticks, function (tick) {
if (tick > _this.min && tick < _this.max) {
adjustTicks.push(tick);
}
});
if (adjustTicks[adjustTicks.length - 1] < this.max) {
adjustTicks.push(this.max);
}
// 如果没有设置 minLimit/maxLimit,就不循环
if (_.isNil(minLimit) && _.isNil(maxLimit)) {
break;
}
// 效果是否已经很好了
if (ticks.indexOf(this.min) >= 0 && ticks.indexOf(this.max) >= 0) {
break;
}
tickCnt += 1;
} while (tickCnt < this.maxTickCount);
return adjustTicks;

@@ -115,0 +129,0 @@ };

@@ -49,2 +49,4 @@ export declare type ScaleType = 'base' | 'linear' | 'cat' | 'log' | 'pow' | 'identity' | 'time' | 'timeCat';

tickCount: number;
/** ticks最大值,默认值为10 */
maxTickCount: number;
/** tick格式化函数,会影响数据在坐标轴 axis、图例 legend、tooltip 上的显示 */

@@ -51,0 +53,0 @@ formatter: (v: any, k?: number) => string;

@@ -71,5 +71,5 @@ "use strict";

// 简单过滤,部分情况下小数的倍数也可以是整数
var Q_1 = extended_1.ALL_Q.filter(function (n) { return Number.isInteger(n); });
var Q = extended_1.ALL_Q.filter(function (n) { return Number.isInteger(n); });
// tslint:disable-next-line: no-shadowed-variable
var ticks_1 = extended_1.default(this.min, this.max, this.tickCount, false, Q_1).ticks;
var ticks_1 = extended_1.default(this.min, this.max, this.tickCount, false, Q).ticks;
var valid = _.filter(ticks_1, function (tick) { return tick >= _this.min && tick <= _this.max; });

@@ -76,0 +76,0 @@ return valid.map(function (index) { return _this.values[index]; });

@@ -8,3 +8,3 @@ import Base from './base';

export default class Identity extends Base {
readonly _unknown: any;
get _unknown(): any;
isIdentity: boolean;

@@ -11,0 +11,0 @@ values: number[];

@@ -11,2 +11,3 @@ import Base, { ScaleConfig, ScaleType } from './base';

tickCount?: ScaleConfig['tickCount'];
maxTickCount?: ScaleConfig['maxTickCount'];
minTickInterval?: ScaleConfig['minTickInterval'];

@@ -13,0 +14,0 @@ nice?: ScaleConfig['nice'];

@@ -43,2 +43,3 @@ "use strict";

this.tickCount = 5;
this.maxTickCount = 10;
};

@@ -73,2 +74,3 @@ Linear.prototype._init = function () {

var adjustTicks = [];
var tickCnt = m;
var minLimit = this.minLimit;

@@ -94,23 +96,35 @@ var maxLimit = this.maxLimit;

}
var _d = extended_1.default(tickMin, tickMax, m, onlyLoose, Q, w), min = _d.min, max = _d.max, ticks = _d.ticks;
if (this.nice) {
this.min = min;
this.max = max;
}
// 修正min/max
if (!_.isNil(minLimit)) {
this.min = minLimit;
}
if (!_.isNil(maxLimit)) {
this.max = maxLimit;
}
adjustTicks.push(this.min);
_.each(ticks, function (tick) {
if (tick > _this.min && tick < _this.max) {
adjustTicks.push(tick);
do {
var _d = extended_1.default(tickMin, tickMax, tickCnt, onlyLoose, Q, w), min = _d.min, max = _d.max, ticks = _d.ticks;
adjustTicks = [];
if (this.nice) {
this.min = min;
this.max = max;
}
});
if (adjustTicks[adjustTicks.length - 1] < this.max) {
adjustTicks.push(this.max);
}
// 修正min/max
if (!_.isNil(minLimit)) {
this.min = minLimit;
}
if (!_.isNil(maxLimit)) {
this.max = maxLimit;
}
adjustTicks.push(this.min);
_.each(ticks, function (tick) {
if (tick > _this.min && tick < _this.max) {
adjustTicks.push(tick);
}
});
if (adjustTicks[adjustTicks.length - 1] < this.max) {
adjustTicks.push(this.max);
}
// 如果没有设置 minLimit/maxLimit,就不循环
if (_.isNil(minLimit) && _.isNil(maxLimit)) {
break;
}
// 效果是否已经很好了
if (ticks.indexOf(this.min) >= 0 && ticks.indexOf(this.max) >= 0) {
break;
}
tickCnt += 1;
} while (tickCnt < this.maxTickCount);
return adjustTicks;

@@ -117,0 +131,0 @@ };

{
"name": "@antv/scale",
"version": "0.2.1",
"version": "0.2.2",
"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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc