PlotPyStack / guiqwt

Efficient 2D plotting Python library based on PythonQwt

Home Page:https://pypi.python.org/pypi/guiqwt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FitWidgetMixin Range button problem.

kolas001 opened this issue · comments

Hi,
There is a problem with the toggle range button in the FitWidgetMixin class: unckecking the range button keeps the last selected range. To fit on the complete range, you have to check the range button again and move the range cursor to the correct positions.

Here's the correction I made to avoid this problem, in the class FitWidgetMixin from guiqwt.widget.fit:

        def toggle_xrange(self, state):
                self.xrange.setVisible(state)
                plot = self.get_plot()
                plot.replot()
                if state:
                        plot.set_active_item(self.xrange)
                else: #if the button is unckeked then set to the complete range
                        self.autofit_prm.xmin = min(self.x)
                        self.autofit_prm.xmax = max(self.x)
                        self.xrange.set_range(self.autofit_prm.xmin, self.autofit_prm.xmax)
                self.show_xrange = state