How to Update Text for Chart Legend in PowerPoint Presentation in C#?


How can I update the chart legend text. I am trying to update legend in column chart but cannot find any functionality. Kindly can you please provide a sample code in .net to update the legend of the chart.


Welcome to our community! Thank you for posting the query. Could you describe your requirements for updating the chart legend in more detail with an example, please?

chartlegend.PNG (28.3 KB)
I have attached a sample chart. I want to update series 1, series 2, series 3 to another value for e.g. I want to update series 1 to ABC.


Names of the series are stored in chart data (Excel workbook) just like any other data. You can change them in two ways for cells.

Updating through ChartDataWorkbook:

chart.ChartData.ChartDataWorkbook.GetCell(0, 0, 1).Value = "New Series Name 1";

Updating through Series collection:

chart.ChartData.Series[0].Name.AsCells[0].Value = "New Series Name 2";

Documents: Create Chart, Chart Series
API Reference: IChartDataWorkbook Interface, IChartSeries Interface