Skip to content

Commit

Permalink
fix: 连续平移后tick计算不对
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyue committed Apr 1, 2021
1 parent 77e5337 commit 4bb2870
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/interaction/mixin/move.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function _handleCatScale(scale, delta, range) {
}
}
newTicks = ticks;
} else if (type === 'cat' && !scale.getConfig('ticks')) {
} else if (type === 'cat') {
const catTicks = getTickMethod('cat');
newTicks = catTicks({
tickCount,
Expand Down
7 changes: 4 additions & 3 deletions test/unit/interaction/pan-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ describe('chart pan', function() {
interaction._doMove(-50, 0);
const xScale = chart.getXScale();
expect(xScale.values).toEqual([ '5', '6', '7', '8', '9' ]);
expect(xScale.ticks).toEqual([ '4', '6', '8' ]);
expect(xScale.ticks).toEqual([ '5', '6', '7', '8', '9' ]);
});

it('pan x axis, and x field is a timeCat type.', function() {
Expand Down Expand Up @@ -275,11 +275,12 @@ describe('chart pan', function() {

const interaction = chart._interactions.pan;
interaction._doMove(-40, 0);
interaction._doMove(-40, 0);

expect(xScale.values.length).toBe(7);
expect(xScale.ticks.length).toBe(7);
expect(xScale.ticks[0]).toBe('2018-08-10');
expect(xScale.ticks[6]).toBe('2018-08-16');
expect(xScale.ticks[0]).toBe('2018-08-11');
expect(xScale.ticks[6]).toBe('2018-08-17');
});

it('pan x axis with speed and step control.', function() {
Expand Down

0 comments on commit 4bb2870

Please sign in to comment.