mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-16 08:38:30 +00:00
Fixed Plotly Holiday Hover Text
This commit is contained in:
parent
3ac99e18d4
commit
0d37a46593
1 changed files with 8 additions and 1 deletions
|
|
@ -823,8 +823,15 @@ def get_forecast_component_plotly_props(m, fcst, name, uncertainty=True, plot_ca
|
|||
mode = 'lines'
|
||||
if name == 'holidays':
|
||||
fcst = fcst[fcst[name] != 0].copy()
|
||||
text = fcst.merge(m.holidays, how='left', on='ds')['holiday']
|
||||
mode = 'markers'
|
||||
# Combine holidays into one hover text
|
||||
holiday_features, _, _ = m.make_holiday_features(fcst['ds'], m.holidays)
|
||||
holiday_features.columns = holiday_features.columns.str.replace('_delim_', '', regex=False)
|
||||
holiday_features.columns = holiday_features.columns.str.replace('+0', '', regex=False)
|
||||
text = pd.Series(data='', index=holiday_features.index)
|
||||
for holiday_feature, idxs in holiday_features.iteritems():
|
||||
text[idxs.astype(bool) & (text != '')] += '<br>' # Add newline if additional holiday
|
||||
text[idxs.astype(bool)] += holiday_feature
|
||||
|
||||
traces = []
|
||||
traces.append(go.Scatter(
|
||||
|
|
|
|||
Loading…
Reference in a new issue