Update chart in Writer after changed by macro

The document Macro A try update .odt (19.4 KB) contains a table and a chart from the table. It has a macro, that removes one column form the chart. Select the chart, then call the macro of the file and run it (Alt+F11) . You see no change in the macro. But if you double-click the chart to edit mode, then you can see, that the chart was indeed changed by the macro.

The document Macro B try update.ods (16.5 KB) has a similar macro and a similar table and chart. Run its macro. In a spreatsheet document update works.

Needs Writer something special in the macro which is missing? Or is this a bug which I should report?

I know, that I can use the dispatcher in Writer to update the chart. But I want to know, whether method “update()” is faulty in Writer.

Years ago I wrote a bit of code to be able to harmonize all the Math formulas in a text document applying all style settings made for one of them (the “template”).
In fact I didn’t apply lots of settings, but replaced the OLE shapes one by one with the template, and only assigned the formula taken from each “old” Math fgrame to the respective pasted clone of the template in its new place. The old formula was then disposed.

Anyway I needed to update the pasted/reused formula frames. I did it using the dispatcher then, but also studied a bit the FaF extension where a completely different reworking also needed updates which were done (for the frames) by oleFrame.ExtendedControlOverEmbeddedObject.update().
Just changed a line in my old code this way, and it worked. It did not work the same way for your chart.
Conclusion: There seems to be a bug not afflicting all OLE embedding objects, but chart frames in text documents.

If I simply click on the chart you do not see the immediate change. However if you double click (put into edit mode) before running the macro then the change appears immediately.
.
Edit;
Can also update without selecting the chart:

Sub RemoveColumn
	dim oDoc as variant: oDoc=ThisComponent
	dim oCurrentController as variant: oCurrentController = ThisComponent.getCurrentController()
	dim oChartFrame as variant: oChartFrame = oDoc.CurrentSelection
'    if NOT (oChartFrame.supportsService("com.sun.star.text.TextEmbeddedObject")_
'    	AND oChartFrame.CLSID = "12DCAE26-281F-416F-a234-c3086127382e") then 
'		msgbox("Selection is not a chart")
'		exit sub
'	end if
    dim oEmbeddedObjects As Object
	oEmbeddedObjects = ThisComponent.getEmbeddedObjects()
    dim oChart as Object
	oChart = oEmbeddedObjects.getByName("Object1")
    dim oChartModel as variant: oChartModel = oChart.Model
'	dim oChartModel as variant: oChartModel = oChartFrame.Model
    dim nDelCol as integer: nDelCol = 2: 'fix value for testing, removes series "Three"
	dim oDiagram as variant: oDiagram = oChartModel.getFirstDiagram()
	dim oCoords as variant: oCoords = oDiagram.getCoordinateSystems()
	dim oCoord as variant: oCoord = oCoords(0)
	dim oChartTypes as variant: oChartTypes = oCoord.getChartTypes()
	dim oChartType as variant: oChartType = oChartTypes(0)
 
	dim oDataSeriesContainer as variant: oDataSeriesContainer = oChartType.getDataSeries()    
	dim nMaxIndex as integer: nMaxIndex = UBound(oDataSeriesContainer)
	if nDelCol > nMaxIndex OR nDelCol < 0 OR nMaxIndex <= 1 then
		exit sub
	end if
	
	dim oDelDataSerie as variant: oDelDataSerie = oDataSeriesContainer(nDelCol)
	oChartType.removeDataSeries(oDelDataSerie)
	
	oChartTypes(0) = oChartType
	oCoord.setChartTypes(oChartTypes)
	oCoords(0) = oCoord
	oDiagram.setCoordinateSystems(oCoords)
	oChartModel.setFirstDiagram(oDiagram)
    
'    oChartFrame.EmbeddedObject.update() 
'	oChart = oEmbeddedObjects.getByName("Object1")

	dim oEmbeddedChart as Object: oEmbeddedChart = oChart.getEmbeddedObject()

Rem Possible crashes without this wait (seems random)
	wait(100)
    dim oXEO as Object: oXEO = oChart.ExtendedControlOverEmbeddedObject
Rem Focus to chart object to refresh display
    oXEO.doVerb(0)
Rem Return focus to position last selected (ie cursor position)
    oXEO.doVerb(-3)
End Sub

Aha, another workaround. doVerb(0) does the same as a double-click. The change in UI is shortly visible.

So it seems to be indeed a bug. I have written tdf#149189.