Legends for more than one series RRS feed

  • Question

  • I can't get excel to create LegendEntries for more series than the first one created in a chart.

    Series are added using:

    MSExcel.Series series = seriesCollection.NewSeries();

    Depending on the values of the series in the first call the legend is created with an equal number of legend.LegendEntries, let's say 6 rows are used than 6 entries are created.

    MSExcel.Legend legend = (MSExcel.Legend)chartObject.Chart.Legend;

    If I add another call to NewSeries the legend is not affected, any idea why? I'm able to change the interior color of the bars created in the legend for the first series but not for the remaining. Any ideas why this happens? 



    • Edited by Sudden82 Sunday, September 2, 2018 9:54 AM
    Saturday, September 1, 2018 8:53 PM

All replies

  • Hi Sudden,

    This forum(Excel for Developers) is for development issues related to Excel Object Model of Microsoft product. As your mentioned MSExcel object which is more related third part product feature. If so, I would suggest that you can find related support team to help for this.

    Thanks for your understanding.

    Best Regards,


    Monday, September 3, 2018 10:25 AM
  • Normally for me if the chart has a legend, if I add new series manually or programatically a new legendEntry is automatically added to the legend.

    If for whatever reason that doesn't happen for you, delete the legend and create a new one, eg

    cht.HasLegend = False ' or cht.Legend.Clear
    cht.HasLegend = True

    If your legend is not in its default position you might first want to trap its coordinates and re-postion the new legend with same

    • Proposed as answer by Simon Wu-MSFT Tuesday, September 11, 2018 8:36 AM
    Monday, September 3, 2018 11:18 AM