What does timelion return in zero division (kibana 7.1.1)?

I would like to ask question about timelion.

(1) Below code displays no chart.

.static(1).divide(0)

It seems that zero is not the value return from divide

.static(1).divide(0).if(eq, 0, 0 ,1)

null is also not the value returned.

.static(1).divide(0).if(eq, null, 0 ,1)

(2) But this condition seem to work.

$static=.static(1).divide(0),
($static).if(gt, 0, 2, 0)

(2) is bit verbose so I want to show 0 in straight forward manner using simple condition like in (1).
What does timelion return with zero division ?

The result of a division by 0 in JavaScript is Infinity, which will not be drawn in the chart but is still "above" all other values, why you'll see that if in your last example result in 2.

You can actually check, that .static(1).divide(0).if(eq, Infinity, 1, 0) will return you a chart of 1.

Cheers,
Tim

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.