Fixed JS error on quickly moving the mouse out of a chart. Related to #2499.