Index: invariantview/perspectives/invariant/invariant_panel.py
===================================================================
--- invariantview/perspectives/invariant/invariant_panel.py	(revision cb463b40545bccbeac64d10c722c2076b6c27aa0)
+++ invariantview/perspectives/invariant/invariant_panel.py	(revision a94c4e1f5dd2a18f8217845243a60b0b773415e1)
@@ -7,4 +7,5 @@
 
 import sys,os
+
 from wx.lib.scrolledpanel import ScrolledPanel
 from sans.invariant import invariant
@@ -81,5 +82,5 @@
         self.new_state = False
         self.is_power_out = False
-        
+
         #container of invariant value
         self.inv_container = None
@@ -95,5 +96,5 @@
         ## Default file location for save
         self._default_save_location = os.getcwd()
- 
+        
     def err_check_on_data(self):
         """
@@ -648,5 +649,6 @@
         from report_dialog import ReportDialog
 
-        report_string = self.state.report_str
+        self.state.set_report_string()
+        report_string = self.state.report_str 
         dialog = ReportDialog(report_string, None, -1, "")
         dialog.ShowModal()
@@ -1138,4 +1140,5 @@
         else:
             return False
+
         
     def _reset_output(self):
@@ -1701,4 +1704,6 @@
         """ 
         import sans.perspectives.invariant as invariant
+        #from wx.lib.buttons import GenBitmapTextButton
+
         path = invariant.get_data_path(media='media')
         self.undo_png = os.path.join(path,"undo.png")
@@ -1711,4 +1716,6 @@
         self.button_undo = wx.BitmapButton(self, id,wx.Bitmap(self.undo_png))#wx.Button(self, id, "Undo",size=(50,20))
         self.button_undo.SetToolTipString("Undo")
+        #self.button_undo.SetBackgroundColour('#c2e6f8')
+
         self.Bind(wx.EVT_BUTTON, self.undo, id=id)
         self.button_undo.Disable()
@@ -1724,5 +1731,4 @@
         self.button_bookmark.SetToolTipString("Bookmark: right-click on the panel to retrieve")
         self.Bind(wx.EVT_BUTTON, self._on_bookmark, id=id)
-        #self.button_bookmark.Disable()
         #report button
         id = wx.NewId()
Index: invariantview/perspectives/invariant/invariant_state.py
===================================================================
--- invariantview/perspectives/invariant/invariant_state.py	(revision cb463b40545bccbeac64d10c722c2076b6c27aa0)
+++ invariantview/perspectives/invariant/invariant_state.py	(revision a94c4e1f5dd2a18f8217845243a60b0b773415e1)
@@ -93,4 +93,6 @@
         self.timestamp = "('00:00:00', '00/00/0000')"
         self.container = None
+        #plot image
+        self.wximbmp = None
         # report_html strings
         import sans.perspectives.invariant as invariant
@@ -487,6 +489,11 @@
                     continue
 
-        self.report_str = str(self.template_str)% (s_1,s_2,s_3,s_4,s_5,s_6,s_7,s_8,s_9,s_10,s_11,s_12,s_13,s_14,s_15,s_16,s_17,s_18)
-
+        # make plot image
+        self.set_plot_state(extra_high=bool_0[1],extra_low=bool_1[1])
+        
+        # get ready for report with setting all the html strings
+        self.report_str = str(self.template_str)% (s_1,s_2,s_3,s_4,s_5,s_6,s_7,s_8,s_9,s_10,s_11,s_12,s_13,s_14,s_15,s_16,s_17,s_18,self.file,self.wximbmp)
+    
+    
     def set_saved_state(self, name, value):
         """
@@ -520,5 +527,55 @@
             pass
 
-
+    def set_plot_state(self,extra_high=False,extra_low=False):
+        """
+        Build image state that wx.html understand
+        by plotting, putting it into wx.FileSystem image object
+        
+        : extrap_high,extra_low: low/high extrapolations are possible extra-plots
+        """
+        # some imports
+        import cStringIO
+        import matplotlib,wx
+        matplotlib.use('Agg')
+        import matplotlib.pyplot as plt
+        import Image
+        
+        #we use simple plot, not plotpanel
+        #make matlab figure
+        fig = plt.figure()
+        graph = fig.add_subplot(111)
+        
+        #data plot
+        graph.errorbar(self.data.x, self.data.y, yerr=self.data.dy, fmt='o')
+        #low Q extrapolation fit plot
+        if not extra_low == 'False':
+            graph.plot(self.theory_lowQ.x,self.theory_lowQ.y)
+        #high Q extrapolation fit plot
+        if not extra_high == 'False':
+            graph.plot(self.theory_highQ.x,self.theory_highQ.y)
+        graph.set_xscale("log", nonposx='clip')
+        graph.set_yscale("log", nonposy='clip')
+        plt.xlabel('$\\rm{Q}(\\AA^{-1})$', fontsize = 12)
+        plt.ylabel('$\\rm{Intensity}(cm^{-1})$', fontsize = 12)
+
+        #make python.Image object
+        imagedata = cStringIO.StringIO()
+        fig.savefig(imagedata,format='png')
+        imagedata.seek(0)
+        img = Image.open(imagedata) 
+        #convert to wx.Image
+        wxim = wx.EmptyImage(img.size[0],img.size[1])
+        wxim.SetData(img.convert("RGB").tostring())  
+        #get the dynamic image for the htmlwindow
+        wximbmp = wx.BitmapFromImage(wxim)
+        #store the image in wx.FileSystem Object 
+        wx.FileSystem.AddHandler(wx.MemoryFSHandler())
+        # use wx.MemoryFSHandler
+        self.imgRAM = wx.MemoryFSHandler()
+        #AddFile, image can be retrieved with 'memory:filename'
+        self.imgRAM.AddFile('img_inv.png',wximbmp, wx.BITMAP_TYPE_PNG)
+        
+        self.wximbmp = 'memory:img_inv.png'
+            
 
 class Reader(CansasReader):
Index: invariantview/perspectives/invariant/report_dialog.py
===================================================================
--- invariantview/perspectives/invariant/report_dialog.py	(revision cb463b40545bccbeac64d10c722c2076b6c27aa0)
+++ invariantview/perspectives/invariant/report_dialog.py	(revision a94c4e1f5dd2a18f8217845243a60b0b773415e1)
@@ -18,5 +18,5 @@
 import sys,os
 import wx.html as html
-
+import Image
 if sys.platform.count("win32")>0:
     _STATICBOX_WIDTH = 450
@@ -45,4 +45,5 @@
         kwds["style"] = wx.RESIZE_BORDER|wx.DEFAULT_DIALOG_STYLE
         wx.Dialog.__init__(self, *args, **kwds)
+        kwds["image"] = 'Dynamic Image'
         # title
         self.SetTitle("Report: Invariant computaion")
@@ -55,5 +56,5 @@
         # layout
         self._setup_layout()
-
+        
     def _setup_layout(self):
         """
@@ -75,5 +76,5 @@
         button_preview.SetToolTipString("Print preview this report.")
         button_preview.Bind(wx.EVT_BUTTON, self.onPreview, id = button_preview.GetId()) 
-        #hbox.Add(button_preview)
+        hbox.Add(button_preview)
 
         id = wx.NewId()
@@ -100,20 +101,46 @@
         self.Show(True)
 
-    def onSave(self,event):
+    def onSave(self,event=None):
         """
+        Save
         """
-        pass
+        #todo: complete saving fig file and as a txt file
+        dlg = wx.FileDialog(self, "Choose a file",\
+                            wildcard ='HTML files (*.html)|*.html|'+
+                            'Text files (*.txt)|*.txt',
+                            style = wx.SAVE|wx.OVERWRITE_PROMPT|wx.CHANGE_DIR)
+        dlg.SetFilterIndex(0) #Set .html files to be default
+
+        if dlg.ShowModal() != wx.ID_OK:
+          dlg.Destroy()
+          return
+        fName = dlg.GetPath()
+        fName = os.path.splitext(fName)[0] + '.html'
+        dlg.Destroy()
     
-    def onPreview(self,event):
+        html = self.report_string
+        f = open(fName, 'w')
+        f.write(html)
+        f.close()
+
+    
+    def onPreview(self,event=None):
         """
+        Preview
+        
+        : event: Preview button event
         """
-        pass
+        previewh=html.HtmlEasyPrinting(name="Printing", parentWindow=self)
+        previewh.PreviewText(self.report_string)
     
-    def onPrint(self,event):
+    def onPrint(self,event=None):
         """
+        Print
+        
+        : event: Print button event
         """
-        gg=html.HtmlEasyPrinting(name="Printing", parentWindow=self)
-        
-        gg.PreviewText(self.report_string)
+        printh=html.HtmlEasyPrinting(name="Printing", parentWindow=self)
+        printh.PrintText(self.report_string)
+
         
         
