Chart Axis Labels

Java, C++, C#, Delphi, ??? - Using the UNO bridges

Chart Axis Labels

Postby saleem145 » Tue Dec 18, 2012 4:43 pm

Hello,

I am using version 3.1 of Open Office on Linux. I have created a plot but cannot seem to find how to attach an axis labels. Ideally I would like to do it programatically. I am able to set the title but cannot change the axis label...

I am trying

diagram = chartDoc.getDiagram()
xAxis = diagram.XAxis
xAxis.AxisTitle.String = "X Axis Label"

does not work....

Saleem
OpenOffice 3.4.0
Mac OS X 10.5.8
saleem145
 
Posts: 130
Joined: Mon Jul 02, 2012 4:47 pm

Re: Chart Axis Labels

Postby FJCC » Tue Dec 18, 2012 5:35 pm

Try
Code: Select all   Expand viewCollapse view
oDiagram = Chart.Diagram
XAxisTitle = oDiagram.XAxisTitle
XAxisTitle.String = "X Axis Label"
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 7680
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Chart Axis Labels

Postby saleem145 » Tue Dec 18, 2012 6:31 pm

No luck -- I am using python in an Addon if that makes a difference

diagram = chartDoc.Diagram
xAxisTitle = diagram.XAxisTitle
xAxisTitle.String = xlabel
OpenOffice 3.4.0
Mac OS X 10.5.8
saleem145
 
Posts: 130
Joined: Mon Jul 02, 2012 4:47 pm

Re: Chart Axis Labels

Postby FJCC » Tue Dec 18, 2012 8:11 pm

This Python code works for me for adding an X axis title to an existing chart.
Code: Select all   Expand viewCollapse view
import uno

def AddXAxisTitle():
  oDoc = XSCRIPTCONTEXT.getDocument()
  oSheets = oDoc.getSheets()
  oSheet= oSheets.getByIndex(0)
  oCharts = oSheet.getCharts()
  oChart = oCharts.getByIndex(0).EmbeddedObject
  oDiagram = oChart.Diagram
  oDiagram.XAxisTitle.String = 'New String'
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 7680
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA


Return to External Programs

Who is online

Users browsing this forum: No registered users and 1 guest