I want to increase the width of data label 'Max CVSS Base' so that the text and the value display correctly.
Please find the code I am using below.
- Code: Select all
RectangleF rectThermometer = new RectangleF(1096, 75, 115, 437);
IChart clusteredChart = presentation.Slides[slideIndex].Shapes.AppendChart(ChartType.ColumnClustered, rectThermometer);
clusteredChart.HasTitle = false;
clusteredChart.HasLegend = false;
clusteredChart.PlotArea.Height = 350;
//remove grid lines
clusteredChart.PrimaryValueAxis.MajorGridTextLines.FillType = FillFormatType.Solid;
clusteredChart.PrimaryValueAxis.MajorGridTextLines.FillFormat.SolidFillColor.Color = Color.White;
clusteredChart.PrimaryCategoryAxis.MajorGridTextLines.FillType = FillFormatType.None;
clusteredChart.PrimaryValueAxis.IsAutoMax = false;
clusteredChart.PrimaryValueAxis.IsAutoMin = false;
clusteredChart.PrimaryValueAxis.MinValue = 0;
clusteredChart.PrimaryValueAxis.MaxValue = 10;
clusteredChart.PrimaryCategoryAxis.IsVisible = false;
clusteredChart.PrimaryValueAxis.IsVisible = false;
clusteredChart.Series.SeriesLabel = clusteredChart.ChartData["B1", "B1"];
clusteredChart.Categories.CategoryLabels = clusteredChart.ChartData["A2", "A2"];
clusteredChart.Series[0].Values = clusteredChart.ChartData["B2", "B2"];
clusteredChart.Series[0].Fill.FillType = FillFormatType.Solid;
clusteredChart.Series[0].Fill.SolidColor.Color = Color.FromArgb(216, 59, 1);
clusteredChart.ChartData[0, 0].Text = "CVSS";
clusteredChart.ChartData[1, 0].Text = "Max CVSS Base";
clusteredChart.ChartData[1, 1].Value = maxCVSS;
clusteredChart.ChartStyle = ChartStyle.Style5;
ChartDataLabel cd1 = clusteredChart.Series[0].DataLabels.Add();
cd1.Position = ChartDataLabelPosition.Center;
cd1.Line.Width = 18;
cd1.DataLabelShapeType = DataLabelShapeType.Rectangle;
cd1.TextProperties.Paragraphs[0].DefaultCharacterProperties.LatinFont = new TextFont("Segoe UI Light");
cd1.TextProperties.Paragraphs[0].DefaultCharacterProperties.FontHeight = 14;
cd1.TextProperties.Paragraphs[0].DefaultCharacterProperties.Fill.FillType = FillFormatType.Solid;
cd1.TextProperties.Paragraphs[0].DefaultCharacterProperties.Fill.SolidColor.Color = Color.White;
cd1.TextFrame.AutofitType = TextAutofitType.Shape;
cd1.Line.FillType = FillFormatType.None;
cd1.Fill.FillType = FillFormatType.Solid;
cd1.Fill.SolidColor.Color = Color.FromArgb(216, 59, 1);
cd1.CategoryNameVisible = true;
cd1.LabelValueVisible = true;
clusteredChart.GapWidth = 25;
clusteredChart.OverLap = 28;
RectangleF rectEllipse = new RectangleF(1095, 405, 117, 109);
IAutoShape ellipse = presentation.Slides[slideIndex].Shapes.AppendShape(ShapeType.Ellipse, rectEllipse);
ellipse.Fill.FillType = FillFormatType.Solid;
ellipse.Fill.SolidColor.Color = Color.FromArgb(216, 59, 1);
ellipse.Line.FillType = FillFormatType.None;
RectangleF rectInEllipse = new RectangleF(1097, 409, 111, 107);
IAutoShape msgRect = presentation.Slides[slideIndex].Shapes.AppendShape(ShapeType.Rectangle, rectInEllipse);
msgRect.Fill.FillType = FillFormatType.None;
msgRect.Line.FillType = FillFormatType.None;
msgRect.AppendTextFrame("The score shown reflects the highest base score from the set of applicable CVEsms");
TextRange textRng = msgRect.TextFrame.TextRange;
textRng.LatinFont = new TextFont("Segoe UI Light");
textRng.FontHeight = 11;
textRng.Fill.FillType = FillFormatType.Solid;
textRng.Fill.SolidColor.Color = Color.White;
Thanks.