I’ve created a pie chart in Writer based on information in a table, am just wondering how to change the headings in the legend? At the moment they are titled “column 1, column 2, column 3” etc.
Left mouse click on legend to select. Then right mouse click and select
Data table. Make changes accordingly:
My Libreoffice (126.96.36.199) has a different set of options when the legend is right-clicked, none resembling the menu shown in your screenshot:
Selecting the chart & right clicking should also give access to the “Data Table” selection.
Doesn’t seem to do so for me. If I right-click the chart in a blank area I get the following options: Copy, Paste, Position & Size, Insert Titles, Delete Legend, Chart Type. If I right-click in the centre of the pie section of the chart, I am provided with these options: Cut, Copy, Paste, Format Data Series, Format Data Labels, Delete Data Labels, Reset all Data Points, Arrangement.
I can’t seem to find the Data Table section in any of these locations… Further, a search for “Data Table” in Help section of main menu toolbar returns no results.
This is present for me in LO v188.8.131.52. However, do not know how your data is used. How and where did you enter the data for your chart?
Saw your other question & sample. The chart you have is based upon a table. When creating in this manner the titles come from either the first row or first column. If neither is selected default names are used - data in rows =
Column X; data in columns =
Row X. This is set at time chart is inserted. It is most likely this could be modified using a macro.
Best to provide a separate row/column in the table and use that when inserting a chart.
Was able to change with this macro:
Option Explicit Sub SetColDesc Dim oEmbeddedObjects As Object Dim oData As Object Dim sColDesc(3) As String sColDesc(0) = "Distance1" sColDesc(1) = "Distance2" sColDesc(2) = "Distance3" sColDesc(3) = "Distance4" oEmbeddedObjects = ThisComponent.getEmbeddedObjects().getByName("Object1") oData = oEmbeddedObjects.Component.getData() oData.setColumnDescriptions(sColDesc) End Sub
This was then attached to the
Document loading finished event of the document.
sColDesc(0) is the leftmost heading and
sColDesc(3) is the rightmost. Of course this is for a four column table (as in the sample posted in your other question).
This is not as expected. Surely the main thing a user expects to change is the legend itself. Having to write a macro to change the legend is almost useless. Having a separate field for the chart legend is counterintuitive. The solution is to present the user with an edit field so that the legend can be changed as well as the legend attributes such as font, colour, background, etc.
This is not the place to request this. Please do so at → Bugzilla
What is presented here is what currently works (at time of posting) and possible work around (if and when appropriate). Request for changes to the software are not part of this site. It is just users dealing with other users.