Customizing the display of the StackedBar Chart Legend

We want to customize the orientation of legend in stackbar chart. we are getting weird display of chart/legend.Stacked Bar Legend Issue - Copy.zip (475.8 KB)

@s1pandey,
Thank you for posting the query. Could you describe the issue in more detail, please?

We want to display legend something like attached screen shots.we want to display legend this way.PNG (30.9 KB)

as for long legend chart/legend look ugly

@s1pandey,
You can customize the position and size of the Plot Area and Legend as shown below:

var presentation = new Presentation("Stacked Bar Legend Issue.pptx");
var chart = presentation.Slides[0].Shapes.OfType<IChart>().First();

chart.Width = 900;
chart.Height = 390;

chart.PlotArea.X = 0f;
chart.PlotArea.Y = 0f;
chart.PlotArea.Width = 0.5f;
chart.PlotArea.Height = 0.8f;

chart.Legend.X = 0f;
chart.Legend.Y = 0.84f;
chart.Legend.Width = 1f;
chart.Legend.Height = 0.15f;

Please note that values of X and Width are specified as fractions of the chart width, and Y and Height are specified as fractions of the chart height.

Documents: Chart Plot Area, Chart Legend
API Reference: IChartPlotArea Interface, ILegend Interface

can I move out the legend to out of the chart section and provide custom x/y/height/width? and also above code is not working… there is no effect of apply this change. I am working on 19… versions

the above code you provided is working… thanks

@s1pandey,

The chart legend and plot area cannot be moved out of the chart area.