Paper Office
paper-pptxAPI referencechart.data

CategoryChartData

paper-pptx 0.2.0 API reference

Accumulates data specifying the categories and series values for a chart and acts as a proxy for the chart data table that will be written to an Excel worksheet. Used as a parameter in :meth:shapes.add_chart and :meth:Chart.replace_data.

This object is suitable for use with category charts, i.e. all those having a discrete set of label values (categories) as the range of their independent variable (X-axis) values. Unlike the ChartData types for charts supporting a continuous range of independent variable values (such as XyChartData), CategoryChartData has a single collection of category (X) values and each data point in its series specifies only the Y value. The corresponding X value is inferred by its position in the sequence.

Attributes

categories

attributecategories

data.Categories object providing access to category-object hierarchy.

Assigning an iterable of category labels (strings, numbers, or dates) replaces the data.Categories object with a new one containing a category for each label in the sequence.

Creating a chart from chart data having date categories will cause the chart to have a DateAxis for its category axis.

categories_ref

attributecategories_ref

The Excel worksheet reference to the categories for this chart (not including the column heading).

number_format

attributenumber_format

The formatting template string, e.g. '#,##0.0', that determines how X and Y values are formatted in this chart and in the Excel spreadsheet. A number format specified on a series will override this value for that series. Likewise, a distinct number format can be specified for a particular data point within a series.

xlsx_blob

attributexlsx_blob

Return a blob containing an Excel workbook file populated with the contents of this chart data object.

Functions

__getitem__

func__getitem__(index)
paramindex

__len__

func__len__()

add_category

funcadd_category(label)

Return a newly created data.Category object having label and appended to the end of the category collection for this chart. label can be a string, a number, a datetime.date, or datetime.datetime object. All category labels in a chart must be the same type. All category labels in a chart having multi-level categories must be strings.

paramlabel

add_series

funcadd_series(name, values=(), number_format=None)

Add a series to this data set entitled name and having the data points specified by values, an iterable of numeric values. number_format specifies how the series values will be displayed, and may be a string, e.g. '#,##0' corresponding to an Excel number format.

paramname
paramvalues
= ()
paramnumber_format
= None

append

funcappend(series)
paramseries

data_point_offset

funcdata_point_offset(series)

The total integer number of data points appearing in the series of this chart that are prior to series in this sequence.

paramseries

series_index

funcseries_index(series)

Return the integer index of series in this sequence.

paramseries

series_name_ref

funcseries_name_ref(series)

Return the Excel worksheet reference to the cell containing the name for series.

paramseries

values_ref

funcvalues_ref(series)

The Excel worksheet reference to the values for series (not including the column heading).

paramseries

x_values_ref

funcx_values_ref(series)

The Excel worksheet reference to the X values for series (not including the column label).

paramseries

xml_bytes

funcxml_bytes(chart_type)

Return a blob containing the XML for a chart of chart_type containing the series in this chart data object, as bytes suitable for writing directly to a file.

paramchart_type

y_values_ref

funcy_values_ref(series)

The Excel worksheet reference to the Y values for series (not including the column label).

paramseries

On this page