leeoniya / uPlot

📈 A small, fast chart for time series, lines, areas, ohlc & bars
MIT License
8.83k stars 386 forks source link

Exception when using setSeries if cursor: {show: false} #1021

Closed Zultanic closed 3 days ago

Zultanic commented 4 days ago

Hi, I think I have found a bug in the function toggleDOM. I have tuned off the legend, and cursor and am using a custom legend to toggle series on and off with the setSeries fucntion. In this case the line let pt = cursorOnePt ? cursorPts[0] : cursorPts[i] can result in pt = null which is then used in elTrans causing the exception. I resolved this in my code with a check for null but maybe you have a better idea or I am using the function incorrectly.

leeoniya commented 3 days ago

thanks, linked commit should fix it. try it out :)