How to add SecondCategoryAxis (line) to Column Chart

Would someone please post sample code to add a Secondary Axis line to a column chart.

I can't find it in the documentation.

Thanks,
-Duke

Hi,


Please see a simple sample code for your reference:

Sample code:

Workbook wb = new Workbook();
Worksheet worksheet = wb.Worksheets[0];
int chartIndex = worksheet.Charts.Add(ChartType.Column, 5, 0, 20, 8);
Chart chart = worksheet.Charts[chartIndex];

chart.ValueAxis.AxisLine.Color = Color.Maroon;
chart.ValueAxis.AxisLine.Style = LineType.Dot;
chart.ValueAxis.AxisLine.Weight = WeightType.WideLine;
chart.ValueAxis.MinValue = 0;
chart.ValueAxis.MaxValue = 80;
chart.ValueAxis.MajorUnit = 10;

chart.SecondValueAxis.IsVisible = true;
chart.SecondValueAxis.AxisLine.Color = Color.DarkRed;
chart.SecondValueAxis.AxisLine.Style = LineType.Dot;
chart.SecondValueAxis.AxisLine.Weight = WeightType.MediumLine;
chart.SecondValueAxis.MinValue = 0;
chart.SecondValueAxis.MaxValue = 1.4;
chart.SecondValueAxis.MajorUnit = 0.2;

chart.NSeries.Add("{50, 70, 20}", false);
chart.NSeries.Add("{0.6, 0.8, 1}", false);


chart.NSeries.CategoryData = “{1,3,5}”;
chart.NSeries.SecondCatergoryData = “{10,30,15}”;
chart.SecondCategoryAxis.IsVisible = true;

//Plot the second series on second axis line.
chart.NSeries[1].PlotOnSecondAxis = true;

wb.Save(“e:\test2\test1.xlsx”);

Thank you.