38
38
W ,
39
39
)
40
40
41
- from pygpsclient .globals import BGCOL , READONLY , RPTDELAY , WIDGETU6 , AreaXY
41
+ from pygpsclient .globals import (
42
+ AXISCOL ,
43
+ BGCOL ,
44
+ GRIDCOL ,
45
+ READONLY ,
46
+ RPTDELAY ,
47
+ WIDGETU6 ,
48
+ AreaXY ,
49
+ )
42
50
from pygpsclient .helpers import data2xy , get_grid , scale_font , time2str
43
51
44
52
MAXCHANS = 4
45
53
RESFONT = 28 # font size relative to widget size
46
54
MINFONT = 8 # minimum font size
47
55
PLOTWID = 1
48
56
PLOTCOLS = ("yellow" , "cyan" , "magenta" , "deepskyblue" )
49
- AXISCOL = "white"
50
- GRIDCOL = "grey40"
51
57
GRIDMINCOL = "grey30"
52
58
LBLGRID = 5
53
59
GRIDSTEPS = get_grid (21 )
@@ -368,7 +374,7 @@ def _on_clear(self, event): # pylint: disable=unused-argument
368
374
"""
369
375
370
376
for chn in range (self ._num_chans ):
371
- self ._chart_data [chn ] = [( time (), 0 ) ]
377
+ self ._chart_data [chn ] = []
372
378
self ._mintim = 1e20
373
379
self ._maxtim = 0
374
380
self ._can_chartview .delete (ALL )
@@ -555,7 +561,8 @@ def _update_plot(self, data: dict):
555
561
self ._draw_yaxis_labels (w , h , bounds , minval [chn ], maxval [chn ], chn )
556
562
557
563
# plot each data point in channel
558
- for idx , (tim , val ) in enumerate (data [chn ]):
564
+ inr = False
565
+ for tim , val in data [chn ]:
559
566
560
567
if val is None : # not numeric
561
568
continue
@@ -572,22 +579,24 @@ def _update_plot(self, data: dict):
572
579
val ,
573
580
self ._xoff ,
574
581
)
582
+ if x <= self ._xoff :
583
+ inr = False
575
584
# plot line
576
- if idx :
585
+ if inr :
577
586
x2 , y2 = x , y
578
- if idx :
579
- self ._can_chartview .create_line (
580
- x1 ,
581
- y1 ,
582
- x2 ,
583
- y2 ,
584
- fill = chncol ,
585
- width = PLOTWID ,
586
- tags = f"plot_{ chn :1d} " ,
587
- )
587
+ self ._can_chartview .create_line (
588
+ x1 ,
589
+ y1 ,
590
+ x2 ,
591
+ y2 ,
592
+ fill = chncol ,
593
+ width = PLOTWID ,
594
+ tags = f"plot_{ chn :1d} " ,
595
+ )
588
596
x1 , y1 = x2 , y2
589
597
else :
590
- x1 , y1 = x , y
598
+ x1 , y1 = max (x , self ._xoff ), y
599
+ inr = True
591
600
592
601
def _draw_xaxis_labels (
593
602
self , w : int , h : int , bounds : AreaXY , mintim : float , maxtim : float
0 commit comments