fix:避免 sparklink 相同值的时候除零 (#1261)

This commit is contained in:
吴多益 2020-12-28 11:11:21 +08:00 committed by GitHub
parent d2af76fc2a
commit 3c3b5a251d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,7 @@ export class SparkLine extends React.Component<SparkLineProps> {
const values = value!.map(item => this.normalizeValue(item));
const max = Math.max(...values);
const min = Math.min(...values);
const duration = max - min;
const duration = max - min || 1;
const gap = width / (values.length - 1);
const points: Array<{