[Solved] Constant Horizontal Line on Chart

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
flyer48
Posts: 14
Joined: Fri Jun 18, 2021 5:19 pm

[Solved] Constant Horizontal Line on Chart

Post by flyer48 »

I am looking to indicate two constant values on the Y-Axis of a line chart without inserting a new row of data with just those values and plotting those as lines. Originally I thought I would be able to do it with the error bars, but it does not look possible with the options for ErrorBarStyle, and the CONSTANT_VALUE option that looks like it would work is under ChartErrorCategory which is depreciated. My second thought was that I could produce lines on the chart with something like MeanValue where I might be able to set horizontal lines at constant Y-values, but looking through the API I couldn't find anything like this.

Is something like this possible to do inside a macro?

Thanks in adavance.
Last edited by flyer48 on Fri Jul 09, 2021 5:03 pm, edited 1 time in total.
OpenOffice 4.1.10 Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Constant Horizontal Line on Chart

Post by Villeroy »

Add a straight line from the drawing toolbar and place it in front of the chart.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
flyer48
Posts: 14
Joined: Fri Jun 18, 2021 5:19 pm

Re: Constant Horizontal Line on Chart

Post by flyer48 »

This would work and be effective for one graph. Unfortunately I am working with a database that requires 35 graphs that need to be copied and pasted into separate reports, with dozens of workbooks. That is why I was wondering if it would be possible to insert the lines with a macro.

My apologies, I should have made that clear in the original post.
OpenOffice 4.1.10 Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Constant Horizontal Line on Chart

Post by Villeroy »

Adding a line is even possible to add attach a line to the chart. Think of a chart as an embedded document.
Use scenario ranges as in this example: http://user.services.openoffice.org/en/ ... hp?id=3004
so you only need one chart, one layout and one formatting layer for 35 data sets.

And by the way: A spreadsheet will never ever be a database, not even close.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Constant Horizontal Line on Chart

Post by Villeroy »

Draw a line. Arrange it so it is precisely horizontal. Add the right format attributes.
Copy the line.
Double-click a chart, paste and move to the right y-value.
Repeat the last step 34 times. Writing a macro is not an option because it takes too much time.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
flyer48
Posts: 14
Joined: Fri Jun 18, 2021 5:19 pm

Re: Constant Horizontal Line on Chart

Post by flyer48 »

The link you posted does not work.
OpenOffice 4.1.10 Windows 10
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Constant Horizontal Line on Chart

Post by RoryOF »

It downloaded a file for me - check your Downloads folder.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
flyer48
Posts: 14
Joined: Fri Jun 18, 2021 5:19 pm

Re: Constant Horizontal Line on Chart

Post by flyer48 »

There's no file download either. Thank you though.
OpenOffice 4.1.10 Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] Constant Horizontal Line on Chart

Post by Villeroy »

Here's another copy.
Attachments
trigonometricScenarios.ods
(84.05 KiB) Downloaded 180 times
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply