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 Jul 14, 2022 4:21 pm

Can I create a multi series scatter chart using spire?

Here is my chart

multi series scatter chart.PNG


Here is my pptx
Multiseries scatter chart.zip


Thanks!

majeed_s
 
Posts: 69
Joined: Thu Mar 25, 2021 4:13 pm

Mon Jul 18, 2022 11:01 am

Hello Majeed sahebzadha,

Thanks for your message.
When I use the following code to create the PPT file, I got the ArgumentOutOfRangeException, and I noticed that this error will not occur when creating ChartType.ScatterMarkers chart. Anyway, I have logged the ChartType.ScatterSmoothLines type issue into our bug tracking system with the ticket SPIREPPT-2003. Our Dev team will do more investigations to fix it. Once there is any update, I will inform you asap.
Code: Select all
            Presentation pres = new Presentation();
            RectangleF rect1 = new RectangleF(10, 10, 600, 500);
            Spire.Presentation.Charts.IChart chart = pres.Slides[0].Shapes.AppendChart(ChartType.ScatterSmoothLines, rect1, false);
            //Set chart data
            Double[] XV = new Double[] { 0, 2, 4, 6, 8, 10 };
            Double[] X1 = new Double[] { 0, 1.6, 3.6, 4.3, 5, 9 };
            Double[] X2 = new Double[] { 0, 2.3, 3.5, 6, 9, 10 };
            Double[] X3 = new Double[] { 10, 8, 5.5, 4, 3, 0 };
            chart.ChartData[0, 0].Text = "X-Values";
            chart.ChartData[0, 1].Text = "X1";
            chart.ChartData[0, 2].Text = "X2";
            chart.ChartData[0, 3].Text = "X3";
            for (Int32 i = 0; i < XV.Length; ++i)
            {
                chart.ChartData[i + 1, 0].Value = XV[i];
                chart.ChartData[i + 1, 1].Value = X1[i];
                chart.ChartData[i + 1, 2].Value = X2[i];
                chart.ChartData[i + 1, 3].Value = X3[i];
            }
            chart.Series.SeriesLabel = chart.ChartData["B1", "D1"];
            chart.Categories.CategoryLabels = chart.ChartData["A2", "A7"];
            chart.Series[0].XValues = chart.ChartData["A2", "A7"];
            chart.Series[0].YValues = chart.ChartData["B2", "B7"];
            chart.Series[1].XValues = chart.ChartData["A2", "A7"];
            chart.Series[1].YValues = chart.ChartData["C2", "C7"];
            chart.Series[2].XValues = chart.ChartData["A2", "A7"];
            chart.Series[2].YValues = chart.ChartData["D2", "D7"];
            pres.SaveToFile(@"result.pptx", Spire.Presentation.FileFormat.Pptx2013);

Sincerely,
Simple
E-iceblue support team
User avatar

Simple.Li
 
Posts: 248
Joined: Fri Jul 01, 2022 2:33 am

Wed Jul 20, 2022 10:29 am

Hello Majeed sahebzadha,

Greetings from E-iceblue.
I am writing to give you an update about the SPIREPPT-2003 ArgumentOutOfRangeException. After we did more tests, we found that the ArgumentOutOfRangeException is caused that my testing code added the temporary saving method as shown in the below screenshot.
test.png

However, this error didn't occur when creating ChartType.ScatterMarkers type chart, our Dev team informed that this is related to these two chart types' different data structures.
Therefore, you can use my previous code to create the ChartType.ScatterSmoothLines type chart. If you have any further questions, please feel free to contact us.

Sincerely,
Simple
E-iceblue support team
User avatar

Simple.Li
 
Posts: 248
Joined: Fri Jul 01, 2022 2:33 am

Return to Spire.Presentation