Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Tue Oct 23, 2018 6:45 am

Hi,

I want to increase the width of data label 'Max CVSS Base' so that the text and the value display correctly.
thermometerChart.PNG


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.

ProwessConsulting
 
Posts: 12
Joined: Tue Oct 02, 2018 9:16 pm

Tue Oct 23, 2018 8:53 am

Hello,

Thanks for your post.
Sorry that our Spire.Presentation doesn't support increasing the width of data labels in a chart at present. And I have already added the new feature in our future upgrade. If it is implemented, we will let you know. Sorry for the inconvenience caused.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Fri Nov 09, 2018 10:03 am

Hello,

Glad to inform you that the new feature has been implemented in Spire.Presentation Pack Hotfix Version:3.11.1. Please add the following code snippet to achieve your demand. If there is any question, just feel free to write back.
Code: Select all
.....
cd1.DataLabelSize = new SizeF(0.7f, 0.7f);
......

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Mon Nov 12, 2018 1:39 pm

Hi Lisa,

Thank you very much for the great product and excellent service!

Regards,
Prowess Consulting

ProwessConsulting
 
Posts: 12
Joined: Tue Oct 02, 2018 9:16 pm

Tue Nov 13, 2018 1:16 am

Dear Prowess,

Thanks for your valuable feedback. Any question, just feel free to contact us.
Wish you all the best!

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Tue Mar 19, 2019 7:21 am

Hi,

We are having some issues with the display of the datalabel of the thermometer chart. The generated PPT was downloaded from Azure website and was saved locally.
After closing and re-opening the PPT, the datalabel became narrow as shown below.

Before saving:
beforeSaving.png

After saving:
afterSaving.png


Please note that this is only happening when downloading the PPT from Azure.

Thanks,
Prowess

ProwessConsulting
 
Posts: 12
Joined: Tue Oct 02, 2018 9:16 pm

Tue Mar 19, 2019 9:34 am

Hello Prowess,

Thank you for contacting us.
I simulated your scenario and tested with Spire.Presentation Pack Hotfix Version:4.3.9, but I didn't
encounter your issue when downloading the generated PPT from Azure. I suggest you try again with the latest version, if the issue still occurs after trying, please share us with your full testing code as well as your input PPT file (if any) to help us do further investigations. You could send them to us via email(support@e-iceblue.com). Besides, could please tell us the Microsoft Office version you used?

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Wed Mar 20, 2019 11:17 am

Hi Lisa,

Thank you for the support.
Unfortunately, It is not possible to send you the full testing code right now.
I have updated Spire.Presentation to the latest version but the issue is still occurring. In fact, after downloading the PPT, I edited it and then saved it. When re-opening the PPT, the issue was there.
I am using Microsoft Office Professional Plus 2016 - Microsoft PowerPoint 2016 MSO (16.0.4738.1000) 64-bit.

Thanks & Regards,
ProwessConsulting

ProwessConsulting
 
Posts: 12
Joined: Tue Oct 02, 2018 9:16 pm

Thu Mar 21, 2019 7:07 am

Hello Prowess,

Thanks for your feedback.
I tested your scenario with Microsoft Office Professional Plus 2016, but still didn't reproduce your issue. Here is my testing Demo which used your previous code. Please test it on your side, if the same issue occurs. To help us do further investigations, please provide your downloaded PPT file, the edited and resaved PPT file as well as more details about how you edit the downloaded PPT file in Microsoft Office Professional Plus 2016. Look forward to your further reply.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Tue Mar 26, 2019 6:55 am

Hello Lisa,

Thank you very much for the quick response.

Please find 2 power point files attached. One has been saved without any modification and the second one saved after doing some modifications (added and removed some text).
Is there a way we can prevent the width of the ChartDataLabel from resizing?

We have set the size as follows:
Code: Select all
           
            ChartDataLabel cd1 = clusteredChart.Series[0].DataLabels.Add();
            cd1.Position = ChartDataLabelPosition.Center;
            cd1.Line.Width = 18;
            cd1.DataLabelShapeType = DataLabelShapeType.Rectangle;
            cd1.DataLabelSize = GetDataLabelSize(maxCVSS);

        private SizeF GetDataLabelSize(float maxCVSS)
        {
            SizeF size;
            if (maxCVSS < 4.5)
            {
                size = new SizeF(0.6f, 0.3f);
            }
            else
            {
                size = new SizeF(0.6f, 0.5f);
            }
            return size;
        }


Also we have noticed we are getting the issue when running the application on our local machine as well as on Ms Azure.
We are preparing a sample application to send you. Our actual application has been coded in Angularjs and Web Api.

Thanks and Regards

ProwessConsulting
 
Posts: 12
Joined: Tue Oct 02, 2018 9:16 pm

Tue Mar 26, 2019 9:30 am

Hello Prowess,

Setting the size for data label like your code, I still didn't reproduce your issue. Besides, I added and removed some text in your Prior PPT file (PowerPoint Report - Prior modification.pptx) by Microsoft Office Professional Plus 2016 like the attached screenshot, the width of the ChartDataLabel also didn't resize when opening the modified file. Anyway, I am looking forward to your sample application, then we will do further investigations. Thanks in advance.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.Presentation