Creating a Column and Line Chart via macro

The Chart Wizard gives me the option to pick a ‘Column and Line Chart’. However, I am not able to recreate that using a LibreOffice Basic macro.

Creating one by hand, I have used ‘Tools | Development Tools’ to inspect all elements of the Chart, to no avail. Did anybody succeed in creating a Column and Line Chart via macro?

This is a python resource but has a lot on charts including many examples.

Python LibreOffice Programming Part 5: Charts

Take a look and see if it helps.

Thanks, that looks very promising. I’ll check it out and will post my code here when I found the solution.

In the end it was simple… Using the chart ‘ColumnAndLines’ and adding one extra line of code to set the number of lines.

	oChart.Diagram = oChart.createInstance("com.sun.star.chart.ColumnAndLine")
  	oChart.Diagram.NumberOfLines = 1

(That last one I found out using Xray)

1 Like