Trying to turn the values in the Y axis into dollar amount, when using the update_layout method it only affects the first chart but not the others. I am not sure where to put the method, or how I could apply the formatting to each trace individually.
JavaScript
x
42
42
1
fig = make_subplots(rows=2, cols=2,
2
subplot_titles=("Daily", "Week To Date", "Month To Date", "Quarter To Date"),
3
)
4
5
fig.update_layout(yaxis_tickprefix = '$', yaxis_tickformat = ',.')
6
7
CS_df_Daily, CS_df_Weekily = Current_Stock_Profile.Daily_DateFrame, Current_Stock_Profile.WeekToDate_DataFrame
8
CS_df_Month, CS_df_Quarter = Current_Stock_Profile.MonthToDate_DataFrame, Current_Stock_Profile.QuarterToDate_DataFrame
9
10
fig.add_trace(go.Candlestick(x=CS_df_Daily.index,
11
open=CS_df_Daily['Open'],
12
high=CS_df_Daily['High'],
13
low=CS_df_Daily['Low'],
14
close=CS_df_Daily['Close']),
15
row = 1, col = 1)
16
17
18
fig.add_trace(go.Candlestick(x=CS_df_Weekily.index,
19
open=CS_df_Weekily['Open'],
20
high=CS_df_Weekily['High'],
21
low=CS_df_Weekily['Low'],
22
close=CS_df_Weekily['Close']), row = 1, col = 2)
23
24
25
fig.add_trace(go.Candlestick(x=CS_df_Month.index,
26
open=CS_df_Month['Open'],
27
high=CS_df_Month['High'],
28
low=CS_df_Month['Low'],
29
close=CS_df_Month['Close']),row = 2, col = 1)
30
31
fig.add_trace(go.Candlestick(x=CS_df_Quarter.index,
32
open=CS_df_Quarter['Open'],
33
high=CS_df_Quarter['High'],
34
low=CS_df_Quarter['Low'],
35
close=CS_df_Quarter['Close']), row = 2, col = 2)
36
37
fig.update_layout(height=750, width=1200,showlegend=False,
38
title_text=Current_Stock_Profile.shortName)
39
40
41
fig.update_xaxes(rangeslider_visible=False)
42
Example of the Chart I am generating
Advertisement
Answer
You can format each y-axis to support it.
JavaScript
1
9
1
fig.update_layout(yaxis_tickformat='$',
2
yaxis2_tickformat='$',
3
yaxis3_tickformat='$',
4
yaxis4_tickformat='$',
5
height=750,
6
width=1200,
7
showlegend=False,
8
title_text=Current_Stock_Profile.shortName)
9