From 967ff7fc4a246b7ab81c12ae2012a79f181ccf3f Mon Sep 17 00:00:00 2001 From: Marian Ivanov Date: Sat, 10 Feb 2024 13:50:07 +0100 Subject: [PATCH] Added a workaround to make TeX work with getDefaultVars template --- .../InteractiveDrawing/bokeh/bokehInteractiveTemplate.py | 4 ++++ .../InteractiveDrawing/bokeh/test_bokehClientHistogram.py | 5 +++-- RootInteractive/InteractiveDrawing/bokeh/test_bokehDrawSA.py | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/RootInteractive/InteractiveDrawing/bokeh/bokehInteractiveTemplate.py b/RootInteractive/InteractiveDrawing/bokeh/bokehInteractiveTemplate.py index 1a8905e0..166be458 100644 --- a/RootInteractive/InteractiveDrawing/bokeh/bokehInteractiveTemplate.py +++ b/RootInteractive/InteractiveDrawing/bokeh/bokehInteractiveTemplate.py @@ -269,6 +269,7 @@ def getDefaultVars(normalization=None, variables=None, defaultVariables={}, weig # ['descriptionTable', {"name":"description"}], ['selectionTable', {"name":"selection"}], + [['bin_center_0'], ['bin_count'], {"source":"histoXYData", "name":"tex_hack", "xAxisTitle": "$$X_0$$"}], figureGlobalOption ] figureLayoutDesc={ @@ -281,6 +282,7 @@ def getDefaultVars(normalization=None, variables=None, defaultVariables={}, weig } figureLayoutDesc["selection"] = ["selection", {'plot_height': 200, 'sizing_mode': 'scale_width'}] figureLayoutDesc["description"] = ["description", {'plot_height': 200, 'sizing_mode': 'scale_width'}] + figureLayoutDesc["ignoreme"] = ["tex_hack", {'plot_height': 200, 'sizing_mode': 'scale_width'}] print("Default RootInteractive variables are defined.") return aliasArray, variables, parameterArray, widgetParams, widgetLayoutDesc, histoArray, figureArray, figureLayoutDesc @@ -570,6 +572,7 @@ def getDefaultVarsNormAll(variables=None, defaultVariables={}, weights=None, mul # ['descriptionTable', {"name":"description"}], ['selectionTable', {"name":"selection"}], + [['bin_center_0'], ['bin_count'], {"source":"histoXYData", "name":"tex_hack", "xAxisTitle": "$$X_0$$"}], figureGlobalOption ] figureLayoutDesc={ @@ -582,6 +585,7 @@ def getDefaultVarsNormAll(variables=None, defaultVariables={}, weights=None, mul } figureLayoutDesc["selection"] = ["selection", {'plot_height': 200, 'sizing_mode': 'scale_width'}] figureLayoutDesc["description"] = ["description", {'plot_height': 200, 'sizing_mode': 'scale_width'}] + figureLayoutDesc["ignoreme"] = ["tex_hack", {'plot_height': 200, 'sizing_mode': 'scale_width'}] print("Default RootInteractive variables are defined.") return aliasArray, transformArray, variables, parameterArray, widgetParams, widgetLayoutDesc, histoArray, figureArray, figureLayoutDesc diff --git a/RootInteractive/InteractiveDrawing/bokeh/test_bokehClientHistogram.py b/RootInteractive/InteractiveDrawing/bokeh/test_bokehClientHistogram.py index 088e1c3f..a1a0e747 100644 --- a/RootInteractive/InteractiveDrawing/bokeh/test_bokehClientHistogram.py +++ b/RootInteractive/InteractiveDrawing/bokeh/test_bokehClientHistogram.py @@ -22,7 +22,7 @@ df['errY']=df.A*0.02+0.02 df.head(10) df.meta.metaData = {'A.AxisTitle': "A (cm)", 'B.AxisTitle': "B (cm/s)", 'C.AxisTitle': "C (s)", - 'D.AxisTitle': "D (a.u.)", 'Bool.AxisTitle': "A>half"} + 'D.AxisTitle': r"\[x\pi\]", 'Bool.AxisTitle': "A>half"} #widgets="slider.A(0,1,0.05,0,1), slider.B(0,1,0.05,0,1), slider.C(0,1,0.01,0.1,1), slider.D(0,1,0.01,0,1), checkbox.Bool(1), multiselect.E(0,1,2,3,4)" widgets="slider.A(0,1,0.05,0,1), slider.B(0,1,0.05,0,1), slider.C(0,1,0.01,0.1,1), slider.D(0,1,0.01,0,1), checkbox.Bool(1)" @@ -458,7 +458,7 @@ def test_interactiveTemplateMultiDiff(): jsFunctionArray=jsFunctionArray) def test_interactiveTemplateMultiYDiff(): - output_file("test_histogramTemplateMultiY.html") + output_file("test_histogramTemplateMultiYDiff.html") aliasArray, jsFunctionArray, variables, parameterArray, widgetParams, widgetLayoutDesc, histoArray, figureArray, figureLayoutDesc = getDefaultVarsNormAll(variables=["A", "B", "C", "D"], multiAxis="varY") widgetsSelect = [ ['range', ['A'], {"name":"A"}], @@ -472,3 +472,4 @@ def test_interactiveTemplateMultiYDiff(): widgetLayout=widgetLayoutDesc, sizing_mode="scale_width", histogramArray=histoArray, aliasArray=aliasArray, arrayCompression=arrayCompressionRelative16, jsFunctionArray=jsFunctionArray) +test_interactiveTemplateMultiY() \ No newline at end of file diff --git a/RootInteractive/InteractiveDrawing/bokeh/test_bokehDrawSA.py b/RootInteractive/InteractiveDrawing/bokeh/test_bokehDrawSA.py index dc59b13d..c8ae3647 100644 --- a/RootInteractive/InteractiveDrawing/bokeh/test_bokehDrawSA.py +++ b/RootInteractive/InteractiveDrawing/bokeh/test_bokehDrawSA.py @@ -56,7 +56,7 @@ df['maskAC']=2*(df['A']>.5)|1*(df['C']>.5) df['ones']=1 df.head(10) -df.meta.metaData = {'A.AxisTitle': "A (cm)", 'B.AxisTitle': "B (cm/s)", 'C.AxisTitle': "C (s)", 'D.AxisTitle': "D (a.u.)", 'E.AxisTitle': "Category", "A.Description": "The distance A"} +df.meta.metaData = {'A.AxisTitle': r"\[x\pi\]", 'B.AxisTitle': "B (cm/s)", 'C.AxisTitle': "C (s)", 'D.AxisTitle': "D (a.u.)", 'E.AxisTitle': "Category", "A.Description": "The distance A"} parameterArray = [ {"name": "colorZ", "value":"A", "options":["A", "B", "EE"]}, @@ -73,7 +73,7 @@ figureArray = [ # ['A'], ['C-A'], {"color": "red", "size": 7, "colorZvar":"C", "filter": "A<0.5"}], [['A'], ['A*A-C*C'], {"color": "red", "size": 2, "colorZvar": "A", "varZ": "C", "errY": "errY", "errX":"0.01"}], - [['X'], ['C+A', 'C-A', 'A/A'], {"name": "fig1"}], + [['X'], ['C+A', 'C-A', 'A/A'], {"name": "fig1", "xAxisTitle":r"\[x\pi\]", "plotTitle":"C+A, C-A vs {X}" }], [['B'], ['C+B', 'C-B'], { "colorZvar": "B", "errY": "errY", "rescaleColorMapper": True, "colorAxisLabel": "B (cm/s)"}], [['D'], ['(A+B+C)*DD'], {"colorZvar": "colorZ", "size": 10, "errY": "errY"} ], # [['D'], ['D*10'], {"size": 10, "errY": "errY","markers":markerFactor, "color":colorFactor,"legend_field":"DDC"}],