You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We could maybe generalise this by making it so any valid value followed by nothing is a filled circle, and any valid value directly followed by NaN is an empty circle, which would then help to display things like a rangefinder losing its target lock or something. That way we could just start plotters with NaN, and if they have a last recorded value then they can start with that followed by NaN (which then also makes it clear where the real values start once they begin).
i.e. the value buffer would start with either a single NaN, or the last session endpoint followed by a NaN, and then get new values added to it as they arrive1, and the drawing process would be something like:
# plot values by index# TODO: allow plotting values over time, or against each otherdefh_transform(index):
returnindex*canvas_width/len(buffer)
... # handle setting range and offset(TODO: allow user to set manually, instead of always using auto)defv_transform(value):
return (value+data_offset) *canvas_height/data_rangeprev_value=buffer[0]
line_started=Falseforindex, valueinenumerate(buffer):
ifvalue.is_nan() andnotprev_value.is_nan():
draw_circle(h_transform(index), v_transform(value), EMPTY)
line_started=Falseelifnotvalue.is_nan():
ifline_started:
draw_line_to(h_transform(index), v_transform(value))
else:
start_line(h_transform(index), v_transform(value))
line_started=Trueprev_value=valueifnotvalue.is_nan():
draw_circle(h_transform(index), v_transform(value), FILLED)
Footnotes
values could be transformed by an axis scaling/offset function (although this is also achievable using compound variables), and the latest min/max values could be updated using the new value, to avoid needing to process the entire buffer for every draw. ↩
The text was updated successfully, but these errors were encountered:
From this PR review comment:
i.e. the value buffer would start with either a single
NaN
, or the last session endpoint followed by aNaN
, and then get new values added to it as they arrive1, and the drawing process would be something like:Footnotes
values could be transformed by an axis scaling/offset function (although this is also achievable using compound variables), and the latest min/max values could be updated using the new value, to avoid needing to process the entire buffer for every draw. ↩
The text was updated successfully, but these errors were encountered: