Hi Team,
I’m attaching the stacked column chart file here. I want the series of stacked chart should be plotted in a reverse order.
For Ex.
In the given chart P1 is at the bottom and then It’s P2 and then at the top we have P3.
Instead I want P1 should be at the top and P3 and the bottom touching the X-axis line. Condition is X axis position should not change. It should be always at the bottom.
Is there any config available in MS or ASPOSE which will reverse the series elements from the stacked charts without changing the position of X-axis.
We already tried the value in reverse order option from Excel but also change the position of X-axis.
StackedChart.zip (11.2 KB)
@VaradS
Please try the following codes:
Workbook workbook = new Workbook(download + "StackedChart.xlsx");
Chart chart = workbook.Worksheets[0].Charts[0];
chart.NSeries.SwapSeries(0, 2);
workbook.Save(download + "dest.xlsx");
In Excel, Right click chart, “select data”, select one series, you will move up and down button will be enabled.
@simon.zhao ,
We get n number of series for each category it may vary as well. Do we have an efficient way to achieve this using and flag or method in aspose? For example to revert the Y axis values we can do axis.setPlotOrderReversed(true) but this also changes the position of X axis from bottom to top. We don’t want to change the X-axis position.
@VaradS
Please try the following codes:
Workbook workbook = new Workbook(download + "StackedChart.xlsx");
Chart chart = workbook.Worksheets[0].Charts[0];
// chart.NSeries.SwapSeries(0, 2);
chart.ValueAxis.IsPlotOrderReversed = true;
chart.ValueAxis.CrossType = CrossType.Maximum;
workbook.Save(download + "dest.xlsx");