Chart2 Direct General Borders (Static)
Overview
The ooodev.format.chart2.direct.general.borders.LineProperties class gives the same options as the Chart Area Borders dialog
as seen in Fig. 656.
Since version 0.28.0 it is recommended to use the built in methods for setting the Borders of a Chart.
See Chart2 Direct General Borders.
Fig. 656 Chart Area Borders Default Dialog
See also
Setup
import uno
from ooodev.format.chart2.direct.general.borders import LineProperties as ChartLineProperties
from ooodev.office.calc import Calc
from ooodev.office.chart2 import Chart2
from ooodev.utils.color import StandardColor
from ooodev.gui import GUI
from ooodev.loader.lo import Lo
def main() -> int:
with Lo.Loader(connector=Lo.ConnectPipe()):
doc = Calc.open_doc("col_chart.ods")
GUI.set_visible(True, doc)
Lo.delay(500)
Calc.zoom(doc, GUI.ZoomEnum.ZOOM_100_PERCENT)
sheet = Calc.get_active_sheet()
Calc.goto_cell(cell_name="A1", doc=doc)
chart_doc = Chart2.get_chart_doc(sheet=sheet, chart_name="col_chart")
chart_bdr_line = ChartLineProperties(color=StandardColor.GREEN_DARK3, width=2.2)
Chart2.style_background(chart_doc=chart_doc, styles=[chart_bdr_line])
Lo.delay(1_000)
Lo.close_doc(doc)
return 0
if __name__ == "__main__":
SystemExit(main())
Setting Line Properties
The LineProperties class is used to set the border line properties.
Before setting the border line properties the chart is seen in Fig. 829.
chart_bdr_line = ChartLineProperties(color=StandardColor.GREEN_DARK3, width=2.2)
Chart2.style_background(chart_doc=chart_doc, styles=[chart_bdr_line])
The results are seen in Fig. 657 and Fig. 658
Fig. 657 Chart with border set to green
Fig. 658 Chart Area Borders Default Dialog