Commit 1fef5c4d authored by Valentin Valls's avatar Valentin Valls

Create a display name for items

parent 283b0c98
......@@ -93,6 +93,10 @@ class CurveMixIn:
return None
return data.array()
def displayName(self, axisName, scan: scan_model.Scan) -> str:
"""Helper to reach the axis display name"""
raise NotImplementedError()
class CurveItem(plot_model.Item, CurveMixIn):
"""Define a curve as part of a plot.
......@@ -190,6 +194,15 @@ class CurveItem(plot_model.Item, CurveMixIn):
return None
return data
def displayName(self, axisName, scan: scan_model.Scan) -> str:
"""Helper to reach the axis display name"""
if axisName == "x":
return self.xChannel().displayName(scan)
elif axisName == "y":
return self.yChannel().displayName(scan)
else:
assert False
class McaPlot(plot_model.Plot):
"""Define a plot which is specific for MCAs."""
......
......@@ -148,6 +148,16 @@ class DerivativeItem(
result = DerivativeData(xx, yy, nextNb)
return result
def displayName(self, axisName, scan: scan_model.Scan) -> str:
"""Helper to reach the axis display name"""
sourceItem = self.source()
if axisName == "x":
return sourceItem.displayName("x", scan)
elif axisName == "y":
return "d(%s)" % sourceItem.displayName("y", scan)
else:
assert False
class MaxData(NamedTuple):
max_index: int
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment