hi team,
I am facing issues with my PPT that the chart title is overlapping the legend.
Could you please let me know if I can set the legend and title X and y so that it doesnot overlap.
Please find the below code tat i am using to create the pie chart and attached pie chart exported with this code.
var rect = slide.Shapes.AddAutoShape(ShapeType.Rectangle, Xval, Yval, 330, pieCount>2?150:180);
rect.FillFormat.FillType = FillType.Solid;
rect.FillFormat.SolidFillColor.Color = Color.White;
var chart = slide.Shapes.AddChart(ChartType.Pie, Xval, Yval, 320, pieCount>2?140:175);
chart.Name = Configuration.DASHBOARD_COMPCHART + (shapeID++).ToString();
AddShape(chart, true);
chart.PlotArea.Height = pieCount>2?0.5f:0.8f; // chart.Heigh * 0.5 = 400 * 0.5 = 200
chart.PlotArea.Width = pieCount>2?0.5f:0.8f; // Chart.Width * 0.5 = 500 * 0.5 = 250
chart.PlotArea.X = 0f; // chart.X = 500 * 0.25 = 125
chart.PlotArea.Y = 50f; // chart.Y = 400 * 0.25 = 100
ITextFrame text = chart.ChartTitle.AddTextFrameForOverriding("");
text.Text = summary.ScoresTypeName;
text.Paragraphs[0].Portions[0].PortionFormat.FontHeight = 12;
text.Paragraphs[0].Portions[0].PortionFormat.FontBold = NullableBool.True;
text.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillType.Solid;
text.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
Paragraph titlePar = new Paragraph();
titlePar.Text = "Items Included in Comparison: " + summary.ItemsCount.ToString();
titlePar.Portions[0].PortionFormat.FontHeight = 10;
titlePar.Portions[0].PortionFormat.FillFormat.FillType = FillType.Solid;
titlePar.Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
text.Paragraphs.Add(titlePar);
chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();
chart.ChartData.Categories.Add(summary.AboveName + ", " + processPercentForRTL(Math.Round(summary.ItemsAbove).ToString(), LanguageIsRightToLeft));
chart.ChartData.Categories.Add(summary.OnParName + ", " + processPercentForRTL(Math.Round(summary.ItemsOnPar).ToString(), LanguageIsRightToLeft));
chart.ChartData.Categories.Add(summary.BellowName + ", " + processPercentForRTL(Math.Round(summary.ItemsBellow).ToString(), LanguageIsRightToLeft));
chart.ChartData.Series.Add(summary.ScoresTypeName, ChartType.Pie);
IChartDataWorkbook workbook = chart.ChartData.ChartDataWorkbook;
IChartDataPoint datapoint = chart.ChartData.Series[0].DataPoints.AddDataPointForPieSeries(workbook.GetCell(0, 1, 1, summary.ItemsAbove));
datapoint.Format.Fill.FillType = FillType.Solid;
datapoint.Format.Fill.SolidFillColor.Color = DesignSettings.GetValueOrDefault("@UISetting-OnScreenReport-PieChart-ItemsAbove-Color").GetColor();
datapoint = chart.ChartData.Series[0].DataPoints.AddDataPointForPieSeries(workbook.GetCell(0, 2, 1, summary.ItemsOnPar));
datapoint.Format.Fill.FillType = FillType.Solid;
datapoint.Format.Fill.SolidFillColor.Color = DesignSettings.GetValueOrDefault("@UISetting-OnScreenReport-PieChart-ItemsOnPar-Color").GetColor();
datapoint = chart.ChartData.Series[0].DataPoints.AddDataPointForPieSeries(workbook.GetCell(0, 3, 1, summary.ItemsBellow));
datapoint.Format.Fill.FillType = FillType.Solid;
datapoint.Format.Fill.SolidFillColor.Color = DesignSettings.GetValueOrDefault("@UISetting-OnScreenReport-PieChart-ItemsBellow-Color").GetColor();
chart.ChartData.Series[0].Explosion = 2;
chart.Legend.TextFormat.PortionFormat.FontHeight =pieCount>2?9: 10;
chart.Legend.Format.Line.FillFormat.FillType = FillType.Solid;
chart.Legend.Format.Line.FillFormat.SolidFillColor.Color = Color.Black;
chart.Legend.TextFormat.ParagraphFormat.EastAsianLineBreak = NullableBool.False;
QVExport (16).zip (38.6 KB)