The legendText was showing NaN because the JSON you were using didn’t had
valuey in the last object.
Also the legendText had a redundant 0 in front of it, because
value (a number) was concatenated to a string
value = value + deltaX;