From 33a182bb6d5c302dd7e29cd42ad3e0ae43c1e631 Mon Sep 17 00:00:00 2001 From: MiniPear Date: Thu, 22 Sep 2022 19:57:35 +0800 Subject: [PATCH] fix(sqrt): set tick method to d3Ticks (#196) * fix: set the tickMethod of sqrt to d3Ticks * chore: update version to 0.4.11 --- __tests__/unit/scales/sqrt.spec.ts | 3 ++- package.json | 2 +- src/scales/sqrt.ts | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/__tests__/unit/scales/sqrt.spec.ts b/__tests__/unit/scales/sqrt.spec.ts index 36eb86f8..d7a4b176 100644 --- a/__tests__/unit/scales/sqrt.spec.ts +++ b/__tests__/unit/scales/sqrt.spec.ts @@ -1,4 +1,4 @@ -import { Sqrt } from '../../../src'; +import { d3Ticks, Sqrt } from '../../../src'; describe('sqrt scale test', () => { // 父类对于 0.5 的特殊值我们是使用 Math.sqrt API, 这已经在父类测试过了,没必要再添加额外的测试 @@ -7,6 +7,7 @@ describe('sqrt scale test', () => { // 我们继承了 pow 类,只修改了一个选项,剩余选项的测试应该在父类体现 expect(sqrt.getOptions().exponent).toStrictEqual(0.5); + expect(sqrt.getOptions().tickMethod).toBe(d3Ticks); }); test('test update', () => { diff --git a/package.json b/package.json index 97f04533..a41d71d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@antv/scale", - "version": "0.4.10", + "version": "0.4.11", "description": "Toolkit for mapping abstract data into visual representation.", "license": "MIT", "main": "lib/index.js", diff --git a/src/scales/sqrt.ts b/src/scales/sqrt.ts index 76afb8ca..a47be635 100644 --- a/src/scales/sqrt.ts +++ b/src/scales/sqrt.ts @@ -1,7 +1,7 @@ import { createInterpolateValue } from '../utils'; -import { rPretty } from '../tick-methods/r-pretty'; import { SqrtOptions, PowOptions } from '../types'; import { Pow } from './pow'; +import { d3Ticks } from '../tick-methods/d3-ticks'; export class Sqrt extends Pow { protected getDefaultOptions() { @@ -12,7 +12,7 @@ export class Sqrt extends Pow { clamp: false, round: false, interpolate: createInterpolateValue, - tickMethod: rPretty, + tickMethod: d3Ticks, tickCount: 5, exponent: 0.5, };