Chart2 Direct Wall/Floor Transparency

Overview

Classes in the ooodev.format.chart2.direct.wall.transparency module can be used to set the chart wall and floor transparency.

Setup

General setup for examples.

from __future__ import annotations
from pathlib import Path
import uno
from ooodev.calc import CalcDoc, ZoomKind
from ooodev.loader.lo import Lo
from ooodev.utils.color import StandardColor
from ooodev.format.inner.preset.preset_gradient import PresetGradientKind

def main() -> int:
    with Lo.Loader(connector=Lo.ConnectPipe()):
        fnm = Path.cwd() / "tmp" / "col_chart3d.ods"
        doc = CalcDoc.open_doc(fnm=fnm, visible=True)
        Lo.delay(500)
        doc.zoom(ZoomKind.ZOOM_100_PERCENT)

        sheet = doc.sheets[0]
        sheet["A1"].goto()
        chart_table = sheet.charts[0]
        chart_doc = chart_table.chart_doc
        _ = chart_doc.style_border_line(
            color=StandardColor.MAGENTA,
            width=0.7,
        )

        _ = chart_doc.style_area_gradient_from_preset(
            preset=PresetGradientKind.MAHOGANY,
        )

        wall = chart_doc.first_diagram.wall
        wall.style_area_transparency_transparency(30)

        Lo.delay(1_000)
        doc.close()
    return 0

if __name__ == "__main__":
    SystemExit(main())

Transparency

Before applying formatting is seen in Fig. 830.

Setting Transparency

The style_area_transparency_transparency() method is called to set the transparency of a chart wall and floor.

Apply to wall.

from ooodev.format.inner.preset.preset_gradient import PresetGradientKind

# ... other code
wall = chart_doc.first_diagram.wall
wall.style_area_transparency_transparency(30)

Apply to floor.

from ooodev.format.inner.preset.preset_gradient import PresetGradientKind

# ... other code
floor = chart_doc.first_diagram.floor
floor.style_area_transparency_transparency(30)

The results can bee seen in Fig. 544 and Fig. 545.

Chart with transparency applied to wall and floor

Fig. 544 Chart with transparency applied to wall and floor

Chart Area Transparency Dialog

Fig. 545 Chart Area Transparency Dialog

Gradient Transparency

Before applying formatting is seen in Fig. 830.

Setting Gradient

The style_area_transparency_gradient() method is called to set the gradient transparency of a chart.

Apply to wall.

from ooodev.utils.data_type.intensity_range import IntensityRange

# ... other code
wall = chart_doc.first_diagram.wall
wall.style_area_transparency_gradient(
    angle=30,
    grad_intensity=IntensityRange(0, 100),
)

Apply to Floor.

from ooodev.utils.data_type.intensity_range import IntensityRange

# ... other code
floor = chart_doc.first_diagram.floor
floor.style_area_transparency_gradient(
    angle=30,
    grad_intensity=IntensityRange(0, 100),
)

The results can bee seen in Fig. 546 and Fig. 547.

Chart with wall and floor gradient transparency

Fig. 546 Chart with wall and floor gradient transparency

Chart Wall Gradient Transparency Dialog

Fig. 547 Chart Wall Gradient Transparency Dialog