title: How can I change the values in a PowerPoint chart using VSTO and C#?
body: <p>I need to change the source data in a PowerPoint chart using VSTO. The first code snippet shows how I get the series from my shape object.</p>
  
  <pre><code>SeriesCollection seriesCollection = shape.Chart.SeriesCollection();
  Series series = seriesCollection.Item(1);
  </code></pre>
  
  <p>I've tested that it works by calling</p>
  
  <pre><code>series.Delete()
  </code></pre>
  
  <p>Which will remove the series from the chart. However, if possible, I would like to just change the values of the series instead. I've tried the following:</p>
  
  <pre><code>series.Values = myArray1;
  series.XValues = myArray2;
  </code></pre>
  
  <p>Which results in an empty graph. (The Series names and title remain, but the data is missing). </p>
  
  <p>Does anyone know how this can be accomplished? My current solution is to regenerate the chart in excel and replace the one in PowerPoint, but I was hoping there is a more efficient way. </p>