From e1be4276cd80d2af216760f9df267590187f0c6d Mon Sep 17 00:00:00 2001 From: Ivan Usov Date: Wed, 15 Feb 2023 14:56:24 +0100 Subject: [PATCH] Add Show legend control widget For #51 --- pyzebra/app/plot_hkl.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyzebra/app/plot_hkl.py b/pyzebra/app/plot_hkl.py index f788d1e..f8c0be0 100644 --- a/pyzebra/app/plot_hkl.py +++ b/pyzebra/app/plot_hkl.py @@ -413,6 +413,12 @@ class PlotHKL: res_mult_ni = NumericInput(title="Resolution mult:", value=10, mode="int", width=100) tol_k_ni = NumericInput(title="k tolerance:", value=0.01, mode="float", width=100) + def show_legend_cb_callback(_attr, _old, new): + plot.legend.visible = bool(new) + + show_legend_cb = CheckboxGroup(labels=["Show legend"], active=[0]) + show_legend_cb.on_change("active", show_legend_cb_callback) + layout = column( row( column(row(measured_data_div, measured_data), row(upload_hkl_div, upload_hkl_fi)), @@ -429,6 +435,7 @@ class PlotHKL: disting_opt_div, disting_opt_cb, disting_opt_rb, + show_legend_cb, ), ), )