Charts in Base forms

asked 2017-04-29 19:30:57 +0100

Ratslinger gravatar image

updated 2017-05-01 23:40:24 +0100

This is a method to display charts in a Base form.


This is not a newly created charting method. The process uses the existing chart code already used for creating charts in other modules.

The BAD:

The only way to currently get this to work is through macros. There is no UI for the process (although I have a few ideas about that). If you know nothing of macro coding, look at the pretty pictures, say "That's nice" and go on to other things.


Working with the chart API is one pain-in-the-neck! At first, I believed I could document the items necessary to create various displays and functions. The more I looked, the more I found. It would take a book (maybe a small one) to document all the settings and dependencies for the various charts. Instead, I decided to release what I have found so others may utilize it.

If you are looking for how to do something, you'll have to dig into the API yourself as I have been doing. For this you really need to use MRI or XRay or other methods (including on-line documents) and probably some trial & error type testing. Most of my discoveries were obtained by creating a chart in Calc and using MRI to see where the chart change was set in the deep underground. The macros provided in the sample give you a large advantage as to where to start looking. The larger problem is how some settings are not usable unless other settings are turned on. Case in point - "floor" & "wall" settings are only available with 3D diagrams.

The Sample:

The included sample has three different forms each with a different chart (and some optional settings). Unlike Calc where the data for the chart comes from cells, the data here is created in arrays; one each for data, row titles, and column titles. The chart itself is positioned using a TextCursor (see OOME for how to on this). If the data for the chart is changed, the chart must be re-drawn to display the changed information (duh!).

There are some comments in the macros to help with the process. It is important to note that certain processing should not be interspersed in the code which creates the chart. Various results occur when this is done such as crashing, incorrectly sized charts, incomplete charts and more. This is noted in the code. Each sample utilizes a unique setting or two and may include commented out settings which have been tried but not incorporated into the chart.

Area chart sample:

This sample gets its data from use of an embedded SQL statement in the macro. No user options available.

Bar chart sample:

This sample uses hard coded data for the display (not what anyone would typically want). Did this for demo purposes only. There are options available to change the display of the chart. Choose a selection and use the button to create the chart ... (more)

edit retag flag offensive close merge delete



Very impressive! Thanks for this code @Ratslinger

librebel gravatar imagelibrebel ( 2017-04-29 21:06:40 +0100 )edit

Great work! I voted it, thank you. gravatar ( 2017-05-01 11:09:46 +0100 )edit

@librebel & Thank you for the kind remarks. So much to apply to this yet. FYI, I have found better control on positioning by placing this inside a text frame. Allows much better control. See post for sample.

Ratslinger gravatar imageRatslinger ( 2017-05-01 23:25:06 +0100 )edit

I have discovered that most of the chart settings are discussed in the AOO Developers Guide - click here. Also look at the section following that one for more.

Ratslinger gravatar imageRatslinger ( 2017-05-04 01:26:09 +0100 )edit