(
            self, data, title='', supported_charts='table', field=None,
            order_field='count')
return interface.AggregationResult(
            encoding=encoding, values=data, chart_type=supported_charts)
Run the aggregation.

        Args:
            data: list of dict objects, each entry in the list is a
                dictionary, representing a single entry in the aggregation.
            title: string with the aggregation title.
            supported_charts: Chart type to render. Defaults to table.
            field: What field to aggregate on.
            order_field: The name of the field that is used for the order
                of items in the aggregation, defaults to "count".

        Returns:
            Instance of interface.AggregationResult with aggregation result.

        Raises:
            ValueError: data is not supplied.
Run the aggregation.
Run the aggregation .
def run(
            self, data, title='', supported_charts='table', field=None,
            order_field='count'):
        """Run the aggregation.

        Args:
            data: list of dict objects, each entry in the list is a
                dictionary, representing a single entry in the aggregation.
            title: string with the aggregation title.
            supported_charts: Chart type to render. Defaults to table.
            field: What field to aggregate on.
            order_field: The name of the field that is used for the order
                of items in the aggregation, defaults to "count".

        Returns:
            Instance of interface.AggregationResult with aggregation result.

        Raises:
            ValueError: data is not supplied.
        """
        if not data:
            raise ValueError('Data is missing')

        self.title = title

        if not field:
            keys = set()
            for row in data:
                list(map(keys.add, row.keys()))
            keys.discard('count')
            keys.discard('bucket_name')
            if keys:
                field = list(keys)[0]
            else:
                field = 'count'

        # Encoding information for Vega-Lite.
        encoding = {
            'x': {
                'field': field,
                'type': 'nominal',
                'sort': {
                    'op': 'sum',
                    'field': order_field,
                    'order': 'descending'
                }
            },
            'y': {'field': 'count', 'type': 'quantitative'}
        }

        return interface.AggregationResult(
            encoding=encoding, values=data, chart_type=supported_charts)
def run ( self , data , title = '' , supported_charts = 'table' , field = None , order_field = 'count' ) : if not data : raise ValueError ( 'Data is missing' ) self . title = title if not field : keys = set ( ) for row in data : list ( map ( keys . add , row . keys ( ) ) ) keys . discard ( 'count' ) keys . discard ( 'bucket_name' ) if keys : field = list ( keys ) [ 0 ] else : field = 'count' # Encoding information for Vega-Lite. encoding = { 'x' : { 'field' : field , 'type' : 'nominal' , 'sort' : { 'op' : 'sum' , 'field' : order_field , 'order' : 'descending' } } , 'y' : { 'field' : 'count' , 'type' : 'quantitative' } } return interface . AggregationResult ( encoding = encoding , values = data , chart_type = supported_charts )