<RETURN_TO_BASE

Designing an Advanced Multi-Page Analytics Dashboard

Build an interactive dashboard with dynamic filtering and live KPIs using Panel.

Overview of the Tutorial

In this tutorial, we build an advanced multi-page interactive dashboard using Panel. Through each component of implementation, we explore how to generate synthetic data, apply rich filters, visualize dynamic time-series trends, compare segments and regions, and even simulate live KPI updates. We design the system step by step to understand how each widget, callback, and plotting function comes together to create a smooth, reactive analytics experience.

Setting Up the Environment

We install all required dependencies and load Panel, hvPlot, Pandas, and NumPy so the dashboard runs smoothly in Google Colab. We generate a full year of synthetic time-series data across segments and regions, providing a rich dataset for exploration.

import sys, subprocess
 
def install_deps():
   pkgs = ["panel", "hvplot", "pandas", "numpy", "bokeh"]
   subprocess.check_call([sys.executable, "-m", "pip", "install", "-q"] + pkgs)
 
try:
   import panel as pn
   import hvplot.pandas
   import pandas as pd
   import numpy as np
except ImportError:
   install_deps()
   import panel as pn
   import hvplot.pandas
   import pandas as pd
   import numpy as np
 
pn.extension()
 
rng = np.random.default_rng(42)
dates = pd.date_range("2024-01-01", periods=365, freq="D")
segments = ["A", "B", "C"]
regions = ["North", "South", "East", "West"]
 
# Synthetic data generation
base = pd.DataFrame(...)
df = base.reset_index(drop=True)

Building Interactive Widgets

We build the interactive widgets and filtering logic that controls the entire dashboard. We wire the time-series plot to the widgets using reactive @pn.depends, allowing instantaneous changes across segments, regions, metrics, date ranges, and smoothing windows.

segment_sel = pn.widgets.CheckBoxGroup(...)
region_sel = pn.widgets.MultiChoice(...)
metric_sel = pn.widgets.Select(...)
date_range = pn.widgets.DateRangeSlider(...)
smooth_slider = pn.widgets.IntSlider(...)

Visualizing Data

We construct additional visual layers: a segment-level bar chart and a region-segment heatmap. These charts react to the same global filters, providing insights across categories seamlessly.

@pn.depends(segment_sel, region_sel, metric_sel, date_range)
def segment_bar(...):
   ...
 
@pn.depends(segment_sel, region_sel, metric_sel, date_range)
def region_heatmap(...):
   ...

Simulating Live KPI Updates

We simulate a rolling stream of KPIs that update every second, showcasing real-time insights. Total revenue, average conversions, and conversion rates are calculated continuously inside a sliding window.

kpi_source = df.copy()
 
def compute_kpi(slice_df):
   ...
 
pn.state.add_periodic_callback(update_kpis, period=1000, start=True)

Assembling the Dashboard

We organize all components into a clean multi-page layout using Tabs, crafting an intuitive navigation system for users.

controls = pn.WidgetBox(...)
 
dashboard = pn.Tabs(...)

Bringing It All Together

We see how seamlessly we can combine Panel widgets, hvPlot visualizations, and periodic callbacks to build a powerful analytics dashboard. This interactive system serves as a foundation for real-world reporting, experimentation, or production-grade dashboards.

🇷🇺

Сменить язык

Читать эту статью на русском

Переключить на Русский