示例#1
0
    def plot(self) -> Chart:
        analysis = RecipesPopularityAnalysis(self.recipe_scope)
        df = analysis.popularity_per_fermentable(num_top=8)
        if len(df) == 0:
            raise NoDataException()

        figure = LinesChart(force_legend=True).plot(df, 'month',
                                                    'recipes_percent',
                                                    'fermentable', None,
                                                    '% of Style Recipes')
        return Chart(figure,
                     height=Chart.DEFAULT_HEIGHT * 0.66,
                     title=self.get_chart_title())
示例#2
0
    def plot(self) -> Chart:
        analysis = RecipesPopularityAnalysis(self.recipe_scope)
        df = analysis.popularity_per_yeast(num_top=8, top_months=24)
        if len(df) <= 1:  # 1, because a single data point is also meaningless
            raise NoDataException()

        figure = LinesChart(force_legend=True).plot(df, 'month',
                                                    'recipes_percent', 'yeast',
                                                    'Month/Year',
                                                    '% of All Recipes')
        return Chart(figure,
                     height=Chart.DEFAULT_HEIGHT * 0.66,
                     title=self.get_chart_title())
示例#3
0
    def plot(self) -> Chart:
        df = StyleAnalysis(
            self.style).popular_fermentables(type_filter=self.filter_param)
        if len(df) == 0:
            raise NoDataException()

        figure = LinesChart(force_legend=True).plot(df, 'month',
                                                    'recipes_percent',
                                                    'fermentable', None,
                                                    '% of Style Recipes')
        return Chart(figure,
                     height=Chart.DEFAULT_HEIGHT * 0.66,
                     title=self.get_chart_title())