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/bokehTools.py b/RootInteractive/InteractiveDrawing/bokeh/bokehTools.py index 5b51fe02..2b91d85d 100644 --- a/RootInteractive/InteractiveDrawing/bokeh/bokehTools.py +++ b/RootInteractive/InteractiveDrawing/bokeh/bokehTools.py @@ -557,7 +557,7 @@ def bokehDrawArray(dataFrame, query, figureArray, histogramArray=[], parameterAr TableColumn(title="Value", field="value"), TableColumn(title="Is active", field="active"), ] - widget = DataTable(columns=columns) + widget = DataTable(columns=columns, sizing_mode=optionLocal.get("sizing_mode", "inherit")) selectionTables.append(widget) plotArray.append(widget) if "name" in optionLocal: @@ -741,7 +741,7 @@ def bokehDrawArray(dataFrame, query, figureArray, histogramArray=[], parameterAr filter.active = !this.active filter.change.emit() """)) - widgetFull = row([widgetFull, widgetToggle]) + widgetFull = row([widgetFull, widgetToggle], sizing_mode=optionLocal.get("sizing_mode", "inherit")) plotArray.append(widgetFull) if "name" in optionWidget: plotDict[optionWidget["name"]] = widgetFull @@ -1291,7 +1291,7 @@ def bokehDrawArray(dataFrame, query, figureArray, histogramArray=[], parameterAr selectionCDS.data = selectionTableData for i in selectionTables: i.source = selectionCDS - i.view = CDSView(source=selectionCDS) + i.view = CDSView() if isinstance(options['layout'], list) or isinstance(options['layout'], dict): pAll = processBokehLayoutArray(options['layout'], plotArray, plotDict) if options['doDraw']: @@ -2254,7 +2254,7 @@ def makeCdsSel(cdsDict, paramDict, key): cds_used["cdsSel"] = cdsSel return cdsSel -def makeDescriptionTable(cdsDict, cdsName, fields, meta_fields): +def makeDescriptionTable(cdsDict, cdsName, fields, meta_fields, **kwargs): cds = ColumnDataSource() new_dict = {} columns = [] @@ -2270,4 +2270,4 @@ def makeDescriptionTable(cdsDict, cdsName, fields, meta_fields): new_dict[i] = column columns.append(TableColumn(field=i, title=i)) cds.data = new_dict - return DataTable(source=cds, columns=columns) + return DataTable(source=cds, columns=columns, sizing_mode=kwargs.get("sizing_mode", "inherit")) 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"}],