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.

Mon Feb 26, 2018 11:10 am

Hi,

I'm adding some custom DataLabels to my series , and all of them shows Legend key (Marker by default).
I tried to remove it but with no success

Code: Select all
ChartDataLabel.LegendKeyVisible
and
Code: Select all
ChartSeriesDataFormat.LegendKeyVisible
are not doing a thing.

See code snippet and attached screenshot. There 2 markers for every point there : one from series another from datalabel, I want the 2nd one to be gone.

Code: Select all
        static void Main(string[] args)
        {

            var presentation = new Presentation();
            var slide = presentation.Slides[0];

            var chart = slide.Shapes.AppendChart(ChartType.ScatterStraightLinesAndMarkers, new RectangleF(50, 50, 500, 500), false);

            int count = 5;

            chart.Series.SeriesLabel = chart.ChartData[0, 0, 0, count - 1];
            var pointCount = 1;
            for (int i = 0; i < count; i++)
            {
                chart.ChartData[0, i].Value = "Series" + i;

                for (var j = 0; j < pointCount; j++)
                {
                    chart.ChartData[j + 1, i].Value = i;
                    chart.ChartData[j + 1, count + i].Value = i + j + count;
                }

                chart.Series[i].YValues = chart.ChartData[1, i, pointCount, i];
                chart.Series[i].XValues = chart.ChartData[1, count + i, pointCount, count + i];

                var cd = chart.Series[i].DataLabels.Add();
                cd.ID = 0;
                cd.LegendKeyVisible = false;
                cd.BubbleSizeVisible = false;
                cd.CategoryNameVisible = false;
                cd.LabelValueVisible = false;
                cd.TextFrame.Paragraphs[0].Text = $"Marker";

                chart.Series[i].DataLabels.LegendKeyVisible = false;
                chart.Series[i].DataLabels.LeaderLinesVisible = true;
            }

            presentation.SaveToFile("D://test.pptx", FileFormat.Pptx2013);
            Process.Start("D://test.pptx");

        }


Regards

Stecya
 
Posts: 27
Joined: Wed Jan 10, 2018 2:36 pm

Tue Feb 27, 2018 7:01 am

Dear Stecya,

Thanks for your inquiry.
There was something wrong when adding the custom data label, and it caused two markers. Please set cd.LabelValueVisible as "true" firstly, and then set your custom data label. Finally, there will be only one marker. Code snippet:
Code: Select all
                    var cd = chart.Series[i].DataLabels.Add();
                    cd.ID = 0;
                    cd.LabelValueVisible = true;
                    cd.TextFrame.Paragraphs[0].Text = "Marker";

If there is any question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Mar 01, 2018 10:27 am

Dear Stecya,

Greetings from E-iceblue.
Has your issue been resolved ? Could you please give us some feedback at your convenience ?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Mar 01, 2018 2:45 pm

Adding
Code: Select all
cd.LabelValueVisible = true;
solved the issue

Stecya
 
Posts: 27
Joined: Wed Jan 10, 2018 2:36 pm

Fri Mar 02, 2018 1:27 am

Dear Stecya,

Thanks for your feedback.
Any question, just feel free to contact us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Mar 06, 2018 2:58 am

Dear Stecya,

Glad to inform you that the two markers issue using your previous code has been fixed in Spire.Presentation Pack Hotfix Version:3.3.0.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Presentation