Bug 164516 - Cannot change chart type to 'Of-Pie' chart by macro
Summary: Cannot change chart type to 'Of-Pie' chart by macro
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
25.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: kurt.nordback@protonmail.com
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Chart Macro
  Show dependency treegraph
 
Reported: 2024-12-30 15:12 UTC by Regina Henschel
Modified: 2025-01-01 16:50 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
document with macro to change the chart type (18.32 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-12-30 15:12 UTC, Regina Henschel
Details
Screenshot of chart in edit mode (75.06 KB, image/png)
2024-12-31 12:42 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2024-12-30 15:12:55 UTC
Created attachment 198324 [details]
document with macro to change the chart type

Open attached document. It contains a column chart and a macro to change the chart type.

The parts in the macro to change the chart type are in comments in the attached file.
  Rem Change to a pie chart. This works.
  'oDiagram = oChartDoc.createInstance( "com.sun.star.chart.PieDiagram" )
  'oChartDoc.setDiagram(oDiagram)
  
  Rem Change to a of-pie chart. This does not work.
  'oDiagram = oChartDoc.createInstance( "com.sun.star.chart.BarOfPieDiagram" )
  'oChartDoc.setDiagram(oDiagram) 

To test one or the other you need to remove the ' character at start of the lines.

A reason that "BarOfPieDiagram" does not work might be, that it is not a service of com.sun.star.chart and that it is not included in offapi/type_reference/offapi.idl.
Comment 1 m_a_riosv 2024-12-30 23:14:14 UTC
Reproducible with all versions also with OOo
Comment 2 m_a_riosv 2024-12-30 23:37:57 UTC
Sorry @Regina, but BarOfPieDiagram doesn't appear as an option to select the chart type on the UI
Comment 3 Regina Henschel 2024-12-31 12:42:10 UTC
Created attachment 198339 [details]
Screenshot of chart in edit mode

The option in the UI is the chart type "Of-Pie". It has two sub-types: "Bar-of-pie Chart" and "Pie-of-pie Chart", see screenshot.

You can see the chart type "com.sun.star.chart.BarOfPieDiagram" in the property "DiagramType" using the Development tools. The way is: Object > Sheets > Sheet1 (or where the chart is for you) > Charts > Object 1 (or what number it has for you). Then in its 'Properties': EmbeddedObject > Diagram > DiagramType. Do not use "Current Selection" in the Development tools. That does not work well for chart objects.

This diagram type is new in LO 24.8. So for testing you cannot use an earlier version of LibreOffice. You should use a daily build for testing to get the fixes included in the meantime.
Comment 4 Regina Henschel 2024-12-31 12:58:16 UTC
Kurt, I have added you to CC because you are involved in 'Of-Pie' charts.
Comment 5 m_a_riosv 2024-12-31 19:19:26 UTC
Thanks @Regina I can see it with 25.2/25.8