Epplus insert chart ColumnStacked3D switch row/column

Viewed 1798

I'm using epplus to create excel in my program! I need insert a column chart. This is my code:

//Add the chart to the sheet
var chart = sheet.Drawings.AddChart(chartTitle, eChartType.ColumnStacked3D);
chart.SetPosition(positionRow, 2, positionCol, 2);
chart.Title.Text = chartTitle;
chart.Title.Font.Bold = true;
chart.Title.Font.Size = 18;
chart.SetSize(width, height);

//Set the data range
chart.Series.Add("D17:D22", "B17:B22");
chart.Series.Add("P17:P22", "B17:B22");

And I get result:

enter image description here

But I want result as:

enter image description here

After I created excel file from program, I open it and change the chart: Right click in the chart/Select data/Switch row/column. How can I Switch row/column in my code? Or how to insert the chart like the below picture?

Sorry for not good in English

Thank you very much!

1 Answers
Related