I have a OfficeChartType.Bar_Stacked_100 chart with value data lables. When the percentage is low, the label is crossing the chart area and it looks messy. Is it possible to place labels on the white space to the right of the plot area? Thank you very much! Natalia G.
chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None;
chart.ChartType = OfficeChartType.Bar_Stacked_100;
List<BarChartData> dataList = new List<BarChartData>();
dataList = GetPercentChartData(stateCode, year, type);
if (dataList.Count > 0)
{
chart.SetDataRange(dataList, 1, 1);
chart.ChartData.SetValue(1, 1, "");
chart.ChartData.SetValue(1, 2, "");
chart.ChartData.SetValue(1, 3, "Good");
chart.ChartData.SetValue(1, 4, "Fair");
chart.ChartData.SetValue(1, 5, "Poor");
chart.ChartData.SetValue(1, 6, "Not Rated");
for (int i = 1; i < 4; i++)
{
IOfficeChartDataLabels dataLabels = chart.Series[i].DataPoints.DefaultDataPoint.DataLabels;
dataLabels.IsValue = true;
dataLabels.NumberFormat = "0.0%";
dataLabels.Size = 8;
chart.Series[i].SerieFormat.CommonSerieOptions.GapWidth = 20;
}
//Sets position for plot area
chart.PlotArea.Layout.LeftMode = LayoutModes.auto;
chart.PlotArea.Layout.TopMode = LayoutModes.edge;
chart.PlotArea.Layout.LayoutTarget = LayoutTargets.outer;
chart.PlotArea.Layout.Top = 20; //15
chart.PlotArea.Border.LinePattern = OfficeChartLinePattern.Solid;
chart.PlotArea.Layout.Height = 50;
chart.PlotArea.Layout.Width = 255;
//Sets position for chart legend
chart.Legend.Position = OfficeLegendPosition.Bottom;
chart.Legend.Layout.LeftMode = LayoutModes.factor;
chart.Legend.Layout.TopMode = LayoutModes.edge;
chart.Legend.Layout.Top = 80;
chart.Legend.TextArea.Size = 8;
chart.HasLegend = true;
}