[x] I've supplied the required data to run my code below.
Code to reproduce
import finplot as fplt
#here is main code in my QT GUI which call the finplot code
self.tableWidget_self_select.doubleClicked.connect(self.DoubleClicked)
#here is the finplot implementation code which i copy from the example
def DoubleClicked(self):
print("DoubleClicked")
# Draw charts based on input data
ret_stock_list = QUANT_STOCK_API.quant_stock_day_query(code='000001', start='2017-10-01')
stock_day_fields = ['code', 'open', 'high', 'low', 'close', 'volume', 'amount', 'date']
df = pd.DataFrame(ret_stock_list, columns=stock_day_fields)
df.rename(
columns={
'date': 'Date', 'open': 'Open',
'high': 'High', 'low': 'Low',
'close': 'Close','volume': 'Volume'},
inplace=True)
df['Date'] = df['Date'].apply(lambda x: datetime.strptime((x), '%Y-%m-%d %H:%M:%S'))
#df = df.set_index('Date')
self.data = df
# create two axes
ax, ax2 = fplt.create_plot('600000', rows=2)
# plot candle sticks
candles = df[['Date', 'Open', 'Close', 'High', 'Low']]
fplt.candlestick_ochl(candles, ax=ax)
# overlay volume on the top plot
volumes = df[['Date', 'Open', 'Close', 'High', 'Volume']]
fplt.volume_ocv(volumes, ax=ax.overlay())
# put an MA on the close price
fplt.plot(df['Date'], df['Close'].rolling(25).mean(), ax=ax, legend='ma-25')
# place some dumb markers on low wicks
lo_wicks = df[['Open', 'Close']].T.min() - df['Low']
df.loc[(lo_wicks > lo_wicks.quantile(0.99)), 'marker'] = df['Low']
fplt.plot(df['Date'], df['marker'], ax=ax, color='#4a5', style='^', legend='dumb mark')
# draw some random crap on our second plot
fplt.plot(df['Date'], np.random.normal(size=len(df)), ax=ax2, color='#927', legend='stuff')
fplt.set_y_range(-1.4, +3.7, ax=ax2) # hard-code y-axis range limitation
#fplt.add_crosshair_info(self.update_crosshair_text, ax=ax)
# restore view (X-position and zoom) if we ever run this example again
fplt.autoviewrestore()
fplt.foreground = '#777'
fplt.background = '#19232D'
fplt.candle_bull_color = fplt.candle_bull_body_color = '#0b0'
fplt.candle_bear_color = '#a23'
volume_transparency = '6'
# we're done
fplt.show()
Describe the bug
in the chart the crosshair is missing and some error message in the console when i am trying to use mouse wheel
Expected behavior
crosshair work properly and not error message related to the mouse wheel event
Screenshots
following is the error message
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\pyqt\lib\site-packages\finplot\__init__.py", line 790, in wheelEvent
_mouse_moved(self.win, None)
File "C:\ProgramData\Anaconda3\envs\pyqt\lib\site-packages\finplot\__init__.py", line 2477, in _mouse_moved
evs = master_data[master]['last_mouse_evs']
KeyError: <finplot.FinWindow object at 0x000001AC1E9FA0D0>
and the screenshot
and the odd thing is that if i run the example code independently ,for example, create a py file such as demo.py and copy the example code into it and run this py file ,it works
Requirements (place an
x
in each of the[ ]
)**pip install -U finplot
).Code to reproduce
Describe the bug
in the chart the crosshair is missing and some error message in the console when i am trying to use mouse wheel
Expected behavior
crosshair work properly and not error message related to the mouse wheel event
Screenshots
following is the error message
and the screenshot
and the odd thing is that if i run the example code independently ,for example, create a py file such as demo.py and copy the example code into it and run this py file ,it works