How to move/size a Calc chart wall with a macro?

If I create a Calc chart, I can move the actual part that shows the graph itself by right clicking in the Wall area and selecting “Position and Size”. However, I can’t work out how to do this in a macro as the Wall object in the Diagram object appears to lack Position and Size properties. The Diagram itself has Position and Size, but this object seems to refer to an area that also includes the axis labels, which is not what I want.

Background: I have a set of several charts that show the movement of a quantity over varous time periods - a day, week, month, etc. - and these are stacked on top of one another to save space, with a set of push buttons to bring the required chart to the front. If I change the size or position of one of these charts, I would like to be able to run a macro to change all the others so they match. And it seems this would work just fine by setting the Chart and the Diagram position and size if all of the charts labels were the same physical width because the chart wall is then moved so the left-hand edge of the Y-axis labels are aligned to the left-hand edge of the Diagram. However, my charts may have different labels, say 1%, 2%, 3%… for one and -30%, -20%, -10%… for another. Making the Diagram positions and sizes the same in this case fails to align the left hand edge of the Walls with each other.

Version: 7.4.2.3 (x64) / LibreOffice Community
Build ID: 382eef1f22670f7f4118c8c2dd222ec7ad009daf
CPU threads: 16; OS: Windows 10.0 Build 22621; UI render: default; VCL: win
Locale: en-GB (en_GB); UI: en-GB
Calc: CL

You may have a lot of fun with the needed research as I had with a different project tampering with elements of grouped shapes inside the graphical content of the OLE component. I did it for theoretical interest. Charts are highly complicated objects with lots of internal dependencies needing to be kept in the correct relations whenever some probably tiny detail is changed.
What you are describing as the background doesn’t convince me that you chose an appropriate approach.

Why? There’s plenty of space in any sheet’s area. The only reason I had decades ago to stack (very closely related) diagrams was to use transparency for getting some special effects. I doubt if I would use the same approach today.
If you can’t fix the needed relations in a way allowing to move and resize the charts by user code working with the OLEshape only, you should abandon the idea, imo.
To hide a shape and to make a different one visible is very simple. So is relocation from outside the view to the stage and back.

===editing===
The attached example may help you to check a few ideas that should be useful in the proper context.
disask85378firstSketch.ods (42.4 KB)

There’s plenty of space in any sheet’s area.

I don’t have a 4K or 8K monitor, and for various reasons I would rather not increase the window size.

The only reason I had decades ago to stack (very closely related) diagrams was to use transparency for getting some special effects.

And that’s actually what I’m doing as well, but I omitted it from the detailed description as it didn’t seem all that relevant.

Anyway, thank you for your response, which has no doubt saved me a lot of work. Just doing it by hand each time then seems to be the best method. Which is no great problem, I was just going by “why bark yourself when you can buy a dog?”

No need to place all the charts inside the ordinary view all the time. They are movable -after all also by user code, and the sheet is huge.

Generally:
Preparing columns for everything I need under some condition in a chart, as I also demonstrated was often a way to a good solution for me. Even working with macros modifying the charts, I would work with data objects rather than with graphical objects. The “theoretical case” I talked of didn’t allow for that way. It turned out to be possible but complicated to work with grouped graphical objects inside of charts…

Who was buying anything?
Neither myself nor my advice are for sale.

I did consider changing the data rather than the chart stacking/arranging, but it seemed at first that it would be easier to “simply” align the individual chart sizes - now I know better. I have marked your first response as a solution now, but I may still have a look at the source code over the holidays to see how the Position and Size dialog manages to do it.

As for the dog, I probably shouldn’t be using English idioms on an international forum. “Why buy a dog and bark yourself?” means “why should I do something myself that I can get something else to do?”

Don’t worry concerning my barking. And freely use English idioms. I like to learn some more. I simply failed to understand the “buy” in the context, Well, I have never bought a dog, but sometimes I meet a dog or a cat and have a short conversation with them. Practicing foreign languages is always nice.

1 Like