@@ -254,8 +254,8 @@ def __init__(
254
254
self ._axesy_bitmap = displayio .Bitmap (self ._axesy_width , self .height , 4 )
255
255
self ._axesy_bitmap .fill (0 )
256
256
257
- self ._screen_bitmap = displayio .Bitmap (self .width , self .height , 5 )
258
- self ._screen_bitmap . fill ( 5 )
257
+ self ._plot_bitmap = displayio .Bitmap (self .width , self .height , 5 )
258
+ self .clear_plot ( )
259
259
self ._screen_palette = displayio .Palette (6 )
260
260
self ._screen_palette .make_transparent (0 )
261
261
self ._screen_palette [1 ] = self ._tick_color
@@ -297,7 +297,7 @@ def __init__(
297
297
)
298
298
299
299
self ._screen_tilegrid = displayio .TileGrid (
300
- self ._screen_bitmap ,
300
+ self ._plot_bitmap ,
301
301
pixel_shader = self ._screen_palette ,
302
302
x = 0 ,
303
303
y = 0 ,
@@ -614,10 +614,21 @@ def update_line(self, x: int, y: int) -> None:
614
614
self ._add_point (x , y )
615
615
if len (self .plot_line_point ) > 1 :
616
616
bitmaptools .draw_line (
617
- self ._screen_bitmap ,
617
+ self ._plot_bitmap ,
618
618
self .plot_line_point [- 2 ][0 ],
619
619
self .plot_line_point [- 2 ][1 ],
620
620
self .plot_line_point [- 1 ][0 ],
621
621
self .plot_line_point [- 1 ][1 ],
622
622
1 ,
623
623
)
624
+
625
+ def clear_plot (self , palette_index = 5 ):
626
+ """clear_plot function.
627
+
628
+ clear plotted lines
629
+ :param int palette_index: color palett index. Defaults to 5
630
+ :return: None
631
+ rtype: None
632
+ """
633
+ self .plot_line_point = None
634
+ self ._plot_bitmap .fill (palette_index )
0 commit comments