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.

Thu Jan 11, 2018 3:22 pm

Hi

I'm trying to add a lot of Series to Chart , however only the first 5 are correctly displayed in Legend, the other one show empty names. I assume this is because of 5 default Series , though I need a way to show all series on Legend. Please check code snippet and screenshot.

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));

            chart.ChartData.Clear(0, 0, 5, 5);
            chart.Series.Clear();
            chart.Categories.Clear();

            chart.ChartLegend.Position = ChartLegendPositionType.TopRight;
            chart.ChartLegend.Top = 100;
            chart.ChartLegend.IsOverlay = true;
            chart.ChartLegend.Fill.FillType = FillFormatType.Solid;
            chart.ChartLegend.Fill.SolidColor.Color = Color.White;
            chart.ChartLegend.Line.SolidFillColor.Color = Color.Blue;

            int count = 7;

            chart.Series.SeriesLabel = chart.ChartData[0, 0, 0, count-1];

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

                for (var j = 0; j < 10; 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, 10, i];
                chart.Series[i].XValues = chart.ChartData[1, count + i,10, count + i];
            }

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

            Process.Start("D://test.pptx");
        }

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

Fri Jan 12, 2018 4:19 am

Hello,

Thanks for your inquiry.
Please set the parameter "init" to be false in the method "AppendChart" to avoid the initialization of the chart using default data.
Code: Select all
var chart = slide.Shapes.AppendChart(ChartType.ScatterStraightLinesAndMarkers, new RectangleF(50, 50, 500, 500),false);


Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Fri Jan 12, 2018 8:37 am

Thanks, works like a charm

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

Fri Jan 12, 2018 8:58 am

Hello Stecya,

Thanks for your valuable feedback.
Just feel free to contact us if you need any assistance.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Fri Jan 12, 2018 10:39 am

Actually it's not fully working , only first 10 series is displayed in Legend
Check code and screenshot

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);

            chart.ChartLegend.Position = ChartLegendPositionType.TopRight;
            chart.ChartLegend.Top = 100;
            chart.ChartLegend.IsOverlay = true;
            chart.ChartLegend.Fill.FillType = FillFormatType.Solid;
            chart.ChartLegend.Fill.SolidColor.Color = Color.White;
            chart.ChartLegend.Line.SolidFillColor.Color = Color.Blue;

            int count = 15;

            chart.Series.SeriesLabel = chart.ChartData[0, 0, 0, count-1];

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

                for (var j = 0; j < 10; 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, 10, i];
                chart.Series[i].XValues = chart.ChartData[1, count + i,10, count + i];
            }

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

            Process.Start("D://test.pptx");
        }

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

Mon Jan 15, 2018 2:42 am

Hello,

Thanks for your feedback.
I have noticed the issue and delivered it to our dev team for a further investigation.
Once there's any progress, I will let you know.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Mon Jan 29, 2018 9:55 am

Hello Stecya,

Glad to inform that your issue has been resolved. Please download the Spire.Presentation Pack Version:2.9. In addition, our product would only display the primary major vertical gridlines by default. If you would like to change the setting, please refer to the below code.
Code: Select all
 //Manually set the visibility of the gridlines.
 //PrimaryValueAxis.MajorGridTextLines----------> primary major vertial gridlines.
 //SecondaryValueAxis.MajorGridTextLines----------> primary major horizontal gridlines.
 chart.PrimaryValueAxis.MajorGridTextLines.FillType = FillFormatType.None;
 chart.SecondaryValueAxis.MajorGridTextLines.FillType = FillFormatType.Solid;


Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Thu Feb 01, 2018 9:30 am

Hello Stecya,

Good day!
Has your issue been resolved by the hotfix?
Your feedback would be greatly appreciated.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Fri Feb 16, 2018 11:38 am

Hi,

Yes it seems to be fixed now

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

Mon Feb 19, 2018 1:59 am

Hello Stecya,

Thanks for your feedback.
Feel free to contact us if you have any issues.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Presentation