Skip to content

Commit

Permalink
fix: 判断提前,预防time类型出现的错误 (#3258)
Browse files Browse the repository at this point in the history
Co-authored-by: liufu.lf <liufu.lf@antfin.com>
  • Loading branch information
lxfu1 and liufu.lf committed Feb 2, 2021
1 parent a26c073 commit a143ef5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/chart/controller/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,13 @@ export default class Slider extends Controller<SliderOption> {
private changeViewData(min: number, max: number) {
const data = this.view.getOptions().data;
const xScale = this.view.getXScale();
const isHorizontal = true;
const values = valuesOfKey(data, xScale.field);
const xValues = isHorizontal ? values : values.reverse();
const dataSize = size(data);

if (!xScale || !dataSize) {
return;
}

const isHorizontal = true;
const values = valuesOfKey(data, xScale.field);
const xValues = isHorizontal ? values : values.reverse();
const xTickCount = size(xValues);

const minIndex = Math.floor(min * (xTickCount - 1));
Expand Down

0 comments on commit a143ef5

Please sign in to comment.