How to switch row / column in Excel chart using C #?

I want the chart series names to appear as the column names of my information. This works when I have more than 1 column, but when there is only 1 column of information, it seems that the series name is listed as number 1.

I reproduced this manually in Excel, it seems that the column name is the name of the chart. It looks like it's like the “Select Data” option, and then select the “Switch Row / Column” option.

So my question is: how can I replicate this option using C #?

+3
source share
2 answers

- PlotBy xlRows. Type.Missing, xlColumns, .

Excel.ChartObject.SetSourceData(chartRange, Excel.xlRowCol.xlRows);
+12

, , . Excel 2003. :

if(Chart.HasTitle)
    Chart.ChartTitle.Text = "";  //Excel put a title on the chart when there only one series.
0

Source: https://habr.com/ru/post/1707154/


All Articles