          super().__init__(parent, data, ylabel)
          self.thread = None  # Thread for LongRunningTask
          self.add_callback()
  
      def add_callback(self):
          """ Add the variable trace to update graph on recent button or save iteration """
          get_config().tk_vars["refreshgraph"].trace("w", self.refresh)
  
 
</s> remove         GraphBase.__init__(self, parent, data, ylabel)
 </s> add         super().__init__(parent, data, ylabel) </s> remove             graph.calcs.args["smooth_amount"] = smooth_amount
 </s> add             graph.calcs.set_smooth_amount(smooth_amount)

    def _iteration_limit_callback(self, *args):
        """ Limit the amount of data displayed in the live graph on a iteration slider
        variable change. """
        try:
            limit = self.vars["display_iterations"].get()
        except tk.TclError:
            # Don't update when there is no value in the variable
            return
        logger.debug("Updating graph iteration limit: (new_value: %s, args: %s)",
                     limit, args)
        for graph in self.subnotebook.children.values():
            graph.calcs.set_iterations_limit(limit)

    def _display_data_callback(self, line, variable):
        """ Update the displayed graph lines based on option check button selection.

        Parameters
        ----------
        line: str
            The line to hide or display
        variable: :class:`tkinter.BooleanVar`
            The tkinter variable containing the ``True`` or ``False`` data for this display item
        """
        var = variable.get()
        logger.debug("Updating display %s to %s", line, var)
        for graph in self.subnotebook.children.values():
            graph.calcs.update_selections(line, var) </s> remove         GraphBase.__init__(self, parent, data, ylabel)
 </s> add         super().__init__(parent, data, ylabel) </s> remove         smooth_amount = get_config().tk_vars["smoothgraph"].get()
 </s> add         try:
            smooth_amount = self.vars["smoothgraph"].get()
        except tk.TclError:
            # Don't update when there is no value in the variable
            return </s> remove         self.add_option_refresh()
 </s> add         self._add_option_refresh()
        self._displayed_keys = []
          super().__init__(parent, data, ylabel)
          self.thread = None  # Thread for LongRunningTask
        self._displayed_keys = []
          self.add_callback()
  
      def add_callback(self):
          """ Add the variable trace to update graph on recent button or save iteration """
          get_config().tk_vars["refreshgraph"].trace("w", self.refresh)
  
keep add keep keep keep keep keep keep
 GUI - Stats optimization (#1067)

* Faster stat loading + caching

* Compress data in cache

* Optimize some calculations

* Vectorize smoothing

* stats.Calculations optimized

* Load latest training data from live iterator

* Add options to training graph 
lib/gui/display_graph.py