(self, agg_dict)
return data
Returns an aggregation object from an aggregation dict.

        Args:
            agg_dict (dict): a dictionary containing information
                about the stored aggregation.

        Returns:
            A dict that contains metadata about the aggregation group
            as well as a chart object (instance of altair.Chart)
            with the combined chart object from the group.
Returns an aggregation object from an aggregation dict.
Returns an aggregation object from an aggregation dict .
def get_aggregation_group(self, agg_dict):
        """Returns an aggregation object from an aggregation dict.

        Args:
            agg_dict (dict): a dictionary containing information
                about the stored aggregation.

        Returns:
            A dict that contains metadata about the aggregation group
            as well as a chart object (instance of altair.Chart)
            with the combined chart object from the group.
        """
        group_id = agg_dict.get('id')
        if not group_id:
            return None

        group = AggregationGroup.query.get(group_id)
        if not group:
            return None

        orientation = group.orientation

        result_chart = None
        for aggregator in group.aggregations:
            if aggregator.parameters:
                aggregator_parameters = json.loads(aggregator.parameters)
            else:
                aggregator_parameters = {}

            agg_class = aggregator_manager.AggregatorManager.get_aggregator(
                aggregator.agg_type)
            if not agg_class:
                continue



            index = aggregator_parameters.pop('index', None)
            aggregator_obj = agg_class(sketch_id=self._sketch_id, index=index)
            chart_type = aggregator_parameters.pop('supported_charts', None)
            color = aggregator_parameters.pop('chart_color', '')
            chart_title = aggregator_parameters.pop('chart_title', None)
            result_obj = aggregator_obj.run(**aggregator_parameters)

            title = chart_title or aggregator_obj.chart_title

            chart = result_obj.to_chart(
                chart_name=chart_type,
                chart_title=title,
                as_chart=True, interactive=True, color=color)

            if result_chart is None:
                result_chart = chart
            elif orientation == 'horizontal':
                result_chart = alt.hconcat(chart, result_chart)
            elif orientation == 'vertical':
                result_chart = alt.vconcat(chart, result_chart)
            else:
                result_chart = alt.layer(chart, result_chart)

        data = {
            'name': group.name,
            'description': group.description,
            'chart': result_chart,
            'parameters': group.parameters,
            'orientation': group.orientation,
            'user': group.user,
        }
        return data
def get_aggregation_group ( self , agg_dict ) : group_id = agg_dict . get ( 'id' ) if not group_id : return None group = AggregationGroup . query . get ( group_id ) if not group : return None orientation = group . orientation result_chart = None for aggregator in group . aggregations : if aggregator . parameters : aggregator_parameters = json . loads ( aggregator . parameters ) else : aggregator_parameters = { } agg_class = aggregator_manager . AggregatorManager . get_aggregator ( aggregator . agg_type ) if not agg_class : continue index = aggregator_parameters . pop ( 'index' , None ) aggregator_obj = agg_class ( sketch_id = self . _sketch_id , index = index ) chart_type = aggregator_parameters . pop ( 'supported_charts' , None ) color = aggregator_parameters . pop ( 'chart_color' , '' ) chart_title = aggregator_parameters . pop ( 'chart_title' , None ) result_obj = aggregator_obj . run ( * * aggregator_parameters ) title = chart_title or aggregator_obj . chart_title chart = result_obj . to_chart ( chart_name = chart_type , chart_title = title , as_chart = True , interactive = True , color = color ) if result_chart is None : result_chart = chart elif orientation == 'horizontal' : result_chart = alt . hconcat ( chart , result_chart ) elif orientation == 'vertical' : result_chart = alt . vconcat ( chart , result_chart ) else : result_chart = alt . layer ( chart , result_chart ) data = { 'name' : group . name , 'description' : group . description , 'chart' : result_chart , 'parameters' : group . parameters , 'orientation' : group . orientation , 'user' : group . user , } return data