How to have in graphs title, subtitle, x axis and y axis referred to cells

in calc when I have a chart I would like to have title, subtitle, x axis and y axis referred to cells like A1, A2, A3, A4 for example, so changing the cells value the title, subtitle, x axis and y axis change.
the only way I tried is:
doubleclick on the chart>insert>titles… and inserted “=A1” without “” but the result was bad :slight_smile: the title result =A1 as text

Please do not post as Wiki.

Hello @procuste,

I don’t believe there is a way to do this without a macro. If interested, the attached sample demonstrates the process.

The titles are changed by changing the appropriate content of Cells B1 through B4. If the cell is empty, that title will be removed from the chart. The macro (ChangeChartTitles) is attached to the cell via an event on the sheet - Content Changed. Just select the cell, then the events are accessed by right clicking the sheet tab and selecting Sheet Events....

The only items in the macro which you may need to change are the actual cell names you will use & possibly the chart name. Cell names are somewhat obvious but the chart name is the internal name. You can obtain this from Navigator under Ole Objects if you have not given the chart your own name. If so, delete the name you gave it & the internal name will display in Navigator.

Sample: ChartTitlesFromCells.ods

If this answers your question please tick the :heavy_check_mark: (upper left area of answer). It helps others to know there was an accepted answer.

manythanks, I will try the macro, I don’t like but it seems that I have to use macros :-),

Manythanks, the macro works very fine :-), …the macro seems quite easy to modify even for a neby like me, if I can do it, where can I found the names like oCellXAxisTitle for secondary x axis or other elements of the chart?

Getting at the various chart items is somewhat tedious. Here is the document I have used most → AOO Charts. More actual code & comments can be found in my samples for Base charts posted here → Charts in Base forms.

There is a trick, that perhaps solves what you want-
1 Right-click on the chart, select Area and set up to None.
2 Doublec click on the chart, right click on the chart Area, format Area, set up as None.
and putting such information in cells behind the chart.

If you need format the chart area, the without format the Area to None, arrange the chart as background so cells are visible over the chart, but you need to use the navigator the select the chart after that.

…manythanks, the trick is fine, but in my case I need to export chart as image and in this case this trick is not useful

Since 6.0.3 version it works selecting the cells, Menu/File/Export, marking selection.

https://wiki.documentfoundation.org/ReleaseNotes/6.0#Exporting_images