Class ChartDiagram

class ooodev.calc.chart2.chart_diagram.ChartDiagram(owner, component, diagram_kind, lo_inst=None)[source]

Bases: LoInstPropsPartial, DiagramComp, ChartDocPropPartial, QiPartial, ServicePartial, TheDictionaryPartial, StylePartial, CalcDocPropPartial, CalcSheetPropPartial

Class for managing Chart2 Diagram.

Parameters:
__init__(owner, component, diagram_kind, lo_inst=None)[source]

Constructor

Parameters:
  • component (Any) – UNO Chart2 Title Component.

  • lo_inst (LoInst, optional) – Lo Instance. Use when creating multiple documents. Defaults to None.

  • owner (ChartDoc) –

  • diagram_kind (ChartDiagramKind) –

Return type:

None

add_coordinate_system(coord_sys)

Add a coordinate system to the coordinate system container

Raises:

com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Return type:

None

Parameters:

coord_sys (com.sun.star.chart2.XCoordinateSystem) –

apply_styles(*styles, **kwargs)

Applies style to component.

Parameters:
  • obj. (styles expandable list of styles object such as Font to apply to) –

  • kwargs (Any, optional) – Expandable list of key value pairs.

  • styles (StyleT) –

Return type:

None

get_coordinate_system()[source]

Gets the first Coordinate System Component.

Return type:

CoordinateGeneral | None

get_coordinate_systems()[source]

Gets all coordinate systems

Return type:

Tuple[CoordinateGeneral, ...]

get_default_color_scheme()

Gets an XColorScheme that defines the default colors for data series (or data points) in the diagram.

Return type:

XColorScheme

get_floor()[source]

Gets the ChartFloor that contains the property set that determines the visual appearance of the wall.

Returns:

Floor Component.

Return type:

ChartFloor

get_legend()[source]

Gets the Legend Component.

Returns:

Legend Component if found, otherwise None.

Return type:

ChartLegend | None

get_services()

Gets service names for the instance.

Returns:

service names

Return type:

List[str]

get_title()[source]

Gets the Title Diagram Component. This might be considered to be a subtitle.

Return type:

ChartTitle[ChartDiagram] | None

get_title_object()

get the object holding the title’s content and formatting

Return type:

XTitle

get_wall()[source]

Gets the ChartWall that contains the property set that determines the visual appearance of the wall.

Returns:

Wall Component.

Return type:

ChartWall

qi(atype, raise_err=False)

Generic method that get an interface instance from an object.

Parameters:
  • atype (T) – Interface type to query obj for. Any Uno class that starts with ‘X’ such as XInterface

  • raise_err (bool, optional) – If True then raises MissingInterfaceError if result is None. Default False

Raises:

MissingInterfaceError – If ‘raise_err’ is ‘True’ and result is None

Returns:

instance of interface if supported; Otherwise, None

Return type:

T | None

Note

When raise_err=True return value will never be None.

remove_coordinate_system(coord_sys)

Removes one coordinate system from the coordinate system container.

Raises:

com.sun.star.container.NoSuchElementExceptionNoSuchElementException

Return type:

None

Parameters:

coord_sys (com.sun.star.chart2.XCoordinateSystem) –

set_coordinate_systems(*systems)

Set all coordinate systems.

Raises:

com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Return type:

None

Parameters:

systems (com.sun.star.chart2.XCoordinateSystem) –

set_default_color_scheme(color_scheme)

Sets an XColorScheme that defines the default colors for data series (or data points) in the diagram.

Return type:

None

Parameters:

color_scheme (com.sun.star.chart2.XColorScheme) –

set_diagram_data(data_source, *args)

Sets new data to the diagram.

For standard parameters that may be used, see the service StandardDiagramCreationParameters.

Return type:

None

Parameters:
  • data_source (com.sun.star.chart2.data.XDataSource) –

  • args (PropertyValue) –

set_legend(legend)

Sets a new legend.

Return type:

None

Parameters:

legend (com.sun.star.chart2.XLegend) –

set_title(title)[source]

Adds a Chart Title.

Return type:

ChartTitle[ChartDiagram]

Parameters:

title (str) –

set_title_object(title)

set a new title object replacing the former one

Return type:

None

Parameters:

title (com.sun.star.chart2.XTitle) –

support_service(*service)

Gets if instance supports a service.

Parameters:

*service (str) – Variable length argument list of UNO namespace strings such as com.sun.star.configuration.GroupAccess

Returns:

True if instance supports any passed in service; Otherwise, False

Return type:

bool

view_legend(visible)[source]

Shows or hides the legend.

Parameters:

visible (bool) – True to show the legend, False to hide it.

Return type:

None

Note

If the legend is not found then it will be created if visible is True.

Return type:

None

Parameters:

visible (bool) –

property calc_doc: CalcDoc

Calc Document.

Return type:

CalcDoc

property calc_sheet: CalcSheet

Calc Sheet.

Return type:

CalcSheet

property chart_doc: ChartDoc

Chart Document.

Return type:

ChartDoc

property component: com.sun.star.chart2.Diagram

Diagram Component

Return type:

Diagram

property connect_bars: bool | None

Gets/Sets - Draw connection lines for stacked bar charts.

optional

Return type:

bool | None

property data_table_h_border: bool | None

Gets/Sets - Chart Data table flags.

optional

Return type:

bool | None

property data_table_outline: bool | None

Gets/Sets the Data Table Outline property.

optional

Return type:

bool | None

property data_table_v_border: bool | None

Gets/Sets the Data Table V Border property.

optional

Return type:

bool | None

property diagram_kind: ChartDiagramKind

Gets the diagram kind.

Return type:

ChartDiagramKind

property external_data: str | None

Gets/Sets the External Data property.

optional

Return type:

str | None

property extra_data: TheDict

Extra Data Key Value Pair Dictionary.

Properties can be assigned properties and access like a dictionary and with dot notation.

Note

This is a dictionary object that can be used to store key value pairs. Generally speaking this data is not part of the object’s main data structure and is not saved with the object (document).

This property is used to store data that is not part of the object’s main data structure and can be used however the developer sees fit.

Return type:

TheDict

property floor: ChartFloor

Gets the ChartFloor that contains the property set that determines the visual appearance of the wall.

Return type:

ChartFloor

property group_bars_per_axis: bool | None

Gets/Sets if bars of a bar or column chart are attached to different axis, this property determines how to display those.

If True, the bars are grouped together in one block for each axis, thus they are painted one group over the other.

If False, the bars are displayed side-by-side, as if they were all attached to the same axis.

If all data series of a bar or column chart are attached to only one axis, this property has no effect.

optional

Return type:

bool | None

property lo_inst: LoInst

Lo Instance

Return type:

LoInst

property missing_value_treatment: int | None

Gets/Sets how empty or invalid cells in the provided data should be handled when displayed.

optional

Return type:

int | None

property office_doc: OfficeDocumentT

Office Document.

Return type:

OfficeDocumentT

property perspective: int | None

Gets/Sets perspective of 3D charts ( [0,100] ).

optional

Return type:

int | None

property pos_size_exclude_labels: bool | None

The attributes RelativePosition and RelativeSize should be used for the inner coordinate region without axis labels and without data labels.

optional

Return type:

bool | None

property relative_position: RelativePosition | None

The position is as a relative position on the page.

If a relative position is given the diagram is not automatically placed, but instead is placed relative on the page.

May be None

Return type:

RelativePosition | None

property relative_size: com.sun.star.chart2.RelativeSize

The size of the diagram as relative size of the page size.

Return type:

RelativeSize

property right_angled_axes: bool | None

Gets/Sets Right Angled Axes property.

optional

Return type:

bool | None

property rotation_horizontal: int | None

Gets/Sets horizontal rotation of 3D charts in degrees ( [-180,180] ).

optional

Return type:

int | None

property rotation_vertical: int | None

Gets/Sets vertical rotation of 3D charts in degrees ( ]-180,180] ).

optional

Return type:

int | None

property sort_by_x_values: bool | None

Gets/Sets - Sort data points by x values for rendering.

optional

Return type:

bool | None

property starting_angle: int | None

Gets/Sets - Starting angle in degrees for pie charts and doughnut charts.

optional

Return type:

int | None

property wall: ChartWall

Gets the ChartFloor that contains the property set that determines the visual appearance of the wall.

Return type:

ChartWall