From fdaab748bf440fc808101ecf04945807c693cf9e Mon Sep 17 00:00:00 2001 From: dberenbaum Date: Mon, 16 Oct 2023 16:07:58 -0400 Subject: [PATCH 1/2] toggle confusion matrix text --- src/dvc_render/vega_templates.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/dvc_render/vega_templates.py b/src/dvc_render/vega_templates.py index 36e23d9..0d7212d 100644 --- a/src/dvc_render/vega_templates.py +++ b/src/dvc_render/vega_templates.py @@ -205,6 +205,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 +300,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", From f6fe0abe299d7d67ef4544deb07f2aab819a172b Mon Sep 17 00:00:00 2001 From: dberenbaum Date: Mon, 16 Oct 2023 19:55:56 -0400 Subject: [PATCH 2/2] rename toggle --- src/dvc_render/vega_templates.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dvc_render/vega_templates.py b/src/dvc_render/vega_templates.py index 0d7212d..3940ac3 100644 --- a/src/dvc_render/vega_templates.py +++ b/src/dvc_render/vega_templates.py @@ -207,7 +207,7 @@ class ConfusionTemplate(Template): "facet": {"field": "rev", "type": "nominal"}, "params": [ { - "name": "toggleText", + "name": "showValues", "bind": {"input": "checkbox"}, }, ], @@ -302,7 +302,7 @@ class ConfusionTemplate(Template): "encoding": { "text": { "condition": { - "param": "toggleText", + "param": "showValues", "field": "xy_count", "type": "quantitative", },