Categories in reverse order- Excel chart c# programatically

saravanan saravanan 1 Reputation point
2021-07-02T18:57:20.123+00:00

Need to apply Categories in reverse order for excel chart programatically. Couldn't find after hours. Anyone could answer please. Thanks in advance.

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,439 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. SG 1 Reputation point
    2022-09-07T13:07:58.227+00:00

    Range cells = worksheet.Range["AR39", "BC64"];
    Tools.Chart chart = worksheet.Controls.AddChart(cells, "Graph");
    chart.ChartType = XlChartType.xlBarStacked;
    Range group1 = worksheet.Range["$AW$8:$BA$37,$BC$8:$BC$37"];
    chart.SetSourceData(group1);

    Axis axis = (Axis)chart.Axes(
    Excel.XlAxisType.xlCategory,
    Excel.XlAxisGroup.xlPrimary);
    axis.ReversePlotOrder = true;

    0 comments No comments

  2. SG 1 Reputation point
    2022-09-07T13:11:53.867+00:00

    Range cells = worksheet.Range["AR39", "BC64"];
    Tools.Chart chart = worksheet.Controls.AddChart(cells, "Graph");
    chart.ChartType = XlChartType.xlBarStacked;
    Range group1 = worksheet.Range["$AW$8:$BA$37,$BC$8:$BC$37"];
    chart.SetSourceData(group1);

    Axis axis = (Axis)chart.Axes(
    Excel.XlAxisType.xlCategory,
    Excel.XlAxisGroup.xlPrimary);

    0 comments No comments