Get Chartjs html

def _get_chartjs_chart(self, xcol, ycol, chart_type, label=None, opts={},
                           style={}, options={}, **kwargs):
        """
        Get Chartjs html
        """
        try:
            xdata = list(self.df[xcol])
        except Exception as e:
            self.err(e, self._get_chartjs_chart,
                     "Can not get data for x field ", ycol)
            return
        if label is None:
            label = "Data"
        try:
            if type(ycol) != list:
                ydata = [dict(name=label, data=list(self.df[ycol]))]
            else:
                ydata = []
                for col in ycol:
                    y = {}
                    y["name"] = col
                    y["data"] = list(self.df[col])
                    ydata.append(y)
        except Exception as e:
            self.err(e, self._get_chartjs_chart,
                     "Can not get data for y field ", xcol)
            return
        try:
            slug = str(uuid.uuid4())
            html = chart.get(slug, xdata, ydata, label,
                             opts, style, chart_type, **kwargs)
            return html
        except Exception as e:
            self.err(e, self._get_chartjs_chart, "Can not get chart")