Spaces:
Sleeping
Sleeping
add connectgaps=false to prevent misleading lines across data gaps
Browse files- src/streamlit_app.py +13 -8
src/streamlit_app.py
CHANGED
|
@@ -577,26 +577,29 @@ def create_temporal_visualizations(df: pd.DataFrame) -> Dict[str, go.Figure]:
|
|
| 577 |
marker=dict(size=5, color='lightblue')),
|
| 578 |
row=1, col=1
|
| 579 |
)
|
| 580 |
-
|
| 581 |
fig_timeline.add_trace(
|
| 582 |
go.Scatter(x=daily_stats.index, y=daily_stats['post_count_ma7'],
|
| 583 |
mode='lines', name='7-Day Average',
|
| 584 |
-
line=dict(color='blue', width=2)
|
|
|
|
| 585 |
row=1, col=1
|
| 586 |
)
|
| 587 |
-
|
| 588 |
# Engagement metrics
|
| 589 |
fig_timeline.add_trace(
|
| 590 |
go.Scatter(x=daily_stats.index, y=daily_stats['score_ma7'],
|
| 591 |
mode='lines', name='Avg Score (7-day)',
|
| 592 |
-
line=dict(color='orange')
|
|
|
|
| 593 |
row=2, col=1
|
| 594 |
)
|
| 595 |
-
|
| 596 |
fig_timeline.add_trace(
|
| 597 |
go.Scatter(x=daily_stats.index, y=daily_stats['num_comments'].rolling(window=7, min_periods=1).mean(),
|
| 598 |
mode='lines', name='Avg Comments (7-day)',
|
| 599 |
-
line=dict(color='green')
|
|
|
|
| 600 |
row=2, col=1
|
| 601 |
)
|
| 602 |
|
|
@@ -638,7 +641,8 @@ def create_temporal_visualizations(df: pd.DataFrame) -> Dict[str, go.Figure]:
|
|
| 638 |
y=monthly_data[('score', 'mean')],
|
| 639 |
name='Avg Score',
|
| 640 |
yaxis='y2',
|
| 641 |
-
line=dict(color='red', width=2)
|
|
|
|
| 642 |
))
|
| 643 |
|
| 644 |
fig_monthly.update_layout(
|
|
@@ -677,7 +681,8 @@ def create_temporal_visualizations(df: pd.DataFrame) -> Dict[str, go.Figure]:
|
|
| 677 |
y=weekly_data[('score', 'mean')],
|
| 678 |
name='Avg Score',
|
| 679 |
yaxis='y2',
|
| 680 |
-
line=dict(color='red', width=2)
|
|
|
|
| 681 |
))
|
| 682 |
|
| 683 |
fig_weekly.update_layout(
|
|
|
|
| 577 |
marker=dict(size=5, color='lightblue')),
|
| 578 |
row=1, col=1
|
| 579 |
)
|
| 580 |
+
|
| 581 |
fig_timeline.add_trace(
|
| 582 |
go.Scatter(x=daily_stats.index, y=daily_stats['post_count_ma7'],
|
| 583 |
mode='lines', name='7-Day Average',
|
| 584 |
+
line=dict(color='blue', width=2),
|
| 585 |
+
connectgaps=False),
|
| 586 |
row=1, col=1
|
| 587 |
)
|
| 588 |
+
|
| 589 |
# Engagement metrics
|
| 590 |
fig_timeline.add_trace(
|
| 591 |
go.Scatter(x=daily_stats.index, y=daily_stats['score_ma7'],
|
| 592 |
mode='lines', name='Avg Score (7-day)',
|
| 593 |
+
line=dict(color='orange'),
|
| 594 |
+
connectgaps=False),
|
| 595 |
row=2, col=1
|
| 596 |
)
|
| 597 |
+
|
| 598 |
fig_timeline.add_trace(
|
| 599 |
go.Scatter(x=daily_stats.index, y=daily_stats['num_comments'].rolling(window=7, min_periods=1).mean(),
|
| 600 |
mode='lines', name='Avg Comments (7-day)',
|
| 601 |
+
line=dict(color='green'),
|
| 602 |
+
connectgaps=False),
|
| 603 |
row=2, col=1
|
| 604 |
)
|
| 605 |
|
|
|
|
| 641 |
y=monthly_data[('score', 'mean')],
|
| 642 |
name='Avg Score',
|
| 643 |
yaxis='y2',
|
| 644 |
+
line=dict(color='red', width=2),
|
| 645 |
+
connectgaps=False
|
| 646 |
))
|
| 647 |
|
| 648 |
fig_monthly.update_layout(
|
|
|
|
| 681 |
y=weekly_data[('score', 'mean')],
|
| 682 |
name='Avg Score',
|
| 683 |
yaxis='y2',
|
| 684 |
+
line=dict(color='red', width=2),
|
| 685 |
+
connectgaps=False
|
| 686 |
))
|
| 687 |
|
| 688 |
fig_weekly.update_layout(
|