From d1a53e2451bcd6885a9e1b8ab48b107331ccf87d Mon Sep 17 00:00:00 2001 From: Christian Poli Date: Tue, 19 Nov 2024 16:59:22 +0100 Subject: [PATCH] support for 3 image defs in Heatmap --- ipyprogressivis/widgets/chaining/heatmap.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ipyprogressivis/widgets/chaining/heatmap.py b/ipyprogressivis/widgets/chaining/heatmap.py index d32d78d..25d06b6 100644 --- a/ipyprogressivis/widgets/chaining/heatmap.py +++ b/ipyprogressivis/widgets/chaining/heatmap.py @@ -18,7 +18,7 @@ WidgetType = AnyType _l = ipw.Label -DIM = 512 +MAX_DIM = 512 def make_float( @@ -37,6 +37,7 @@ def make_float( class HeatmapW(VBoxTyped): class Typed(TypedBase): + choice_dim: ipw.Dropdown choice_x: ipw.Dropdown choice_y: ipw.Dropdown # freeze_ck: ipw.Checkbox @@ -69,6 +70,13 @@ def initialize(self) -> None: for (col, (c, t)) in self.col_typed_names.items() if (t.startswith("float") or t.startswith("int")) ] + self.child.choice_dim = ipw.Dropdown( + options=[("512*512", "512"), ("256*256", "256"), ("128*128", "128")], + value="512", + description="Definition", + disabled=False, + # layout={"width": "initial"}, + ) self.child.choice_x = ipw.Dropdown( options=num_cols + [""], value="", @@ -110,7 +118,8 @@ def init_heatmap(self, ctx) -> None: col_x = ctx["X"] col_y = ctx["Y"] print("XY", ctx) - self.child.image = ipw.Image(value=b"\x00", width=DIM, height=DIM) + DIM = int(self.child.choice_dim.value) + self.child.image = ipw.Image(value=b"\x00", width=MAX_DIM, height=MAX_DIM) s = self.input_module.scheduler() query = quantiles = self.input_module with s: