Jan,

please find some code who works fine for me,

maybe its locking and unlocking whor provoke the refresh or its becuase i change some more things after setting the data ?

 oChart.lockControllers()
  oChart.Data.setData(DataArray())
 oChart.Data.setrowDescriptions(LabelsArray())

    dim columnLabelsArray(2)

         columnLabelsArray(0) = "20" & mid(sjaarmin2,len(sjaarmin2)-4,2)
        columnLabelsArray(1) = "20" & mid(sjaarmin1,len(sjaarmin2)-4,2)
         columnLabelsArray(2) = "20" & mid(sjaarnu,len(sjaarmin2)-4,2)

     oChart.Data.setColumnDescriptions(columnLabelsArray())
    ' Title
     oChart.HasMainTitle=false
    oChart.Title.string = sTitel
    ' Labels
     oChart.DataSourceLabelsInFirstColumn = true
     oChart.DataSourceLabelsInFirstRow= false
    ' Legend
     ochart.hasLegend = true
' oSheet.getCharts.getByName("CHART1").getEmbeddedObject.hasLegend = true

     ochart.area.fillcolor = rgb(240,240,240)
     oChart.unlockControllers()

i resently found out that using the "dispatcher" also can provocke the refresh of some doc ellements

document = odoc.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
'here do changing the rowheigt in calc document the repositoning of 'all shapes in a doc
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "RowHeight"
args1(0).Value = 500
dispatcher.executeDispatch(document , ".uno:RowHeight", "", 0, args1())

Hi,

with this code I can change the data in a Writer chart:

     set doc = thisComponent
     set ctrl = thisComponent.CurrentController
     xChart = ctrl.getModel().getEmbeddedObjects.getByName("Objekt1")
     set cDoc = xChart.getEmbeddedObject
     set cDataArray = cDoc.getDataProvider
     data = cDataArray.getData
     ' Do something with the data
     cDataArray.setData(data)

But I can't get the chart to update. The only way I see is to
double-click on the chart in the document, then it will update.

What is the right way to force an update via code?

Thank!
     Jan

_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to