DeepakVerma
DeepakVerma

Reputation: 99

Create multiple y axis chart epplus c#

I want to have the following multi y-axis chart while exporting to excel:

enter image description here

I tried some examples from the internet but no luck. I am using the following code for the this:

ExcelChart chart = workSheet.Drawings.AddChart("chtLine", eChartType.LineMarkers);
var serie1 = chart.Series.Add(workSheet.Cells["D2:D7"], workSheet.Cells["A2:A7"]);
var chartType2 = chart.PlotArea.ChartTypes.Add(eChartType.ColumnClustered);
var serie2 = chartType2.Series.Add(workSheet.Cells["B2:B7"], workSheet.Cells["A2:A7"]);

chart.SetPosition(0, 0, 8, 0);
chart.SetSize(500, 300);

But this code is creating a single y-axis only. Please help me on this.

Upvotes: 0

Views: 746

Answers (1)

DeepakVerma
DeepakVerma

Reputation: 99

It get resolved. I simply added the following line of code:

chart.UseSecondaryAxis = true;

Upvotes: 1

Related Questions