This fixes a bug in the BasePlotAxisItem class where the name property will be set internally, but the axis' associated MultiAxisPlot will contain a dictionary with the wrong key-value pairing for the axis object.
AxisItem name bug example scenario:
Create a BasePlotAxisItem with name "A"
my_axis = BasePlotAxisItem(name="A")
Change the name of the previous BasePlotAxisItem to "B"
my_axis.name = "B"
Create a BasePlotCurveItem and attach it to the BasePlotAxisItem using its new name
my_curve = BasePlotCurveItem(yAxisName = "B")
This scenario produces a KeyError as the MultiAxisPlot.axes dictionary still uses "A" as the key to reference my_axis, but it should use "B".
Solution:
Include a method in MultiAxisPlot for changing the name/key of an axis. Then, update the MultiAxisPlot.axes key in the BasePlotAxisItem.name property setter.
Another small change made in this PR is to fix the BasePlotAxisItem.label setter. Now it will call self.setLabel(self._label) to update its label on any associated plots.
This fixes a bug in the BasePlotAxisItem class where the name property will be set internally, but the axis' associated MultiAxisPlot will contain a dictionary with the wrong key-value pairing for the axis object.
AxisItem name bug example scenario:
my_axis = BasePlotAxisItem(name="A")
my_axis.name = "B"
my_curve = BasePlotCurveItem(yAxisName = "B")
This scenario produces a
KeyError
as the MultiAxisPlot.axes dictionary still uses "A" as the key to referencemy_axis
, but it should use "B".Solution: Include a method in MultiAxisPlot for changing the name/key of an axis. Then, update the MultiAxisPlot.axes key in the BasePlotAxisItem.name property setter.
Another small change made in this PR is to fix the BasePlotAxisItem.label setter. Now it will call
self.setLabel(self._label)
to update its label on any associated plots.