Skip to content

Commit 8edb7db

Browse files
author
michael xu
committed
no zoom error bug candle not show
1 parent 328cc1c commit 8edb7db

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

finplotWindow.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def __init__(self, dockArea, dockChart, interface):
3333

3434
self.IndVolumesActivated = False
3535

36-
self.last_zoom_x = []
37-
self.last_zoom_date = []
36+
self.last_ax_data_xtick = []
37+
3838

3939
pass
4040

@@ -387,29 +387,24 @@ def setIndicator(self, indicatorName, activated):
387387

388388
def _date_str2x(self, ax, date_str):
389389
print(type(ax.getAxis('bottom').vb.datasrc))
390+
print(date_str)
391+
390392
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 = []
396393

394+
df = self.last_ax_data_xtick
395+
else:
397396
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+
413408
return [x]
414409

415410
def zoomTo(self, dateStr1, dateStr2):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy