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.

Fri Apr 29, 2016 12:37 am

Hello:

I need help for change presentation, i don't know change chart8.Series.SeriesLabel = chart8.ChartData["B1", "D1", "F1", "H1", "J1", "L1"];

mvillavicencio1970
 
Posts: 5
Joined: Thu Apr 28, 2016 11:34 pm

Fri Apr 29, 2016 3:35 am

Hi,

Thanks for your posting.
Sorry that at present there is no solution to set chartData likes chart8.ChartData["B1", "D1", "F1", "H1", "J1", "L1"], but I checked you attached pptx file and its SeriesLabel was using ChartData["B1", "D1", "F1", "H1", "J1", "L1"].
001.png


I have forwarded your requirement to our dev team. We will inform you when there is any update on it.

Best Regards,
Amy
E-iceblue support team
User avatar

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

Fri Apr 29, 2016 2:13 pm

Hi Amy:

The presentation is a template that must change with data from a datatable to change the graphic, I do the following:

SPresentation.Presentation p = new SPresentation.Presentation();

p.LoadFromFile(plantilla);

SPresentation.ISlide slide = (SPresentation.ISlide)p.Slides[0];
SChart.IChart chart8 = null;

foreach (SPresentation.IShape sp in slide.Shapes)
{
if (sp is SChart.IChart)
{
chart = (SChart.IChart)sp;

break;
}
}

int fila = 0;
int columna = 0;

chart.ChartData[fila, columna].Value = c_CMP_INV;

foreach (DataRow dr in dt.Rows)
{
chart.ChartData[fila, columna].Value = dr[1];
chart.ChartData[fila, columna + 1].Value = c_CMP_CPR;

columna += 2;
}

fila = 1;
columna = 1;

foreach (DataRow dr in dt.Rows)
{
chart.ChartData[fila, 0].NumberValue = Convert.ToDouble(dr[c_CMP_INVERSION]);
chart.ChartData[fila, columna].NumberValue = Convert.ToDouble(dr[c_CMP_GRPS]);
chart.ChartData[fila, columna + 1].NumberValue = Convert.ToDouble(dr[c_CMP_CPR]);

fila += 1;
columna += 2;
}

int contador2 = 0;

for (int i = 1; i < columna - 2; i++)
{
chart.Series[contador2].XValues.Add(chart8.ChartData[0, contador2, 0, contador2]);
chart.Series[contador2].YValues.Add(chart8.ChartData[1, i, fila - 1, i]);
chart.Series[contador2].Bubbles.Add(chart8.ChartData[1, i + 1, fila - 1, i + 1]);

i += 1;
contador2 += 1;
}

p.SaveToFile(archivo, SPresentation.FileFormat.Pptx2007);
System.Diagnostics.Process.Start(archivo);

But get an error opened the presentation.

Please help.

amy.zhao wrote:Hi,

Thanks for your posting.
Sorry that at present there is no solution to set chartData likes chart8.ChartData["B1", "D1", "F1", "H1", "J1", "L1"], but I checked you attached pptx file and its SeriesLabel was using ChartData["B1", "D1", "F1", "H1", "J1", "L1"].
001.png


I have forwarded your requirement to our dev team. We will inform you when there is any update on it.

Best Regards,
Amy
E-iceblue support team

mvillavicencio1970
 
Posts: 5
Joined: Thu Apr 28, 2016 11:34 pm

Mon May 02, 2016 6:00 am

Hello,

Thanks for your reference. Here is the tutorial to create Bubble chart for your reference.
http://www.e-iceblue.com/Tutorials/Spir ... B.NET.html
If the issue still can't be resolved, please attach the runnable code and the document for investigation further.

Thanks,
Gary
E-iceblue support team
User avatar

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

Tue May 03, 2016 2:50 am

Hi,

We have a solution to set chart8.Series.SeriesLabel = chart8.ChartData["B1", "D1", "F1", "H1", "J1", "L1"].
Please try the following code.
Code: Select all
CellRanges crs = chart8.ChartData["B1", "B1"];
crs.Add(chart8.ChartData["D1"]);
crs.Add(chart8.ChartData["F1"]);
crs.Add(chart8.ChartData["H1"]);
crs.Add(chart8.ChartData["J1"]);
crs.Add(chart8.ChartData["L1"]);
chart8.Series.SeriesLabel = crs;


Best Regards,
Amy
E-iceblue support team
User avatar

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

Tue May 03, 2016 10:34 pm

Dear:

I already made the cmabio but still suggested to open the powerpoint get error and does not show the graphic.

The code used is:

SPresentation.Presentation p = new SPresentation.Presentation();

p.LoadFromFile(plantilla);

SPresentation.ISlide slide = (SPresentation.ISlide)p.Slides[0];
SChart.IChart chart8 = null;

foreach (SPresentation.IShape sp in slide.Shapes)
{
if (sp is SChart.IChart)
{
chart = (SChart.IChart)sp;

break;
}
}

int fila = 0;
int columna = 0;

chart.ChartData[fila, columna].Value = c_CMP_INV;
columna += 1;

foreach (DataRow dr in dt.Rows)
{
chart.ChartData[fila, columna].Text = dr[1].ToString();
chart.ChartData[fila, columna + 1].Text = c_CMP_CPR;

columna += 2;
}

fila = 1;
columna = 1;

foreach (DataRow dr in dt.Rows)
{
chart.ChartData[fila, 0].Value = Convert.ToDouble(dr[c_CMP_INVERSION]).ToString("#,##0");
chart.ChartData[fila, columna].Value = Convert.ToDouble(dr[c_CMP_GRPS]).ToString("#,##0");
chart.ChartData[fila, columna + 1].Value = Convert.ToDouble(dr[c_CMP_CPR]).ToString("#,##0");

fila += 1;
columna += 2;
}

if (dt.Rows.Count < chart8.Series.Count)
{
chart8.ChartData.Clear(dt.Rows.Count, 0, chart8.Series.Count - 1, (dt.Rows.Count * 2));

for (int i = 0; i < dt.Rows.Count; ++i)
{
for (int j = chart8.Series.Count; j > dt.Rows.Count; --j)
{
chart8.Series[i].XValues.RemoveAt(j - 1);
chart8.Series[i].YValues.RemoveAt(j - 1);
chart8.Series[i].Bubbles.RemoveAt(j - 1);
}
}

for (int i = chart8.Series.Count; i > dt.Rows.Count; --i)
chart8.Series.RemoveAt(i - 1);
}

SPresentation.Collections.CellRanges crs = chart8.ChartData[0, 1, 0, 1];

for (int i = 3; i < columna; ++i)
{
crs.Add(chart8.ChartData[0, i]);

i += 1;
}

chart8.Series.SeriesLabel = crs;

int contador2 = 0;

for (int i = 1; i < columna - 2; i++)
{
chart.Series[contador2].XValues = chart8.ChartData[1, 0, fila -1, 0];
chart.Series[contador2].YValues = chart8.ChartData[1, i, fila - 1, i];
chart.Series[contador2].Bubbles = chart8.ChartData[1, i + 1, fila - 1, i + 1];

i += 1;
contador2 += 1;
}

p.SaveToFile(archivo, SPresentation.FileFormat.Pptx2007);
System.Diagnostics.Process.Start(archivo);

mvillavicencio1970
 
Posts: 5
Joined: Thu Apr 28, 2016 11:34 pm

Wed May 04, 2016 3:45 am

Hello,

Thanks for your response. Could you please provide a runable application(console application) can replicate the issue? It would be better to look into the issue.

Thanks,
Gary
E-iceblue support team
User avatar

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

Wed May 04, 2016 11:51 pm

Dear:

Sample application delivery as we are using the tool
1. - In sheet 1 does not retain colors or show DataPoints values.
2. - In the blade 2 appears an error and does not show
3. - In the sheet 3 an error and does not show

mvillavicencio1970
 
Posts: 5
Joined: Thu Apr 28, 2016 11:34 pm

Thu May 05, 2016 9:53 am

Hello,

Thanks for your information.
We are still investigating. We will give you reply tomorrow.
Thank you for understanding.

Sincerely,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Fri May 06, 2016 8:33 am

Hi,

I tried to do some tests but cannot reproduce your issue that does not show the graphic in output as we don't have your template file and used data. Please send us your project to help us replicate it on our side, so that we can work out solution for you soon. I have some doubts about your reply below.
1. - In sheet 1 does not retain colors or show DataPoints values.
2. - In the blade 2 appears an error and does not show
3. - In the sheet 3 an error and does not show

Would you please tell us the issues occur when you did what operation?

Thank you for your assistance.
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Tue May 10, 2016 6:43 am

Hello,

How is your issue now?
Could you please give us some feedback?

Thank you.
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Tue May 10, 2016 2:07 pm


mvillavicencio1970
 
Posts: 5
Joined: Thu Apr 28, 2016 11:34 pm

Wed May 11, 2016 6:46 am

Hi,

Thanks for your further assistance.
Regarding the code operating the charts in slide 1 and slide 2, I did some little modifications for it, attached is new code, please check it.
For the issue on the chart in slide 3, I have forwarded it to our dev team. We will inform you when there is any update.

Best Regards,
Amy
E-iceblue support team
User avatar

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

Thu May 12, 2016 4:03 am

Hi,

We have found the error in the code about chart in Slide 3. There are two places need to modify.
1. please change the lines,
Code: Select all
chart.ChartData[fila, 0].Value = Convert.ToDouble(dr[c_CMP_COLUMNA2]).ToString("#,##0");
chart.ChartData[fila, columna].Value = Convert.ToDouble(dr[c_CMP_COLUMNA3]).ToString("#,##0.0");
chart.ChartData[fila, columna + 1].Value = Convert.ToDouble(dr[c_CMP_COLUMNA4]).ToString("#,##0.0");

to
Code: Select all
chart.ChartData[fila, 0].Value = Convert.ToDouble(dr[c_CMP_COLUMNA2]);
chart.ChartData[fila, columna].Value = Convert.ToDouble(dr[c_CMP_COLUMNA3]);
chart.ChartData[fila, columna + 1].Value = Convert.ToDouble(dr[c_CMP_COLUMNA4]);

2. please change the line,
Code: Select all
chart.ChartData.Clear(dt.Rows.Count, 0, chart.Series.Count - 1, (dt.Rows.Count * 2));

to
Code: Select all
chart.ChartData.Clear(dt.Rows.Count + 1, 0, chart.Series.Count + 1, (chart.Series.Count * 2));


Best Regards,
Amy
E-iceblue support team
User avatar

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

Fri May 13, 2016 7:19 am

Hi,

Have your issues been resolved?
Thanks for your feedback in advance.

Best Regards,
Amy
E-iceblue support team
User avatar

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

Return to Spire.Presentation