Class ChartType

class ooodev.calc.chart2.chart_type.ChartType(owner, chart_doc, component, lo_inst=None)[source]

Bases: Generic[_T], LoInstPropsPartial, ChartTypeComp, EventsPartial, ChartDocPropPartial, PropPartial, QiPartial, ServicePartial, TheDictionaryPartial, CalcDocPropPartial, CalcSheetPropPartial

Class for managing Chart2 Chart Title Component.

__init__(owner, chart_doc, component, 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 (_T) –

  • chart_doc (ChartDoc) –

Return type:

None

add_data_series(data_series)

Add a data series to the data series container

Raises:

com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Return type:

None

Parameters:

data_series (com.sun.star.chart2.XDataSeries) –

add_event_observers(*args)

Adds observers that gets their trigger method called when this class trigger method is called.

Parameters:

args (EventObserver) – One or more observers to add.

Return type:

None

Note

Observers are removed automatically when they are out of scope.

add_event_property_change(name, cb)

Adds a listener for an event.

Event is invoked when property is changed.

The callback EventArgs.event_data will contain a com.sun.star.beans.PropertyChangeEvent struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_property_change_events_disposing(name, cb)

Adds a listener for an event.

Event is invoked when the property listener is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_vetoable_change(name, cb)

Adds a listener for an event.

Event is invoked when property is changed.

The callback EventArgs.event_data will contain a com.sun.star.beans.PropertyChangeEvent struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_vetoable_change_events_disposing(name, cb)

Adds a listener for an event.

Event is invoked when the property listener is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

color_stock_bars(white_day_color, black_day_color)[source]

Set color of stock bars for a CandleStickChartType chart.

Parameters:
  • white_day_color (Color) – Chart white day color

  • black_day_color (Color) – Chart black day color

Raises:
Return type:

None

See also

CommonColor

create_coordinate_system(dimension_count)

Creates a coordinate systems that fits the chart-type with its current settings and for the given dimension.

Raises:

com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Return type:

XCoordinateSystem

Parameters:

dimension_count (int) –

get_chart_type()

A string representation of the chart type.

This needs to be the service-name which can be used to create a chart type.

Return type:

str

get_data_series()[source]

retrieve all data series

Return type:

Tuple[ChartDataSeries[ChartType[TypeVar(_T, bound= ComponentT)]], ...]

get_property(name, default=<object object>)

Get property value

Parameters:
  • name (str) – Property Name.

  • default (Any, optional) – Return value if property value is None.

Returns:

Property value or default.

Return type:

Any

get_role_of_sequence_for_series_label()

Returns the role of the XLabeledDataSequence of which the label will be taken to identify the DataSeries in dialogs or the legend.

Return type:

str

get_services()

Gets service names for the instance.

Returns:

service names

Return type:

List[str]

get_supported_mandatory_roles()

Returns a sequence of roles that are understood by this chart type.

All roles must be listed in the order in which they are usually parsed. This ensures that gluing sequences together and splitting them up apart again results in the same structure as before.

Note, that this does not involve optional roles, like error-bars.

Return type:

Tuple[str, ...]

get_supported_optional_roles()

Returns a sequence of roles that are understood in addition to the mandatory roles see XChartType.getSupportedMandatoryRoles().

An example for an optional role are error-bars.

Return type:

Tuple[str, ...]

get_supported_property_roles()

Returns a sequence with supported property mapping roles.

An example for a property mapping role is FillColor.

Return type:

Tuple[str, ...]

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_data_series(data_series)

removes one data series from the data series container.

Raises:

com.sun.star.container.NoSuchElementExceptionNoSuchElementException

Return type:

None

Parameters:

data_series (com.sun.star.chart2.XDataSeries) –

remove_event_observer(observer)

Removes an observer

Parameters:

observer (EventObserver) – One or more observers to add.

Returns:

True if observer has been removed; Otherwise, False.

Return type:

bool

remove_event_property_change(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_property_change_events_disposing(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_vetoable_change(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_vetoable_change_events_disposing(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

set_data_series(data_series)

Set all data series.

Raises:

com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Return type:

None

Parameters:

data_series (Tuple[com.sun.star.chart2.XDataSeries, ...]) –

set_property(**kwargs)

Set property value

Parameters:

**kwargs (Any) – Variable length Key value pairs used to set properties.

Return type:

None

subscribe_event(event_name, callback)

Add an event listener to current instance.

Parameters:
  • event_name (str) – Event Name.

  • callback (EventCallback) – Callback of the event listener.

Return type:

None

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

trigger_event(event_name, event_args)

Trigger an event on current instance.

Parameters:
  • event_name (str) – Event Name.

  • event_args (EventArgsT) – Event Args.

Return type:

None

unsubscribe_event(event_name, callback)

Remove an event listener from current instance.

Parameters:
  • event_name (str) – Event Name.

  • callback (EventCallback) – Callback of the event listener.

Return type:

None

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 chart_type: str

Gets chart type such as com.sun.star.chart2.StockBarChart.

Return type:

str

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

ChartType Component

Return type:

ChartType

property event_observer: EventObserver

Gets/Sets The Event Observer for this instance.

Return type:

EventObserver

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 lo_inst: LoInst

Lo Instance

Return type:

LoInst

property office_doc: OfficeDocumentT

Office Document.

Return type:

OfficeDocumentT

property owner: _T

Gets Owner object for this Chart Type

Return type:

TypeVar(_T, bound= ComponentT)