Formatters Reference

Formatters

class cubes.TextTableFormatter(aggregate_format=None)
class cubes.SimpleDataTableFormatter(levels=None)

Creates a formatter that formats result into a tabular structure.

class cubes.SimpleHTMLTableFormatter(create_links=True, table_style=None)

Create a simple HTML table formatter

class cubes.CrossTableFormatter(aggregates_on=None)

Creates a cross-table formatter.

Arguments:

  • aggregates_on – specify how to put aggregates in the table. Might be one of rows, columns or cells (default).

If aggregates are put on rows or columns, then respective row or column is added per aggregate. The data contains single aggregate values.

If aggregates are put in the table as cells, then the data contains tuples of aggregates in the order as specified in the aggregates argument of format() method.

format(result, onrows=None, oncolumns=None, aggregates=None, aggregates_on=None)

Creates a cross table from a drilldown (might be any list of records). onrows contains list of attribute names to be placed at rows and oncolumns contains list of attribute names to be placet at columns. aggregates is a list of aggregates to be put into cells. If aggregates are not specified, then only record_count is used.

Returns a named tuble with attributes:

  • columns - labels of columns. The tuples correspond to values of attributes in oncolumns.
  • rows - labels of rows as list of tuples. The tuples correspond to values of attributes in onrows.
  • data - list of aggregate data per row. Each row is a list of aggregate tuples.
class cubes.HTMLCrossTableFormatter(aggregates_on='cells', measure_labels=None, aggregation_labels=None, measure_label_format=None, count_label=None, table_style=None)

Create a simple HTML table formatter. See CrossTableFormatter for information about arguments.

See also

Data Formatters
Formatters documentation.

Table Of Contents

Previous topic

Aggregation Browser Reference

Next topic

Aggregation Browsing Backends

This Page