Class ChartDoc

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

Bases: LoInstPropsPartial, ChartDocumentComp, ModifyEvents, PropPartial, QiPartial, ServicePartial, EventsPartial, ChartDocPropPartial, PropertyChangeImplement, VetoableChangeImplement, CloseEvents, StorageChangeEventEvents, FillColorPartial, ChartFillGradientPartial, ChartFillImgPartial, ChartFillPatternPartial, ChartFillHatchPartial, BorderLinePropertiesPartial, TransparencyPartial, GradientPartial, CalcDocPropPartial, CalcSheetPropPartial

Class for managing Chart2 ChartDocument Component.

Parameters:
  • owner (TableChart) –

  • component (ChartDocument) –

  • lo_inst (LoInst | None) –

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

Constructor

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

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

  • owner (TableChart) –

Return type:

None

add_cat_labels(data_label, data_range)[source]

Add Category Labels.

Parameters:
  • data_label (str) – Data label.

  • data_range (str) – Data range.

Raises:

ChartError – If error occurs.

Return type:

None

add_chart_type(chart_type)[source]

Add Chart Type

Parameters:

chart_type (ChartTypeNameBase) – Chart Type

Raises:

ChartError – If error occurs.

Return type:

None

add_event_close_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

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

Return type:

None

Parameters:

cb (Any) –

add_event_listener(listener)

Adds an event listener to the component.

Parameters:

listener (XEventListener) – The event listener to be added.

Return type:

None

add_event_modified(cb)

Adds a listener for an event.

Event is invoked when something changes in the object.

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

Return type:

None

Parameters:

cb (Any) –

add_event_modify_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

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

Return type:

None

Parameters:

cb (Any) –

add_event_notify_closing(cb)

Adds a listener for an event.

Event is invoked when the listened object is closed really.

Now the listened object is closed really. Listener has to accept that; should deregister itself and release all references to it. It’s not allowed nor possible to disagree with that by throwing any exception.

If the event com.sun.star.lang.XEventListener.disposing() occurred before it must be accepted too. There exist no chance for a disagreement any more.

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

Return type:

None

Parameters:

cb (Any) –

add_event_notify_storage_change(cb)

Adds a listener for an event.

Event is invoked when range selection is completed.

The callback EventArgs.event_data will contain a ooodev.events.args.event_args.EventArgs instance.

The event, event data is a dictionary with the following keys:

  • document: The document that is being switched to another storage.

  • storage: The new storage that the document is being switched to.

Return type:

None

Parameters:

cb (Any) –

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_query_closing(cb)

Adds a listener for an event.

Event is invoked when somewhere tries to close listened object

Is called before XCloseListener.notifyClosing(). Listener has the chance to break that by throwing a CloseVetoException. This exception must be passed to the original caller of XCloseable.close() without any interaction.

The parameter gets_ownership regulate who has to try to close the listened object again, if this listener disagree with the request by throwing the exception. If it’s set to False the original caller of XCloseable.close() will be the owner in every case. It’s not allowed to call close() from this listener then. If it’s set to True this listener will be the new owner if he throw the exception, otherwise not! If his still running processes will be finished he must call close() on listened object again then.

If this listener doesn’t disagree with th close request it depends from his internal implementation if he deregister itself at the listened object. But normally this must be done in XCloseListener.notifyClosing().

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

Note

The callback event is an instance of KeyValArgs with the following properties: event.key=gets_ownership, event.value is a bool and event.event_data is com.sun.star.lang.EventObject.

This is because the UNO interface com.sun.star.util.XCloseListener has the following signature: void queryClosing ([in] com::sun::star::lang::EventObject Source, [in] boolean GetsOwnership).

Return type:

None

Parameters:

cb (Any) –

add_event_storage_change_event_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

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

Return type:

None

Parameters:

cb (Any) –

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

add_stock_line(data_label, data_range)[source]

Add Stock Line

Parameters:
  • data_label (str) – Data Label

  • data_range (str) – Data Range

Raises:

ChartError – If error occurs.

Return type:

None

attach_data_provider(provider)

attaches a component that provides data for the document.

The previously set data provider will be released.

Return type:

None

Parameters:

provider (com.sun.star.chart2.data.XDataProvider) –

attach_number_formats_supplier(supplier)

attaches an XNumberFormatsSupplier to this XDataReceiver.

The given number formats will be used for display purposes.

Return type:

None

Parameters:

supplier (com.sun.star.util.XNumberFormatsSupplier) –

attach_resource(url, *args)

Informs a model about its resource description.

Return type:

bool

Parameters:
  • url (str) –

  • args (PropertyValue) –

calc_regressions()[source]

Calculate regressions.

Several different regression functions are calculated using the chart’s data. Their equations and R2 values are printed to the console

Raises:

ChartError – If error occurs.

Return type:

None

connect_controller(controller)

Is called whenever a new controller is created for this model.

The com.sun.star.lang.XComponent interface of the controller must be used to recognize when it is deleted.

Return type:

None

Parameters:

controller (com.sun.star.frame.XController) –

create_curve(curve_kind)[source]

Creates a regression curve.

Matches the regression constants defined in curve_kind to regression services offered by the API:

Parameters:

curve_kind (CurveKind) – Curve kind.

Raises:

ChartError – If error occurs.

Returns:

Regression Curve object.

Return type:

XRegressionCurve

Hint

  • CurveKind can be imported from ooodev.utils.kind.curve_kind.

create_default_chart()

Creates a default chart type for a brand-new chart object.

Return type:

None

create_internal_data_provider(clone_existing_data)

creates an internal com.sun.star.chart2.XDataProvider that is handled by the chart document itself.

When the model is stored, the data provider will also be stored in a sub-storage.

Raises:

com.sun.star.util.CloseVetoExceptionCloseVetoException

Return type:

None

Parameters:

clone_existing_data (bool) –

dash_lines()[source]

Sets chart data series to dashed lines.

Parameters:

chart_doc (XChartDocument) – Chart Document

Raises:

ChartError – If error occurs.

Return type:

None

disconnect_controller(controller)

is called whenever an existing controller should be deregistered at this model.

The com.sun.star.lang.XComponent interface of the controller must be used to recognize when it is deleted.

Return type:

None

Parameters:

controller (com.sun.star.frame.XController) –

dispose()

Disposes the component.

Return type:

None

draw_regression_curve(curve_kind, styles=None)[source]

Draws a regression curve.

Parameters:
  • chart_doc (XChartDocument) – Chart Document

  • curve_kind (CurveKind) – Curve kind.

  • styles (Sequence[StyleT], optional) – Styles to apply to the curve. Defaults to None.

Raises:

ChartError – If error occurs.

Returns:

Regression curve property set.

Return type:

XPropertySet

Hint

Styles that can be applied are found in the following subpackages:

  • CurveKind can be imported from ooodev.utils.kind.curve_kind.

Changed in version 0.9.4: Added styles argument, and now returns the regression curve property set.

eval_curve(curve)[source]

Uses XRegressionCurve.getCalculator() to access the XRegressionCurveCalculator interface. It sets up the data and parameters for a particular curve, and prints the results of curve fitting to the console.

Parameters:

curve (XRegressionCurve) – Regression Curve object.

Return type:

None

find_chart_type(chart_type)[source]

Finds a chart for a given chart type.

Parameters:

chart_type (ChartTypeNameBase | str) – Chart type.

Raises:
Returns:

Found chart type.

Return type:

ChartType[ChartDoc]

get_args()

Provides read access on currently representation of the com.sun.star.document.MediaDescriptor of this model which describes the model and its state

Return type:

Tuple[PropertyValue, ...]

get_chart_type_manager()

retrieves the component that is able to create different chart type templates (components of type ChartTypeTemplate)

Return type:

XChartTypeManager

get_current_controller()

Provides access to the controller which currently controls this model

Return type:

XController

get_current_selection()

Provides read access on current selection on controller

Return type:

XInterface

get_data_provider()[source]

Returns the currently set data provider.

This may be an internal one, if createInternalDataProvider() has been called before, or an external one if XDataReceiver.attachDataProvider() has been called.

Return type:

DataProvider

get_data_series() Tuple[ooodev.calc.chart2.chart_data_series.ChartDataSeries[ooodev.calc.chart2.chart_doc.ChartDoc], ...][source]
get_data_series(chart_type: ooodev.utils.kind.chart2_types.ChartTypeNameBase) Tuple[ooodev.calc.chart2.chart_data_series.ChartDataSeries[ooodev.calc.chart2.chart_doc.ChartDoc], ...]
get_data_series(chart_type: str) Tuple[ooodev.calc.chart2.chart_data_series.ChartDataSeries[ooodev.calc.chart2.chart_doc.ChartDoc], ...]
get_data_series(chart_type='')

Gets data series for a chart of a given chart type.

Parameters:

chart_type (ChartTypeNameBase, str, optional) – Chart Type.

Raises:

ChartError – If any other error occurs.

Returns:

Data Series

Return type:

Tuple[XDataSeries, …]

See also

get_first_diagram()

Notes: this is preliminary, we need an API that supports more than one diagram. The method name getDiagram exists in the css.chart API, so there is would be no way to choose either this or the other method from Basic (it would chose one or the other by random).

Return type:

XDiagram

get_number_format_key(nf_str)[source]

Converts a number format string into a number format key, which can be assigned to NumberFormat property.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • chart_doc (XChartDocument) – Chart Document

  • nf_str (str) – Number format string.

Raises:

ChartError – If error occurs.

Returns:

Number format key.

Return type:

int

Note

The string-to-key conversion is straight forward if you know what number format string to use, but there’s little documentation on them. Probably the best approach is to use the Format Cells menu item in a spreadsheet document, and examine the dialog

get_number_format_settings()

Gets the number format settings.

Return type:

XPropertySet

get_number_formats()

Gets the number formats.

Return type:

XNumberFormats

get_page_background()

Gives access to the page background appearance.

The area’s extent is equal to the document size. If you want to access properties of the background area of a single diagram (the part where data points are actually plotted in), you have to get its wall. You can get the wall by calling XDiagram.getWall().

Return type:

XPropertySet

get_popup_request()

A callback object to execute a foreign popup menu window.

since

LibreOffice 5.4

Return type:

XRequestCallback

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_range_highlighter()

Returns a component at which a view representing the data of the attached data provider may listen for highlighting the data ranges used by the currently selected objects in the data receiver component.

This is typically used by a spreadsheet to highlight the ranges used by the currently selected object in a chart.

The range highlighter is optional, i.e., this method may return an empty object.

Return type:

XRangeHighlighter

get_services()

Gets service names for the instance.

Returns:

service names

Return type:

List[str]

get_style_families()

This method returns the collection of style families available in the container document.

Return type:

XNameAccess

get_templates()[source]

Gets a list of chart templates (services).

Raises:

ChartError – If error occurs

Returns:

List of chart templates

Return type:

List[str]

get_title()[source]

Gets the Chart Title Component.

Return type:

ChartTitle[ChartDoc] | None

get_title_object()

get the object holding the title’s content and formatting

Return type:

XTitle

get_url()

Provides information about the location of this model

Return type:

str

get_used_data()

Returns the data requested by the most recently attached data provider, that is still used.

Return type:

XDataSource

get_used_range_representations()

returns a list of all range strings for which data has been requested by the most recently attached data provider, and which is still used.

This list may be used by the data provider to swap charts out of memory, but still get informed by changes of ranges while the chart is not loaded.

Return type:

Tuple[str, ...]

has_controllers_locked()

determines if there is at least one lock remaining.

While there is at least one lock remaining, some notifications for display updates are not broadcasted to the controllers.

Return type:

bool

has_internal_data_provider()

This is the case directly after createInternalDataProvider() has been called, but this is not necessary. The chart can also create an internal data provider by other means, e.g. a call to com.sun.star.frame.XModel.initNew().

Return type:

bool

lock_controllers()

suspends some notifications to the controllers which are used for display updates.

The calls to XModel.lockControllers() and XModel.unlockControllers() may be nested and even overlapping, but they must be in pairs. While there is at least one lock remaining, some notifications for display updates are not broadcasted.

Return type:

None

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_event_close_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_listener(listener)

Removes an event listener from the component.

Parameters:

listener (XEventListener) – The event listener to be removed.

Return type:

None

remove_event_modified(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_modify_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_notify_closing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_notify_storage_change(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

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_query_closing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_storage_change_event_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

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_arguments(*args)
Raises:

com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Return type:

None

Parameters:

args (PropertyValue) –

set_bg_color(color)[source]

Sets the background color.

Return type:

None

Parameters:

color (Color) –

set_chart_type_manager(new_manager)

Sets a new component that is able to create different chart type templates (components of type ChartTypeTemplate)

Return type:

None

Parameters:

new_manager (com.sun.star.chart2.XChartTypeManager) –

set_current_controller(controller)

sets a registered controller as the current controller.

Raises:

com.sun.star.container.NoSuchElementExceptionNoSuchElementException

Return type:

None

Parameters:

controller (com.sun.star.frame.XController) –

set_data_point_labels(label_type)[source]

Set data point labels for a given chart type.

Parameters:

label_type (DataPointLabelTypeKind) – Data point label type.

Raises:

ChartError – If any error occurs.

Return type:

None

Hint

  • DataPointLabelTypeKind can be imported from ooodev.utils.kind.data_point_label_type_kind.

set_first_diagram(diagram)

Notes: this is preliminary, we need an API that supports more than one diagram. The method name setDiagram exists in the css.chart API, so there is would be no way to choose either this or the other method from Basic (it would chose one or the other by random).

Return type:

None

Parameters:

diagram (com.sun.star.chart2.XDiagram) –

set_property(**kwargs)

Set property value

Parameters:

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

Return type:

None

set_title(title)[source]

Adds a Chart Title.

Return type:

ChartTitle[ChartDoc]

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) –

set_wall_color(color)[source]

Sets the wall color.

Return type:

None

Parameters:

color (Color) –

set_y_error_bar(data_label, data_range)[source]

Set Error Bar

Raises:

ChartError – If any error occurs.

Returns:

Chart Error Bar

Return type:

ChartErrorBar

Parameters:
  • data_label (str) –

  • data_range (str) –

style_area_color(color=-1)

Style Area Color.

Parameters:

color (Color, optional) – FillColor Color. Defaults to StandardColor.AUTO_COLOR.

Raises:

CancelEventError – If the event before_style_area_color is cancelled and not handled.

Returns:

FillColor instance or None if cancelled.

Return type:

FillColorT | None

style_area_color_get()

Gets the Area Color Style.

Raises:

CancelEventError – If the event before_style_area_color_get is cancelled and not handled.

Returns:

Area color style or None if cancelled.

Return type:

FillColorT | None

style_area_gradient(*, style=GradientStyle.LINEAR, step_count=0, offset=Offset(x=50, y=50), angle=0, border=0, grad_color=ColorRange(start=0, end=16777215), grad_intensity=IntensityRange(start=100, end=100), name='')

Style Area Color.

Parameters:
  • style (GradientStyle, optional) – Specifies the style of the gradient. Defaults to GradientStyle.LINEAR.

  • step_count (int, optional) – Specifies the number of steps of change color. Defaults to 0.

  • offset (Offset, int, optional) – Specifies the X and Y coordinate, where the gradient begins. X is effectively the center of the RADIAL, ELLIPTICAL, SQUARE and RECT style gradients. Defaults to Offset(50, 50).

  • angle (Angle, int, optional) – Specifies angle of the gradient. Defaults to 0.

  • border (int, optional) – Specifies percent of the total width where just the start color is used. Defaults to 0.

  • grad_color (ColorRange, optional) – Specifies the color at the start point and stop point of the gradient. Defaults to ColorRange(Color(0), Color(16777215)).

  • grad_intensity (IntensityRange, optional) – Specifies the intensity at the start point and stop point of the gradient. Defaults to IntensityRange(100, 100).

  • name (str, optional) – Specifies the Fill Gradient Name.

Raises:

CancelEventError – If the event before_style_area_gradient is cancelled and not handled.

Returns:

Chart Fill Gradient instance or None if cancelled.

Return type:

ChartFillGradientT | None

Hint

  • GradientStyle can be imported from ooo.dyn.awt.gradient_style

  • Angle can be imported from ooodev.units

  • ColorRange can be imported from ooodev.utils.data_type.color_range

  • Intensity can be imported from ooodev.utils.data_type.intensity

  • IntensityRange can be imported from ooodev.utils.data_type.intensity_range

  • Offset can be imported from ooodev.utils.data_type.offset

style_area_gradient_from_preset(preset)

Style Area Gradient from Preset.

Parameters:

preset (PresetGradientKind) – Preset Gradient Kind.

Returns:

Chart Fill Gradient instance.

Return type:

ChartFillGradientT

Hint

  • PresetGradientKind can be imported from ooodev.format.inner.preset.preset_gradient

style_area_gradient_get()

Gets the Area Gradient Style.

Raises:

CancelEventError – If the event before_style_area_gradient_get is cancelled and not handled.

Returns:

Gradient style or None if cancelled.

Return type:

ChartFillGradientT | None

style_area_hatch(*, style=HatchStyle.SINGLE, color=0, space=0, angle=0, bg_color=-1)

Style Area Color.

Parameters:
  • style (HatchStyle, optional) – Specifies the kind of lines used to draw this hatch. Default HatchStyle.SINGLE.

  • color (Color, optional) – Specifies the color of the hatch lines. Default 0.

  • space (float, UnitT, optional) – Specifies the space between the lines in the hatch (in mm units) or Class UnitT. Default 0.0

  • angle (Angle, int, optional) – Specifies angle of the hatch in degrees. Default to 0.

  • bg_color (Color, optional) – Specifies the background Color. Set this -1 (default) for no background color.

Raises:

CancelEventError – If the event before_style_area_hatch is cancelled and not handled.

Returns:

Fill Image instance or None if cancelled.

Return type:

ChartFillHatchT | None

Hint

  • Angle can be imported from ooodev.units

  • HatchStyle can be imported from ooo.dyn.drawing.hatch_style

style_area_hatch_from_preset(preset)

Style Area Gradient from Preset.

Parameters:

preset (PresetHatchKind) – Preset Hatch Kind.

Returns:

Chart Fill Hatch instance or None if before_style_area_hatch_from_preset event is cancelled.

Return type:

ChartFillHatchT | None

Hint

  • PresetHatchKind can be imported from ooodev.format.inner.preset.preset_hatch

style_area_image(*, bitmap=None, name='', mode=ImgStyleKind.TILED, size=None, position=None, pos_offset=None, tile_offset=None, auto_name=False)

Style Area Color.

Parameters:
  • bitmap (XBitmap, optional) – Bitmap instance. If name is not already in the Bitmap Table then this property is required.

  • name (str, optional) – Specifies the name of the image. This is also the name that is used to store bitmap in LibreOffice Bitmap Table.

  • mode (ImgStyleKind, optional) – Specifies the image style, tiled, stretched etc. Default ImgStyleKind.TILED.

  • size (SizePercent, SizeMM, optional) – Size in percent (0 - 100) or size in mm units.

  • position (RectanglePoint) – Tiling position of Image.

  • pos_offset (Offset, optional) – Tiling position offset.

  • tile_offset (OffsetColumn, OffsetRow, optional) – The tiling offset.

  • auto_name (bool, optional) – Specifies if name is ensured to be unique. Defaults to False.

Raises:

CancelEventError – If the event before_style_area_img is cancelled and not handled.

Returns:

Fill Image instance or None if cancelled.

Return type:

ChartFillImgT | None

Hint

  • RectanglePoint can be imported from ooo.dyn.drawing.rectangle_point

  • ImgStyleKind can be imported from ooodev.format.inner.direct.write.fill.area.img

  • SizePercent can be imported from ooodev.format.inner.common.format_types.size_percent

  • SizeMM can be imported from ooodev.utils.data_type.size_mm

  • OffsetColumn can be imported from ooodev.format.inner.common.format_types.offset_column

  • OffsetRow can be imported from ooodev.format.inner.common.format_types.offset_row

  • Offset can be imported from ooodev.utils.data_type.offset

style_area_image_from_preset(preset)

Style Area Gradient from Preset.

Parameters:

preset (PresetImageKind) – Preset Image Kind.

Returns:

Chart Fill Image instance.

Return type:

ChartFillImgT

Hint

  • PresetImageKind can be imported from ooodev.format.inner.preset.preset_image

style_area_image_get()

Gets the Area Area Image Style.

Raises:

CancelEventError – If the event before_style_area_img_get is cancelled and not handled.

Returns:

Area image style or None if cancelled.

Return type:

ChartFillImgT | None

style_area_pattern(*, bitmap=None, name='', tile=True, stretch=False, auto_name=False)

Style Area Color.

Parameters:
  • bitmap (XBitmap, optional) – Bitmap instance. If name is not already in the Bitmap Table then this property is required.

  • name (str, optional) – Specifies the name of the pattern. This is also the name that is used to store bitmap in LibreOffice Bitmap Table.

  • tile (bool, optional) – Specified if bitmap is tiled. Defaults to True.

  • stretch (bool, optional) – Specifies if bitmap is stretched. Defaults to False.

  • auto_name (bool, optional) – Specifies if name is ensured to be unique. Defaults to False.

Raises:

CancelEventError – If the event before_style_area_pattern is cancelled and not handled.

Returns:

Fill Image instance or None if cancelled.

Return type:

ChartFillPatternT | None

style_area_pattern_from_preset(preset)

Style Area Gradient from Preset.

Parameters:

preset (PresetPatternKind) – Preset Image Kind.

Returns:

Chart Fill Image instance.

Return type:

ChartFillPatternT

Hint

  • PresetPatternKind can be imported from ooodev.format.inner.preset.preset_pattern

style_area_pattern_get()

Gets the Area Area Pattern Style.

Raises:

CancelEventError – If the event before_style_area_pattern_get is cancelled and not handled.

Returns:

Area pattern style or None if cancelled.

Return type:

ChartFillPatternT | None

style_area_transparency_gradient(*, style=GradientStyle.LINEAR, offset=Offset(x=50, y=50), angle=0, border=0, grad_intensity=IntensityRange(start=0, end=0))

Style Area Color.

Parameters:
  • style (GradientStyle, optional) – Specifies the style of the gradient. Defaults to GradientStyle.LINEAR.

  • step_count (int, optional) – Specifies the number of steps of change color. Defaults to 0.

  • offset (offset, optional) – Specifies the X-coordinate (start) and Y-coordinate (end), where the gradient begins. X is effectively the center of the RADIAL, ELLIPTICAL, SQUARE and RECT style gradients. Defaults to Offset(50, 50).

  • angle (Angle, int, optional) – Specifies angle of the gradient. Defaults to 0.

  • border (int, optional) – Specifies percent of the total width where just the start color is used. Defaults to 0.

  • grad_intensity (IntensityRange, optional) – Specifies the intensity at the start point and stop point of the gradient. Defaults to IntensityRange(0, 0).

Raises:

CancelEventError – If the event before_style_area_transparency_gradient is cancelled and not handled.

Returns:

FillColor instance or None if cancelled.

Return type:

GradientT | None

Hint

  • GradientStyle can be imported from ooo.dyn.awt.gradient_style

  • IntensityRange can be imported from ooodev.utils.data_type.intensity_range

  • Offset can be imported from ooodev.utils.data_type.offset

  • Angle can be imported from ooodev.units

  • Intensity can be imported from ooodev.utils.data_type.intensity

style_area_transparency_gradient_get()

Gets the Area Transparency Gradient Style.

Raises:

CancelEventError – If the event before_style_area_transparency_gradient_get is cancelled and not handled.

Returns:

Area transparency style or None if cancelled.

Return type:

GradientT | None

style_area_transparency_transparency(value=0)

Style Area Color.

Parameters:

value (Intensity, int, optional) – Specifies the transparency value from 0 to 100.

Raises:

CancelEventError – If the event before_style_area_transparency_transparency is cancelled and not handled.

Returns:

FillColor instance or None if cancelled.

Return type:

TransparencyT | None

Hint

  • The value of 0 is fully opaque.

  • The value of 100 is fully transparent.

  • Intensity can be imported from ooodev.utils.data_type.intensity

style_area_transparency_transparency_get()

Gets the Area Transparency Style.

Raises:

CancelEventError – If the event before_style_area_transparency_transparency_get is cancelled and not handled.

Returns:

Area transparency style or None if cancelled.

Return type:

TransparencyT | None

style_border_line(color=0, width=0, transparency=0, style=BorderLineKind.CONTINUOUS)

Style border line.

Parameters:
  • color (Color, optional) – Line Color. Defaults to Color(0).

  • width (float | UnitT, optional) – Line Width (in mm units) or Class UnitT. Defaults to 0.

  • transparency (int | Intensity, optional) – Line transparency from 0 to 100. Defaults to 0.

  • style (BorderLineKind, optional) – Line style. Defaults to BorderLineKind.CONTINUOUS.

Raises:

CancelEventError – If the event before_style_chart_border_line is cancelled and not handled.

Returns:

Line properties style or None if cancelled.

Return type:

LinePropertiesT | None

Hint

  • BorderLineKind can be imported from ooodev.format.inner.preset.preset_border_line

  • Intensity can be imported from ooodev.utils.data_type.intensity

style_border_line_get()

Gets the line properties style.

Raises:

CancelEventError – If the event before_style_chart_border_line_get is cancelled and not handled.

Returns:

Line properties style or None if cancelled.

Return type:

LinePropertiesT | 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

unlock_controllers()

resumes the notifications which were suspended by XModel.lockControllers().

The calls to XModel.lockControllers() and XModel.unlockControllers() may be nested and even overlapping, but they must be in pairs. While there is at least one lock remaining, some notifications for display updates are not broadcasted.

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 axis2_x: ChartAxis | None

Gets the X Axis Component.

Return type:

ChartAxis | None

property axis2_y: ChartAxis | None

Gets the Y Axis Component.

Return type:

ChartAxis | None

property axis_x: ChartAxis

Gets the X Axis Component.

Return type:

ChartAxis

property axis_y: ChartAxis

Gets the Y Axis Component.

Return type:

ChartAxis

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.ChartDocument

ChartDocument Component

Return type:

ChartDocument

property event_observer: EventObserver

Gets/Sets The Event Observer for this instance.

Return type:

EventObserver

property events_listener_close: CloseListener

Returns listener

Return type:

CloseListener

property events_listener_modify: ModifyListener

Returns listener

Return type:

ModifyListener

property events_listener_storage_change_event: StorageChangeListener

Returns listener

Return type:

StorageChangeListener

property first_diagram: ChartDiagram

Gets the first diagram.

Return type:

ChartDiagram

property lo_inst: LoInst

Lo Instance

Return type:

LoInst

property office_doc: OfficeDocumentT

Office Document.

Return type:

OfficeDocumentT

property owner: TableChart

Gets the owner.

Return type:

TableChart