Chart Module

This submodule contains the Chart class definition.

class chromaquant.chart.chart.Chart(chart: ChartBase = <openpyxl.chart._chart.ChartBase object> Parameters: roundedCorners=None, visible_cells_only=True, display_blanks='gap', style=None, indep_column: _ColumnID = None, data_columns: list[_ColumnID] = [], theme: Theme | None = None, titles_from_data: bool = True, anchor: str = '', sheet: str = '')

Chart objects enable the creation of charts in Results Excel reports.

Parameters

chartChartBase, optional

The openpyxl chart (e.g., ScatterChart) to base this Chart off of, by default ChartBase()

indep_column_ColumnID, optional

The ColumnID referencing a column in a Table or Breakdown to use for independent variable data (e.g., categories for BarChart), by default None

data_columnslist[_ColumnID], optional

A list of ColumnID’s, each referencing a column in a Table or Breakdown to use for dependent variable data, by default []

themeTheme | None, optional

The Theme to use in formatting the Chart, by default None

titles_from_databool, optional

Whether to use the first row in data ranges as Series titles, by default True

anchorstr, optional

The cell to anchor the chart to, by default ‘C15’

sheetstr, optional

The worksheet to place the chart in, by default ‘Sheet1’

Raises

ValueError:

If passed anchor cell is not valid.

ValueError:

If sheet is set to a blank string.

add_data_column(column)

Method to add a data ColumnID to the list of data columns.

Parameters

columnColumnID

Column to add to the current list of column data.

Returns

None

property anchor

Get or set the anchor cell to report to.

property base

Get or set the base openpyxl Chart object.

property data_columns

Get, set, or delete the ColumnID’s for the data series.

property data_references

Get the References for the current data ColumnID’s.

static get_cell_indices(cell: str) tuple[int, int]

Static method that returns the absolute indices of a cell.

Parameters

cellstr

Cell reference (e.g., ‘A1’, ‘$B$2’).

Returns

column_index: int

Absolute index of the reference column (e.g., 2 for ‘C1’).

row_index: int

Absolute index of the reference row (e.g., 0 for ‘C1’).

property indep_column

Get, set, or delete the ColumnID for the independent axis.

property indep_reference

Get the Reference for the current independent ColumnID.

property sheet: str

Get or set the name of the Excel worksheet to report to.

property theme

Get or set the Theme to use for this Chart.

property titles_from_data

Get or set a boolean determining whether to get Series titles from data ranges.