hiding the volumeProfile plot-column if

showVolumeProfile is false
This commit is contained in:
Felix Meier 2021-10-23 17:52:30 +02:00
parent edd0b8b93c
commit 02007b5e5d

View File

@ -404,12 +404,24 @@ def generate_candlestick_graph(pair: str, data: pd.DataFrame, trades: pd.DataFra
plot_config = create_plotconfig(indicators1, indicators2, plot_config) plot_config = create_plotconfig(indicators1, indicators2, plot_config)
rows = 2 + len(plot_config['subplots']) rows = 2 + len(plot_config['subplots'])
row_widths = [1 for _ in plot_config['subplots']] row_widths = [1 for _ in plot_config['subplots']]
# load VolumeProfile configurations
volume_config = plot_config['volume'] if 'volume' in plot_config else {}
showBuySell = volume_config['showBuySell'] if 'showBuySell' in volume_config else 'false'
showVolumeProfile = volume_config['showVolumeProfile'] if 'showVolumeProfile' in \
volume_config else 'false'
VolumeProfileHistoryBars = volume_config['VolumeProfileHistoryBars'] if \
'VolumeProfileHistoryBars' in volume_config else -1
VolumeProfilePriceRangeSplices = volume_config[
'VolumeProfilePriceRangeSplices'] if 'VolumeProfilePriceRangeSplices' in \
volume_config else 50
# Define the graph # Define the graph
fig = make_subplots( fig = make_subplots(
rows=rows, rows=rows,
cols=2, # ToDo: Check if 2 columns (instead of one) cause any issues somewhere else cols=2, # ToDo: Check if 2 columns (instead of one) cause any issues somewhere else
# ToDo: when showVolumeProfile==false, don't show the second column # set the width of the Volume Profile
column_widths=[8, 1], # set the width of the Volume Profile column_widths=[8, 1 if showVolumeProfile.lower() == 'true' else 0],
shared_xaxes=True, shared_xaxes=True,
shared_yaxes=True, shared_yaxes=True,
row_width=row_widths + [1, 4], row_width=row_widths + [1, 4],
@ -488,15 +500,6 @@ def generate_candlestick_graph(pair: str, data: pd.DataFrame, trades: pd.DataFra
fig = plot_trades(fig, trades) fig = plot_trades(fig, trades)
# VolumeProfile # VolumeProfile
volume_config = plot_config['volume'] if 'volume' in plot_config else {}
showBuySell = volume_config['showBuySell'] if 'showBuySell' in volume_config else 'false'
showVolumeProfile = volume_config['showVolumeProfile'] if 'showVolumeProfile' in \
volume_config else 'false'
VolumeProfileHistoryBars = volume_config['VolumeProfileHistoryBars'] if \
'VolumeProfileHistoryBars' in volume_config else -1
VolumeProfilePriceRangeSplices = volume_config[
'VolumeProfilePriceRangeSplices'] if 'VolumeProfilePriceRangeSplices' in \
volume_config else 50
if showVolumeProfile.lower() == 'true': if showVolumeProfile.lower() == 'true':
volumeProfileData = createVolumeProfileData( volumeProfileData = createVolumeProfileData(