Chart2 Direct General Borders

Overview

As seen in Chart2 Direct General Area the border are set using style_border_line() method of Class ChartDoc

The style_border_line() method gives the same options as the Chart Area Borders dialog as seen in Fig. 477.

Chart Area Borders Default Dialog

Fig. 477 Chart Area Borders Default Dialog

Setup

from __future__ import annotations
import uno
from pathlib import Path
from ooodev.calc import CalcDoc, ZoomKind
from ooodev.utils.color import StandardColor
from ooodev.loader.lo import Lo


def main() -> int:
    with Lo.Loader(connector=Lo.ConnectPipe()):
        fnm = Path.cwd() / "tmp" / "col_chart.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.GREEN_DARK3, width=2.2)

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


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

Setting Line Properties

The style_area_color() method is used to set to set the border line properties.

Before setting the border line properties the chart is seen in Fig. 829.

_ = chart_doc.style_border_line(color=StandardColor.GREEN_DARK3, width=2.2)

The results are seen in Fig. 478 and Fig. 479

Chart with border set to green

Fig. 478 Chart with border set to green

Chart Area Borders Default Dialog

Fig. 479 Chart Area Borders Default Dialog

Getting the border style

# ... other code

f_style = chart_doc.style_border_line_get()
assert f_style is not None