Skip to content

Commit

Permalink
chore: fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored and hustcc committed Apr 26, 2020
1 parent e13db3a commit ce740a7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/manual/tutorial/slider.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export interface SliderOption {
readonly start?: number;
readonly end?: number;
/** 滑块文本格式化函数 */
readonly formatter?: (options: {val: any, datum: Datum, idx: number}) => string;
readonly formatter?: (val: any, datum: Datum, idx: number) => any;
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/manual/tutorial/slider.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export interface SliderOption {
readonly start?: number;
readonly end?: number;
/** 滑块文本格式化函数 */
readonly formatter?: (options: {val: any, datum: Datum, idx: number}) => string;
readonly formatter?: (val: any, datum: Datum, idx: number) => any;
}
```

Expand Down
6 changes: 3 additions & 3 deletions src/chart/controller/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { isBetween, omit } from '../../util/helper';
import View from '../view';
import { Controller } from './base';

export type SliderFormatterType = (options: {val: any, datum: Datum, idx: number}) => string;
export type SliderFormatterType = (val: any, datum: Datum, idx: number) => any;
/** Slider 配置 */
export interface SliderOption {
/** slider 高度 */
Expand Down Expand Up @@ -231,8 +231,8 @@ export default class Slider extends Controller<Option> {

const formatter = this.getSliderCfg().formatter as SliderFormatterType;
if (formatter) {
minText = formatter({ val: minText, datum: data[minIndex], idx: minIndex });
maxText = formatter({ val: maxText, datum: data[maxIndex], idx: maxIndex });
minText = formatter(minText, data[minIndex], minIndex);
maxText = formatter(maxText, data[maxIndex], maxIndex);
}

// 更新文本
Expand Down

0 comments on commit ce740a7

Please sign in to comment.