Chart update in GUI

Jan Rheinländer jrheinlaender at gmx.de
Sun Dec 4 20:07:48 UTC 2022


Hi,

after doing XChartDataArray setData(), what must I do to let the GUI 
update the chart with the newly set data?

For example, if my document contains a chart called "Objekt80", then 
running the following macro changes the chart series data, but the chart 
doesn't update to display the change.

Sub Main
     objs =  ThisComponent.getEmbeddedObjects()

     for i = 0 to objs.count - 1
         obj = objs(i)

         if (obj.Name = "Objekt80") then
             oChart = obj.Component
             oDataProvider = oChart.DataProvider
             oData = oDataProvider.Data

             Dim oDataArray( 0 To 1 ) As Object
             Dim oSeries1( 0 To 2 ) As Double
             Dim oSeries2( 0 To 2 ) As Double
             oSeries1( 0 ) = 3.141
             oSeries1( 1 ) = 2.718
             oSeries1( 2 ) = 1.0

             oSeries2( 0 ) = 17.0
             oSeries2( 1 ) = 23.0
             oSeries2( 2 ) = 42.0

             oDataArray( 0 ) = oSeries1()
             oDataArray( 1 ) = oSeries2()

             oDataProvider.Data = oDataArray()
         EndIf
     Next i
End Sub

Thanks for any hints,
Jan Rheinländer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20221204/a20b0ef2/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20221204/a20b0ef2/attachment.sig>


More information about the LibreOffice mailing list