Chart2 Direct Axis Line
Overview
The ooodev.format.chart2.direct.axis.line.LineProperties
class gives the same options
as seen in Fig. 670.
Setup
from __future__ import annotations
from pathlib import Path
import uno
from ooo.dyn.awt.gradient_style import GradientStyle
from ooodev.calc import CalcDoc, ZoomKind
from ooodev.utils.color import StandardColor
from ooodev.loader.lo import Lo
from ooodev.utils.data_type.color_range import ColorRange
from ooodev.utils.data_type.offset import Offset
def main() -> int:
with Lo.Loader(connector=Lo.ConnectPipe()):
fnm = Path.cwd() / "tmp" / "bon_voyage.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_DARK2,
width=0.9,
)
_ = chart_doc.style_area_gradient(
step_count=0,
offset=Offset(41, 50),
style=GradientStyle.RADIAL,
grad_color=ColorRange(
StandardColor.TEAL,
StandardColor.YELLOW_DARK1,
),
)
_ = chart_doc.axis_y.style_axis_line(
color=StandardColor.TEAL, width=0.75
)
Lo.delay(1_000)
doc.close()
return 0
if __name__ == "__main__":
SystemExit(main())
Apply Line to Axis
The style_axis_line()
method is used to set the Axis line properties.
Before formatting the chart is seen in Fig. 827.
Apply to Y-Axis
# ... other code
_ = chart_doc.axis_y.style_axis_line(
color=StandardColor.TEAL, width=0.75
)
Apply to X-Axis
# ... other code
# ... other code
_ = chart_doc.axis_x.style_axis_line(
color=StandardColor.TEAL, width=0.75
)
The results are seen in Fig. 492
Getting the Axis Line style
For for all the Axis properties you can get the line style using the style_axis_line()
method.
# ... other code
f_style = chart_doc.axis_y.style_axis_line()
assert f_style is not None