Changeset d3ca363 in sasview for src/sas/qtgui/Plotter.py


Ignore:
Timestamp:
Dec 19, 2016 6:05:25 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
257bd57
Parents:
9290b1a
Message:

Setting graph range - SASVIEW-381

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Plotter.py

    r9290b1a rd3ca363  
    99from sas.qtgui.PlotterBase import PlotterBase 
    1010from sas.qtgui.AddText import AddText 
     11from sas.qtgui.SetGraphRange import SetGraphRange 
    1112 
    1213class PlotterWidget(PlotterBase): 
     
    206207        Show a dialog allowing setting the chart ranges 
    207208        """ 
    208         print("onSetGraphRange") 
    209         pass 
     209        # min and max of data 
     210        x_range = self.ax.get_xlim() 
     211        y_range = self.ax.get_ylim() 
     212        self.setRange = SetGraphRange(parent=self, 
     213            x_range=x_range, y_range=y_range) 
     214        if self.setRange.exec_() == QtGui.QDialog.Accepted: 
     215            x_range = self.setRange.xrange() 
     216            y_range = self.setRange.yrange() 
     217            if x_range is not None and y_range is not None: 
     218                self.ax.set_xlim(x_range) 
     219                self.ax.set_ylim(y_range) 
     220                self.canvas.draw_idle() 
    210221 
    211222    def onResetGraphRange(self): 
    212223        """ 
    213         Resets the chart X and Y ranges to the original values 
    214         """ 
    215         print("onResetGraphRange") 
    216         pass 
     224        Resets the chart X and Y ranges to their original values 
     225        """ 
     226        x_range = (self.data.x.min(), self.data.x.max()) 
     227        y_range = (self.data.y.min(), self.data.y.max()) 
     228        if x_range is not None and y_range is not None: 
     229            self.ax.set_xlim(x_range) 
     230            self.ax.set_ylim(y_range) 
     231            self.canvas.draw_idle() 
    217232 
    218233    def xyTransform(self, xLabel="", yLabel=""): 
Note: See TracChangeset for help on using the changeset viewer.