[Solved] set Wall size for Chart in Calc

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
misitu
Posts: 104
Joined: Mon Dec 16, 2013 5:34 am
Location: Trujillo - La Libertad - Perú

[Solved] set Wall size for Chart in Calc

Post by misitu »

Hello...
I have two diagrams, one with cubic and the other with B splines. Am trying to compare them by flicking back and forward in the PDF export of the Sheet.

If I have the legend at the bottom, there is no problem, but I like to have it on the right and for some reason, possibly connected with the line type, one diagram is wider than the other.

So I thought I would tweak the Wall.Width, which can be done manually, from the API.

I have had a serious look round the Wiki, IDL, and this forum, and also had a poke with xray, but can't see anything obvious by the way of setting the width of the Wall.

It's not a "deal breaker" but if it IS there to be used I would love to know, and it would also help me to make my own mental map of the API which is still (tbh) a bit of a battle. :oops:

Thanks in advance for any hints, etc.
Best regards
David
Last edited by misitu on Fri Jun 24, 2016 6:14 pm, edited 1 time in total.
OpenOffice 4.1.1
HSQLDB 2.3.4
Windows 7 HP / Windows 10
OOBasic
FJCC
Moderator
Posts: 9277
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: set Wall size for Chart in Calc

Post by FJCC »

I recorded this code with MRI. It resizes the diagram of a graph on the first sheet.

Code: Select all

 oSheets = ThisComponent.getSheets()
  oObj1 = oSheets.getByIndex(0)
  oCharts = oObj1.getCharts()
  
  oObj2 = oCharts.getByIndex(0)
  oEmbeddedObject = oObj2.getEmbeddedObject()
  oDiagram = oEmbeddedObject.getDiagram()
  aSize4 = oDiagram.getSize()
  aSize4.Width = aSize4.Width * 0.8
  oDiagram.Size = aSize4
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
misitu
Posts: 104
Joined: Mon Dec 16, 2013 5:34 am
Location: Trujillo - La Libertad - Perú

Re: set Wall size for Chart in Calc

Post by misitu »

Cheers!

as I wanted both diagrams of identical size, after playing about with different multiplications, and checking the wall dimensions as generated, I just did this:

Code: Select all

aSize = oDiagram.getSize()
aSize.Width = 12860
aSize.Height = 8660
oDiagram.Size = aSize
for both diagrams..
PERFECT.

At least I have what I was looking for, and know a bit about fixing the Wall size.

Many thanks
Best regards
David
OpenOffice 4.1.1
HSQLDB 2.3.4
Windows 7 HP / Windows 10
OOBasic
Post Reply