def _altair_hline_(self, xfield, yfield, opts, style, encode):
        """
        Get a mean line chart
        """
        try:
            rawy = yfield
            if ":" in yfield:
                rawy = yfield.split(":")[0]
            mean = self.df[rawy].mean()
            l = []
            i = 0
            while i < len(self.df[rawy]):
                l.append(mean)
                i += 1
            self.df["Mean"] = l
            chart = Chart(self.df).mark_line(**style).encode(x=xfield, \
                                            y="Mean", **encode).properties(**opts)
            self.drop("Mean")
            return chart
        except Exception as e:
            self.err(e, "Can not draw mean line chart")
def _altair_hline_ ( self , xfield , yfield , opts , style , encode ) : try : rawy = yfield if ":" in yfield : rawy = yfield . split ( ":" ) [ 0 ] mean = self . df [ rawy ] . mean ( ) l = [ ] i = 0 while i < len ( self . df [ rawy ] ) : l . append ( mean ) i += 1 self . df [ "Mean" ] = l chart = Chart ( self . df ) . mark_line ( ** style ) . encode ( x = xfield , y = "Mean" , ** encode ) . properties ( ** opts ) self . drop ( "Mean" ) return chart except Exception as e : self . err ( e , "Can not draw mean line chart" )
Get a mean line chart