@@ -33,8 +33,8 @@ def __init__(self, dockArea, dockChart, interface):
33
33
34
34
self .IndVolumesActivated = False
35
35
36
- self .last_zoom_x = []
37
- self . last_zoom_date = []
36
+ self .last_ax_data_xtick = []
37
+
38
38
39
39
pass
40
40
@@ -387,29 +387,24 @@ def setIndicator(self, indicatorName, activated):
387
387
388
388
def _date_str2x (self , ax , date_str ):
389
389
print (type (ax .getAxis ('bottom' ).vb .datasrc ))
390
+ print (date_str )
391
+
390
392
if ax .getAxis ('bottom' ).vb .datasrc is None :
391
- x = self .last_zoom_x [self .last_zoom_date .index (date_str )]
392
- else :
393
- if self .last_zoom_date is not None and len (self .last_zoom_date ) == 2 :
394
- self .last_zoom_date = []
395
- self .last_zoom_x = []
396
393
394
+ df = self .last_ax_data_xtick
395
+ else :
397
396
df = ax .getAxis ('bottom' ).vb .datasrc .df
398
- dftime = np .array (df .iloc [:, 0 ])
399
- lsttime = dftime .tolist ()
400
- # print(dftime)
401
- # print(lsttime)
402
-
403
- xtime = dt .strptime (date_str , '%Y-%m-%d %H:%M:%S' )
404
- xint = int ((xtime .timestamp ()+ 8 * 3600 )* 1e9 )
405
- print (xint ,lsttime [0 ])
406
- x = lsttime .index (xint )
407
- if self .last_zoom_date is None :
408
- self .last_zoom_date = [date_str ]
409
- self .last_zoom_x = [x ]
410
- else :
411
- self .last_zoom_date = self .last_zoom_date .append (date_str )
412
- self .last_zoom_x = self .last_zoom_x .append (x )
397
+
398
+ dftime = np .array (df .iloc [:, 0 ])
399
+ lsttime = dftime .tolist ()
400
+ # print(dftime)
401
+ # print(lsttime)
402
+
403
+ xtime = dt .strptime (date_str , '%Y-%m-%d %H:%M:%S' )
404
+ xint = int ((xtime .timestamp ()+ 8 * 3600 )* 1e9 )
405
+ print (xint ,lsttime [0 ])
406
+ x = lsttime .index (xint )
407
+
413
408
return [x ]
414
409
415
410
def zoomTo (self , dateStr1 , dateStr2 ):
0 commit comments