Free Support Forum - aspose.com

Aseries is undefined while working with ErrorBar

HI,
I am trying with example given in https://apireference.aspose.com/net/cells/aspose.cells.charts/errorbar/
But could not access Errorbar as Aseries is undefined

@rasmi.mishra,

Thanks for providing us details.

Well, ASeries class is deprecated rather removed, please use Series class instead. So, if you need to get Y direction error bars of the series, you may try:
e.g
Sample code:

Series series = chart.NSeries[i];
ErrorBar eb = series.YErrorBar; 

Please see the complete updated sample code that you may use for your reference:
e.g
Sample code:

Workbook workbook = new Workbook();
            Cells cells = workbook.Worksheets[0].Cells;
            cells["a1"].PutValue(2);
            cells["a2"].PutValue(5);
            cells["a3"].PutValue(3);
            cells["a4"].PutValue(6);
            cells["b1"].PutValue(4);
            cells["b2"].PutValue(3);
            cells["b3"].PutValue(6);
            cells["b4"].PutValue(7);

            cells["C1"].PutValue("Q1");
            cells["C2"].PutValue("Q2");
            cells["C3"].PutValue("Y1");
            cells["C4"].PutValue("Y2");

            int chartIndex = workbook.Worksheets[0].Charts.Add(ChartType.Column, 11, 0, 27, 10);

            Chart chart = workbook.Worksheets[0].Charts[chartIndex];
            chart.NSeries.Add("A1:B4", true);

            chart.NSeries.CategoryData = "C1:C4";

            for (int i = 0; i < chart.NSeries.Count; i++)
            {
                Series aseries = chart.NSeries[i];
                aseries.YErrorBar.DisplayType = ErrorBarDisplayType.Minus;
                aseries.YErrorBar.Type = ErrorBarType.FixedValue;
                aseries.YErrorBar.Amount = 5;
            }

            workbook.Save("e:\\test2\\out1.xlsx");

And, we will soon update the example codes in the API Reference as it is still using older APIs.

Sorry for any inconvenience caused and let us know if we can be of any further help.

Thank you.