Using ChartData to fill your charts

class report_tools.chart_data.ChartData

The ChartData class provides a consistent way to get data into charts. Each ChartData object represents a 2 dimensional array of cells, which can be annotated on a column, row or cell level.

add_column(self, name, metadata=None)

Adds a new column to the data table.

Parameters:
  • name – The name of the column
  • metadata – A dictionary of metadata describing the column
add_columns(self, columns)

Adds multiple columns to the data table

Parameters:columns – A list of column names. If you need to enter metadata with the columns, you can also pass in a list of name-metadata tuples.
report_tools.chart_data.add_row(self, data, metadata=None)

Adds a new row to the datatable

Parameters:
  • data – A list of data points that will form the row. The length of the list should match the number of columns added.
  • metadata – A dictionary of metadata describing the row
report_tools.chart_data.add_rows(self, rows)

Adds multiple rows to the data table

Parameters:rows – A list of rows. If you need to enter metadata with the rows, you can also pass in a list of row-metadata tuples.
get_columns(self)

Returns a list of columns added so far

..method:: get_rows(self)

Returns a list of rows added so far