fix non-minmax line plot in javascript