Answered Chart not updating data changes in PowerPoint

  • Saturday, May 05, 2012 3:16 PM
     
     

    Dear Experts,

    I am facing problems updating data in a chart.

    What I am trying to achieve is the following: A chart is inserted into the presentation at design time. Then, when the slideshow is run, the data (numbers) of the chart need to be updated from csharp code (with some real-time measurements).

    I am using Chart.SeriesCollection to update the data. Althought the figures are set correctly in the object model, is not updated on screen, but the columns in the chart disappear.

    When I stop the slideshow and user the functions "Edit data..." (in the context menu of the chart) or "Select data" (in the ribbon) suddenly tha figures I have set are updated in the chart, and all is displayed correctly. As a "side-effect" these buttons will also display Excel to show the data entry for the charts.

    Also, if I call Chart.ChartData.Activate() during the slideshow, Excel is opened with the (original) chart data, and the correct figures are shown in the chart. Obviously this is not a viable solution, as the Excel window is appearing during the slideshow, which is definitely a no-go.

    I also tried using Chart.Refresh() but it does not seems to have any effect. Chart data is only updated when the associated Excelsheet is show.

    Did any of you manage to update data in a Chart in Powerpoint "silently"?

    Thanks,

    Oliver

All Replies

  • Sunday, May 06, 2012 8:12 AM
    Moderator
     
     

    Hi Oliver

    I've moved your question to the General Office Developer forum, as that's where PowerPoint questions are discussed on MSDN. However, most of the PowerPoint specialists (even the programmers) "live" in the Answers forums. We can't move or copy questions to that set of forums, so you might want to post there, as well.


    Cindy Meister, VSTO/Word MVP

  • Monday, May 07, 2012 1:48 PM
     
     

    I have been able to update embeded Excel charts on slides while they are in a presentation window. However, this was done from another Excel file (on a second monitor). I will have to test it under the conditions you have.

    Where is the C# code running? Is it being referenced as a class from within PowerPoint?

  • Sunday, June 10, 2012 11:41 PM
     
      Has Code

    I have the same problem - looks like a bug

    Has anyone found a workaround?

    In the VBA code below I have 2 arrays of variants of size nPoints + 1: values and xvalues.  Target is the chart object

        target.SetSourceData "='Sheet1'!$A$1:$B$" & CStr(nPoints + 1)
        target.SeriesCollection(1).xvalues = xvalues
        target.SeriesCollection(1).values = values
    Nothing updates unless I edit the data
    • Edited by Seb1732 Sunday, June 10, 2012 11:42 PM
    •  
  • Saturday, August 25, 2012 8:22 PM
     
     Answered

    My code is within a class which is called by the VSTO AddIn.

    I have used the following workaround:

    - During the start of the slideshow open excel

    - Either change the excel application to invisible or just minimize/deactivate the window

    Is not a perfect solution but the best one I could come up with.

  • Sunday, August 26, 2012 7:43 AM
    Moderator
     
     

    Hi Sviver

    Thanks for taking a moment to come back and outline your workaround :-)

    As I was reading through your original message again, it occurred to me that another possible work-around would be to link the chart in from Excel. It's possible, if you maintain the complete chart + data in Excel that it would render correctly when PowerPoint loads it. Might be worth a quick test if having to run the Excel application parallel to PowerPoint is undesirable.


    Cindy Meister, VSTO/Word MVP