Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents from any .NET(C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Fri Jul 18, 2014 12:03 am

I am trying to figure out how to create a ScatterPlot. I am using the Free Spire.Presentation Hotfix
This is what I have so far
Code: Select all
Presentation pres = new Presentation();
RectangleF rect1 = new RectangleF(0, 0, 700, 500);
IChart chart = pres.Slides[0].Shapes.AppendChart(Spire.Presentation.Charts.ChartType.ScatterMarkers, rect1, false);
chart.ChartTitle.TextProperties.Text = "X-Y Chart";
chart.ChartTitle.TextProperties.IsCentered = true;
chart.ChartTitle.Height = 30;
chart.HasTitle = true;

Double[] xdata = new Double[] { 7.7, 8.9, 1.0, 2.4 };
Double[] ydata = new Double[] { 15.2, 5.3, 6.7, 8 };

chart.ChartData[0, 0].Text = "X-Axis";
chart.ChartData[0, 1].Text = "Y-Axis";

for (Int32 i = 0; i < xdata.Length; ++i)
{
         chart.Series[0].XValues[i].Value = xdata[i];
         chart.Series[0].YValues[i].Value = ydata[i];
 }



Also when I set the boolean value to false I get an error and when i set the boolean value to true it plots the points but I also get default data.
I want to be able to plot the data that should look like this:
Code: Select all
X-Axis     Y-Axis
7.7          15.2
8.9           5.3
1.0           6.7
2.4           8

andrewhoang09
 
Posts: 8
Joined: Tue Jul 15, 2014 8:56 pm

Fri Jul 18, 2014 9:52 am

Hello,

Thanks for your feedback.
We have noticed the issue you mentioned, which has been posted to our Dev team, once there are any update, we will let you know.
If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Thu Jul 24, 2014 5:18 pm

Hello,
Our company is looking to buy this package and was wondering is there any update on the problem I posted for the XY chart?
Thank You

andrewhoang09
 
Posts: 8
Joined: Tue Jul 15, 2014 8:56 pm

Fri Jul 25, 2014 2:32 am

Hello,

The problem will be fixed in next week, once the hotfix is released, we will let you know immediately.

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Jul 29, 2014 6:22 am

Hello,

There is newest hotfix you can use, please download spire.presentation_2.0.19and try the following code.
Code: Select all
Presentation pres = new Presentation();
RectangleF rect1 = new RectangleF(0, 0, 700, 500);
IChart chart = pres.Slides[0].Shapes.AppendChart(ChartType.ScatterMarkers, rect1,false);
chart.ChartTitle.TextProperties.Text = "X-Y Chart";
chart.ChartTitle.TextProperties.IsCentered = true;
chart.ChartTitle.Height = 30;
chart.HasTitle = true;
Double[] xdata = new Double[] { 7.7, 8.9, 1.0, 2.4 };
Double[] ydata = new Double[] { 15.2, 5.3, 6.7, 8 };
chart.ChartData[0, 0].Text = "X-Axis";
chart.ChartData[0, 1].Text = "Y-Axis";
for (Int32 i = 0; i < xdata.Length; ++i)
{ chart.ChartData[i + 1, 0].Value = xdata[i]; chart.ChartData[i + 1, 1].Value = ydata[i]; }
chart.Series.Clear();
chart.Categories.Clear();
chart.Categories.CategoryLabels = chart.ChartData["A2", "A5"];
chart.Series.SeriesLabel = chart.ChartData["B1", "B1"];
chart.Series[0].XValues = chart.ChartData["A2", "A5"];
chart.Series[0].YValues = chart.ChartData["B2", "B5"];
chart.Series[0].Line.FillType = FillFormatType.None;
pres.SaveToFile(@"..\..\result.pptx", FileFormat.Pptx2007);

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Jul 29, 2014 5:57 pm

I was trying to modify the code to fit my needs and I was wondering Is it possible to add more series to this chart so the data looks like this:
Code: Select all
X-Axis    Y-Axis    A     B      C
7.7        15.2     1.1   3.2   4.0
8.9        5.3      2.4   4.5   3.2
1.0        6.7      3.7   2.2   5.6
2.4        8        4.8   6.8   7.5
 

I am having trouble adding series to this chart and don't know where to start. Thank You

andrewhoang09
 
Posts: 8
Joined: Tue Jul 15, 2014 8:56 pm

Wed Jul 30, 2014 4:29 am

Hello,

Thanks for your inquiry.
Following sample code demonstrates to how to add series to the chart, please try it.
Code: Select all
Presentation pres = new Presentation();
            RectangleF rect1 = new RectangleF(0, 0, 700, 500);
            IChart chart = pres.Slides[0].Shapes.AppendChart(ChartType.ScatterMarkers, rect1, false);
            chart.ChartTitle.TextProperties.Text = "X-Y Chart";
            chart.ChartTitle.TextProperties.IsCentered = true;
            chart.ChartTitle.Height = 30;
            chart.HasTitle = true;

            Double[] xdata = new Double[] { 7.7, 8.9, 1.0, 2.4 };
            Double[] ydata = new Double[] { 15.2, 5.3, 6.7, 8 };
            Double[] A = new Double[] { 1.1, 2.4, 3.7, 4.8 };
            Double[] B = new Double[] { 3.2, 4.5, 2.2, 6.8 };
            Double[] C = new Double[] { 4.0, 3.2, 5.6, 7.5 };

            chart.ChartData[0, 0].Text = "X-Axis";
            chart.ChartData[0, 1].Text = "Y-Axis";
            chart.ChartData[0, 2].Text = "A";
            chart.ChartData[0, 3].Text = "B";
            chart.ChartData[0, 4].Text = "C";

            for (Int32 i = 0; i < xdata.Length; ++i)
            {
                chart.ChartData[i + 1, 0].Value = xdata[i];
                chart.ChartData[i + 1, 1].Value = ydata[i];
                chart.ChartData[i + 1, 2].Value = A[i];
                chart.ChartData[i + 1, 3].Value = B[i];
                chart.ChartData[i + 1, 4].Value = C[i];
            }
            chart.Series.Clear();
            chart.Categories.Clear();
            chart.Categories.CategoryLabels = chart.ChartData["A2", "A5"];

            chart.Series.SeriesLabel = chart.ChartData["B1", "E1"];

            chart.Series[0].XValues = chart.ChartData["A2", "A5"];
            chart.Series[0].YValues = chart.ChartData["B2", "B5"];
            chart.Series[1].XValues = chart.ChartData["A2", "A5"];
            chart.Series[1].YValues = chart.ChartData["C2", "C5"];
            chart.Series[2].XValues = chart.ChartData["A2", "A5"];
            chart.Series[2].YValues = chart.ChartData["D2", "D5"];
            chart.Series[3].XValues = chart.ChartData["A2", "A5"];
            chart.Series[3].YValues = chart.ChartData["E2", "E5"];

            chart.Series[0].Line.FillType = FillFormatType.None;
            chart.Series[0].MarkerStyle = ChartMarkerType.Star;
            chart.Series[1].Line.FillType = FillFormatType.None;
            chart.Series[1].MarkerStyle = ChartMarkerType.Square;
            chart.Series[2].Line.FillType = FillFormatType.None;
            chart.Series[2].MarkerStyle = ChartMarkerType.Triangle;
            chart.Series[3].Line.FillType = FillFormatType.None;
            chart.Series[3].MarkerStyle = ChartMarkerType.Dot;

            pres.SaveToFile(@"..\..\result.pptx", FileFormat.Pptx2007);

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Fri Aug 01, 2014 8:47 am

Hello,

Have you tested the code provided by my colleague Gary? Has the issue been resolved?
Could you please give us feedback if convenience?
If you have any questions, welcome to get it back to us.

Regards,
Benjamin
E-iceblue support team
User avatar

Benjamin Du
 
Posts: 82
Joined: Thu Jul 25, 2013 2:38 am

Tue Oct 14, 2014 8:02 am

andrewhoang09 wrote:I am trying to figure out how to create a ScatterPlot. I am using the Free Spire.Presentation Hotfix
This is what I have so far
Code: Select all
Presentation pres = new Presentation();
RectangleF rect1 = new RectangleF(0, 0, 700, 500);
IChart chart = pres.Slides[0].Shapes.AppendChart(Spire.Presentation.Charts.ChartType.ScatterMarkers, rect1, false);
chart.ChartTitle.TextProperties.Text = "X-Y Chart";
chart.ChartTitle.TextProperties.IsCentered = true;
chart.ChartTitle.Height = 30;
chart.HasTitle = true;

Double[] xdata = new Double[] { 7.7, 8.9, 1.0, 2.4 };
Double[] ydata = new Double[] { 15.2, 5.3, 6.7, 8 };

chart.ChartData[0, 0].Text = "X-Axis";
chart.ChartData[0, 1].Text = "Y-Axis";

for (Int32 i = 0; i < xdata.Length; ++i)
{
         chart.Series[0].XValues[i].Value = xdata[i];
         chart.Series[0].YValues[i].Value = ydata[i];
 }



Also when I set the boolean value to false I get an error and when i set the boolean value to true it plots the points but I also get default data.
I want to be able to plot the data that should look like this:
Code: Select all
X-Axis     Y-Axis
7.7          15.2
8.9           5.3
1.0           6.7
2.4           8

bhanuchandra
 
Posts: 1
Joined: Tue Oct 07, 2014 5:50 am

Tue Oct 14, 2014 9:06 am

Hello,

Thanks for your inquiry.
Please download the Spire.Presentation Pack Hotfix Version:2.1.7 and try the following codes.
Code: Select all
        Presentation pres = new Presentation();
        RectangleF rect1 = new RectangleF(0, 0, 700, 500);
        IChart chart = pres.Slides[0].Shapes.AppendChart(ChartType.ScatterMarkers, rect1, false);
        chart.ChartTitle.TextProperties.Text = "X-Y Chart";
        chart.ChartTitle.TextProperties.IsCentered = true;
        chart.ChartTitle.Height = 30;
        chart.HasTitle = true;
        Double[] xdata = new Double[] { 7.7, 8.9, 1.0, 2.4 };
        Double[] ydata = new Double[] { 15.2, 5.3, 6.7, 8 };
        chart.ChartData[0, 0].Text = "X-Axis";
        chart.ChartData[0, 1].Text = "Y-Axis";
        for (Int32 i = 0; i < xdata.Length; ++i)
        { chart.ChartData[i + 1, 0].Value = xdata[i]; chart.ChartData[i + 1, 1].Value = ydata[i]; }
        chart.Series.Clear();
        chart.Categories.Clear();
        chart.Categories.CategoryLabels = chart.ChartData["A2", "A5"];
        chart.Series.SeriesLabel = chart.ChartData["B1", "B1"];
        chart.Series[0].XValues = chart.ChartData["A2", "A5"];
        chart.Series[0].YValues = chart.ChartData["B2", "B5"];
        chart.Series[0].Line.FillType = FillFormatType.None;
        pres.SaveToFile("XYChart.pptx", FileFormat.Pptx2007);

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Fri Oct 17, 2014 8:52 am

Hello,

Has the issue been resolved? Could you please give us some feedback if convenience?

If there are any questions, welcome to get it back to us.

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.Presentation