Implementation:Evidentlyai Evidently SDK Panels
| Knowledge Sources | |
|---|---|
| Domains | SDK, Dashboard, Visualization |
| Last Updated | 2026-02-14 12:00 GMT |
Overview
Provides factory functions for creating dashboard panel configurations including text, counter, line plot, bar plot, and pie chart panels.
Description
The SDK Panels module offers a set of convenience factory functions that create DashboardPanelPlot instances with pre-configured plot_params for different visualization types. Each function returns a DashboardPanelPlot with the appropriate plot_type set in its parameters.
Available factory functions:
- text_panel(title, description, size) -- Creates a text-only panel for displaying headers, descriptions, or section labels. Takes no metric values. The plot_type is set to "text".
- counter_panel(title, values, description, size, aggregation) -- Creates a counter panel that displays metric values as prominent numerical counters. Supports configurable aggregation (e.g., "last", "sum", "mean") for time series data. The plot_type is set to "counter".
- line_plot_panel(title, values, description, size) -- Creates a line plot panel for visualizing metrics over time as continuous lines. The plot_type is set to "line".
- bar_plot_panel(title, values, description, size, stacked) -- Creates a bar chart panel for comparing metric values. Supports stacked bars via the is_stacked plot parameter. The plot_type is set to "bar".
- pie_plot_panel(title, values, description, size, aggregation) -- Creates a pie chart panel for showing proportional distributions. Supports configurable aggregation for time series data. The plot_type is set to "pie".
All functions accept a size parameter (default: "full") and return DashboardPanelPlot instances that can be added to DashboardModel configurations.
Usage
Use these factory functions when programmatically building dashboard configurations for Evidently projects. Combine them with PanelMetric objects from evidently.sdk.models to specify which metrics appear in each panel. Add the resulting panels to a DashboardModel for the project's dashboard.
Code Reference
Source Location
- Repository: Evidentlyai_Evidently
- File:
src/evidently/sdk/panels.py
Signature
def text_panel(
title: str,
description: Optional[str] = None,
size: str = "full",
) -> DashboardPanelPlot:
...
def counter_panel(
title: str,
values: List[PanelMetric],
description: Optional[str] = None,
size: str = "full",
aggregation: str = "last",
) -> DashboardPanelPlot:
...
def line_plot_panel(
title: str,
values: List[PanelMetric],
description: Optional[str] = None,
size: str = "full",
) -> DashboardPanelPlot:
...
def bar_plot_panel(
title: str,
values: List[PanelMetric],
description: Optional[str] = None,
size: str = "full",
stacked: bool = False,
) -> DashboardPanelPlot:
...
def pie_plot_panel(
title: str,
values: List[PanelMetric],
description: Optional[str] = None,
size: str = "full",
aggregation: str = "last",
) -> DashboardPanelPlot:
...
Import
from evidently.sdk.panels import (
text_panel,
counter_panel,
line_plot_panel,
bar_plot_panel,
pie_plot_panel,
)
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| title | str | Yes | Title displayed at the top of the panel |
| values | List[PanelMetric] | Yes (except text_panel) | List of PanelMetric objects specifying which metrics to display |
| description | Optional[str] | No | Optional subtitle/description for the panel |
| size | str | No | Panel size (default: "full"); other options include "half" |
| aggregation | str | No (counter_panel, pie_plot_panel only) | Aggregation method for time series data (default: "last"); options include "sum", "mean" |
| stacked | bool | No (bar_plot_panel only) | Whether to stack bars (default: False) |
Outputs
| Name | Type | Description |
|---|---|---|
| text_panel return | DashboardPanelPlot | Panel with plot_type="text" and empty values list |
| counter_panel return | DashboardPanelPlot | Panel with plot_type="counter" and specified aggregation |
| line_plot_panel return | DashboardPanelPlot | Panel with plot_type="line" |
| bar_plot_panel return | DashboardPanelPlot | Panel with plot_type="bar" and optional is_stacked parameter |
| pie_plot_panel return | DashboardPanelPlot | Panel with plot_type="pie" and specified aggregation |
Usage Examples
from evidently.sdk.panels import text_panel, counter_panel, line_plot_panel, bar_plot_panel, pie_plot_panel
from evidently.sdk.models import PanelMetric, DashboardModel, DashboardTabModel
# Create metrics to display
drift_metric = PanelMetric(metric="DatasetDriftMetric", legend="Drift Score")
accuracy_metric = PanelMetric(metric="ColumnSummary", legend="Accuracy", metric_labels={"column": "accuracy"})
# Create a text header panel
header = text_panel(title="Model Monitoring Dashboard", description="Daily metrics overview")
# Create a counter panel showing latest drift score
drift_counter = counter_panel(
title="Current Drift Score",
values=[drift_metric],
aggregation="last",
size="half",
)
# Create a line plot showing accuracy over time
accuracy_trend = line_plot_panel(
title="Accuracy Trend",
values=[accuracy_metric],
description="Daily accuracy values",
)
# Create a stacked bar chart
stacked_bars = bar_plot_panel(
title="Metric Comparison",
values=[drift_metric, accuracy_metric],
stacked=True,
)
# Create a pie chart
distribution = pie_plot_panel(
title="Label Distribution",
values=[PanelMetric(metric="ColumnSummary", legend="Labels")],
aggregation="last",
)
# Assemble into a dashboard
panels = [header, drift_counter, accuracy_trend, stacked_bars, distribution]
dashboard = DashboardModel(
tabs=[DashboardTabModel(title="Overview", panels=[p.id for p in panels])],
panels=panels,
)