diff --git a/src/evidently/ui/dashboards/reports.py b/src/evidently/ui/dashboards/reports.py
index 38276f99cf..2f1c5ae092 100644
--- a/src/evidently/ui/dashboards/reports.py
+++ b/src/evidently/ui/dashboards/reports.py
@@ -29,6 +29,7 @@
from evidently.ui.type_aliases import DataPointsAsType
from evidently.ui.type_aliases import PointInfo
from evidently.ui.type_aliases import ProjectID
+from evidently.ui.type_aliases import SnapshotID
if TYPE_CHECKING:
from evidently.ui.base import DataStorage
@@ -173,10 +174,13 @@ async def build(
raise ValueError(f"Cannot build hist from {self.value}")
if len(bins_for_hists) > 1:
raise ValueError(f"Ambiguious metrics for {self.value}")
- bins_for_hist: List[Tuple[datetime.datetime, HistogramData]] = next(
+ metric = next(iter(bins_for_hists.keys()))
+ fingerprint = metric.get_fingerprint()
+ bins_for_hist: List[Tuple[datetime.datetime, SnapshotID, HistogramData]] = next(
[
(
d.timestamp,
+ d.snapshot_id,
d.value if isinstance(d.value, HistogramData) else HistogramData.from_distribution(d.value),
)
for d in v
@@ -187,26 +191,31 @@ async def build(
timestamps: List[datetime.datetime] = []
names: Set[str] = set()
values: List[Dict[str, Any]] = []
+ snapshot_ids = []
- for timestamp, hist in bins_for_hist:
+ for timestamp, snapshot_id, hist in bins_for_hist:
timestamps.append(timestamp)
data = dict(zip(hist.x, hist.count))
- names.update(data.keys())
values.append(data)
+ names.update(data.keys())
+ snapshot_ids.append(snapshot_id)
names_sorted = list(sorted(names))
- name_to_date_value: Dict[str, List[Any]] = {name: [] for name in names_sorted}
- for timestamp, data in zip(timestamps, values):
+ name_to_date_value: Dict[str, List[Tuple[SnapshotID, Any]]] = {name: [] for name in names_sorted}
+ for timestamp, snapshot_id, data in zip(timestamps, snapshot_ids, values):
for name in names_sorted:
- name_to_date_value[name].append(data.get(name))
+ name_to_date_value[name].append((snapshot_id, data.get(name)))
hovertemplate = "{name}: %{{y}}
Timestamp: %{{x}}"
fig = go.Figure(
data=[
go.Bar(
name=name,
x=timestamps,
- y=name_to_date_value.get(name),
+ y=name_to_date_value.get(name)[1],
hovertemplate=hovertemplate.format(name=name),
+ customdata=[
+ {"metric_fingerprint": fingerprint, "snapshot_id": str(name_to_date_value.get(name)[0])}
+ ],
)
for name in names_sorted
]