Skip to content

Commit

Permalink
fix(sqrt): set tick method to d3Ticks (#196)
Browse files Browse the repository at this point in the history
* fix: set the tickMethod of sqrt to d3Ticks

* chore: update version to 0.4.11
  • Loading branch information
pearmini authored Sep 22, 2022
1 parent 5535fc8 commit 33a182b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion __tests__/unit/scales/sqrt.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Sqrt } from '../../../src';
import { d3Ticks, Sqrt } from '../../../src';

describe('sqrt scale test', () => {
// 父类对于 0.5 的特殊值我们是使用 Math.sqrt API, 这已经在父类测试过了,没必要再添加额外的测试
Expand All @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/scales/sqrt.ts
Original file line number Diff line number Diff line change
@@ -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<SqrtOptions & PowOptions> {
protected getDefaultOptions() {
Expand All @@ -12,7 +12,7 @@ export class Sqrt extends Pow<SqrtOptions & PowOptions> {
clamp: false,
round: false,
interpolate: createInterpolateValue,
tickMethod: rPretty,
tickMethod: d3Ticks,
tickCount: 5,
exponent: 0.5,
};
Expand Down

0 comments on commit 33a182b

Please sign in to comment.