Index: guitools/PlotPanel.py
===================================================================
--- guitools/PlotPanel.py	(revision 061775fff762b004cf9747460d019fba7aa82fd0)
+++ guitools/PlotPanel.py	(revision f63f5ff80aa312a54707cd78d73cfbadc72cceb4)
@@ -82,5 +82,5 @@
         if len(list.keys())>0:
             first_item = list.keys()[0]
-            print first_item, list[first_item].__class__.__name__
+            #print first_item, list[first_item].__class__.__name__
             dlg = LinearFit( None, first_item, self.onFitDisplay, -1, 'Fitting')
             dlg.ShowModal() 
@@ -412,8 +412,8 @@
         """
         if dx >=x:
-            return 0.9*x
+            return math.fabs(0.9*x)
         if dx==None:
              return 0
-        return dx
+        return math.fabs(dx)
     def errFuncToX2(self,x,dx=None):
         """
@@ -426,5 +426,5 @@
             if err >= x:
                 err = 0.9*x
-            return err
+            return math.fabs(err)
         else:
             return 0.0
@@ -445,5 +445,5 @@
             err = 0.9*x
            
-            return err
+            return math.fabs(err)
         
     def errFuncToLogX(self,x,dx=None):
@@ -464,5 +464,5 @@
             err = 0.9*x
         
-        return err
+        return math.fabs(err)
         
     def errFuncfromLogXY(self,x,dx=None):
@@ -485,5 +485,5 @@
         self.graph.render(self)
         self.subplot.figure.canvas.draw_idle()
-      
+        
     
 class NoRepaintCanvas(FigureCanvasWxAgg):
Index: guitools/fitDialog.py
===================================================================
--- guitools/fitDialog.py	(revision 061775fff762b004cf9747460d019fba7aa82fd0)
+++ guitools/fitDialog.py	(revision f63f5ff80aa312a54707cd78d73cfbadc72cceb4)
@@ -26,9 +26,9 @@
         vbox.Add(panel, 1, wx.EXPAND | wx.ALL)
  
-        self.tcA = wx.TextCtrl(panel, -1,style=wx.SIMPLE_BORDER)
-        self.tcErrA = wx.TextCtrl(panel, -1,style=wx.SIMPLE_BORDER)
-        self.tcB = wx.TextCtrl(panel, -1,style=wx.SIMPLE_BORDER)
-        self.tcErrB = wx.TextCtrl(panel, -1,style=wx.SIMPLE_BORDER)
-        self.tcChi = wx.TextCtrl(panel, -1,style=wx.SIMPLE_BORDER)
+        self.tcA = wx.TextCtrl(panel, -1,size=(120,20),style=wx.SIMPLE_BORDER)
+        self.tcErrA = wx.TextCtrl(panel, -1,size=(120,20),style=wx.SIMPLE_BORDER)
+        self.tcB = wx.TextCtrl(panel, -1,size=(120,20),style=wx.SIMPLE_BORDER)
+        self.tcErrB = wx.TextCtrl(panel, -1,size=(120,20),style=wx.SIMPLE_BORDER)
+        self.tcChi = wx.TextCtrl(panel, -1,size=(120,20),style=wx.SIMPLE_BORDER)
         self.tcXmin = wx.TextCtrl(panel,-1,style=wx.SIMPLE_BORDER)
         self.tcXmax = wx.TextCtrl(panel,-1,style=wx.SIMPLE_BORDER)
@@ -93,10 +93,12 @@
         print "we are on fit"
         temp =[]
-        #tempdx =[]
+        tempdx =[]
         tempdy =[]
         xmin = self._checkVal(self.tcXmin.GetValue())
         xmax = self._checkVal(self.tcXmax.GetValue())
-        x= self.plottable.x
-        if x:
+        #x= self.plottable.view.x
+        x=self.plottable.returnXvalueOfView()
+        print "x value :" ,x
+        if x != []:
             if xmin !=None  and xmax != None:
                 for j in range(len(x)):
@@ -113,6 +115,6 @@
                 for y_i in temp:
                     tempdy.append(math.sqrt(y_i))
-                    self.tcXmin.SetValue(str(min(self.plottable.x)))
-                    self.tcXmax.SetValue(str(max(self.plottable.x)))
+                    self.tcXmin.SetValue(str(min(x)))
+                    self.tcXmax.SetValue(str(max(x)))
                     xmin = self._checkVal(self.tcXmin.GetValue())
                     xmax = self._checkVal(self.tcXmax.GetValue())
@@ -132,16 +134,27 @@
             cstB  = fittings.Parameter(self.model, 'B', default_B)        
             chisqr, out, cov = fittings.sansfit(self.model, 
-                [cstA, cstB], self.plottable.x, 
-                self.plottable.y, self.plottable.dy,xmin,xmax)
+                [cstA, cstB], self.plottable.view.x, 
+                self.plottable.view.y, self.plottable.view.dy,xmin,xmax)
             # Create new data plottable with result
             
             self.file_data1.y = []
+            #for x_i in self.file_data1.x:
             for x_i in self.file_data1.x:
                 self.file_data1.y.append(self.model.run(x_i))
                 
             self.push_data(self.file_data1)
-            
-            self._onsetValues(str(out[0]),str(out[1]),\
-            str(math.sqrt(cov[0][0])),str(math.sqrt(cov[1][1])),str(chisqr))
+            if cov ==None:
+                errA =str(0.0)
+                errB =str(0.0)
+            else:
+                errA= str(math.sqrt(cov[0][0]))
+                errB= str(math.sqrt(cov[1][1]))
+            if out==None:
+                cstA=str(0.0)
+                cstB=str(0.0)
+            else:
+                cstA=str(out[0])
+                cstB=str(out[1])
+            self._onsetValues(cstA, cstB, errA,errB,str(chisqr))
        
     def _onsetValues(self,cstA,cstB,errA,errB,Chi):
@@ -149,6 +162,6 @@
          self.tcA.SetValue(cstA)
          self.tcB.SetValue(cstB)
-         self.tcErrA.SetValue(cstB)
-         self.tcErrB.SetValue(cstA)
+         self.tcErrA.SetValue(errA)
+         self.tcErrB.SetValue(errB)
          self.tcChi.SetValue(Chi)
          
Index: guitools/plottables.py
===================================================================
--- guitools/plottables.py	(revision 061775fff762b004cf9747460d019fba7aa82fd0)
+++ guitools/plottables.py	(revision f63f5ff80aa312a54707cd78d73cfbadc72cceb4)
@@ -378,5 +378,9 @@
         """
         self.view.transform_y(func, errfunc, self.y, self.dy)
-    
+        
+    def returnXvalueOfView(self):
+        return self.view.returnXview()
+        
+        
     class View:
         """
@@ -443,4 +447,7 @@
                  else:
                      self.dy[i] = errfunc(y[i])
+                     
+        def returnXview(self):
+            return self.x
      
 class Data1D(Plottable):
