diff --git a/src/dvc_render/vega_templates.py b/src/dvc_render/vega_templates.py index 36e23d9..a75345e 100644 --- a/src/dvc_render/vega_templates.py +++ b/src/dvc_render/vega_templates.py @@ -43,8 +43,6 @@ def dict_replace_value(d: dict, name: str, value: Any) -> dict: if v == name: x[k] = value continue - if name in v and isinstance(value, str): - v = v.replace(name, value) x[k] = v return x @@ -205,6 +203,12 @@ class ConfusionTemplate(Template): "data": {"values": Template.anchor("data")}, "title": Template.anchor("title"), "facet": {"field": "rev", "type": "nominal"}, + "params": [ + { + "name": "toggleText", + "bind": {"input": "checkbox"}, + }, + ], "spec": { "transform": [ { @@ -294,6 +298,13 @@ class ConfusionTemplate(Template): { "mark": "text", "encoding": { + "text": { + "condition": { + "param": "toggleText", + "field": "xy_count", + "type": "quantitative", + }, + }, "color": { "condition": { "test": "datum.percent_of_max > 0.5",