Fix bug on TopN weird behavior with zero values (#74942)
This commit is contained in:
parent
ec5112b9cc
commit
458bf9fb0d
|
@ -110,7 +110,9 @@ export class TopN extends Component {
|
|||
const isPositiveValue = lastValue >= 0;
|
||||
|
||||
const intervalLength = TopN.calcDomain(renderMode, min, max);
|
||||
const width = 100 * (Math.abs(lastValue) / intervalLength);
|
||||
// if both are 0, the division returns NaN causing unexpected behavior.
|
||||
// For this it defaults to 0
|
||||
const width = 100 * (Math.abs(lastValue) / intervalLength) || 0;
|
||||
|
||||
const styles = reactcss(
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue