Use of PPTX template

Hi,

Please find attached PPT. i want to produce required output and i am getting output shown in PPT(Generated from ASPOSE).

I have to add empty category to achieve this but not able to add empty category in code as we need to add series data for the same.

i have tried with setting series color to white so that it should not be visible but it;s replacing all chart color to white.

please let me know the other way around.

Thnak,
Prasad

Hi Prasad,

We are investigating the problem reported by you and we will get back to you with our findings soon. We appreciate your patience in this regard.

Best Regards,

Hi Prasad,

I have observed the requirement of separate data label color and have created the following sample code using Aspose.Slides for .NET 15.6.0. The generated presentation has separate colors for data labels. For your kind reference, I have attached the generated presentation as well. I hope this information will be helpful. Please share, if I may help you further in this regard.

public static void testChartLabels()
{
    Presentation pres = new Presentation();
    ISlide slide = pres.Slides[0];

    IChart chart = slide.Shapes.AddChart(ChartType.StackedColumn, 100, 100, 400, 400);
    IChartSeries series = chart.ChartData.Series[0];

    IDataLabel lbl = series.DataPoints[0].Label;
    lbl.TextFrameForOverriding.Text ="Red";
    lbl.TextFrameForOverriding.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillType.Solid;
    lbl.TextFrameForOverriding.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Red;

    lbl = series.DataPoints[1].Label;
    lbl.TextFrameForOverriding.Text = "Blue";
    lbl.TextFrameForOverriding.Paragraphs[0].Portions[0].PortionFormat.FillFormat.FillType = FillType.Solid;
    lbl.TextFrameForOverriding.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;

    pres.Save(@"D:\Aspose Data\testChart.pptx", SaveFormat.Pptx);
}

Many Thanks,

Hi Mudassir,

I guess you didn’t get my question. i want to add space after every two bars (Highlighted with blue box.)

Thanks,
Prasad

Hi Mudassir,

I found workaround by setting percentage =0 for all series for the bar chart where i wanted to add blank bar chart.

Thanks,
Prasad

Hi Prasad,

It good to know that workaround approach has proved helpful on your end. Please share with us if any further help is needed in this regard.

Many Thanks,

Hi Mudassir,

I have searched on forum as well as discussions about Doughnut chart but not able to add data points in series.
Could you please share sample code for creating simple Doughnut chart using aspose slides 14.10.0.0 in .net.

Thanks,
Prasad

Hi Prasad,

Thank you for posting.

I have observed your comments and like to share with you that the method AddDataPointForDoughnutSeries() is not supported in Aspose.Slides for .NET 14.10.0. This method was added to Aspose.Slides for .NET 15.2.0 so I request you to please try using Aspose.Slides for .NET 15.11.0 on your end to serve the purpose. Below is the sample code as per your requirements.

//Instantiate Presentation class that represents PPTX file
Presentation pres = new Presentation();

//Access first slide
ISlide sld = pres.Slides[0];

// Add chart with default data
IChart chart = sld.Shapes.AddChart(ChartType.Doughnut, 0, 0, 500, 500);
IChartSeries series = chart.ChartData.Series[0];
Aspose.Slides.Charts.IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;
series.DataPoints.AddDataPointForDoughnutSeries(fact.GetCell(0, 1, 1, 5.3));

//Save presentation with chart
pres.Save(@"D:/test.pptx", Aspose.Slides.Export.SaveFormat.Pptx);

I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,

Hi Adnan,

Thanks for the quick reply,

I have updated Aspose Slides DLL version to 15.2.0, Please share the link where i can get Aspose Slides DLL version to 15.11.0 for .NET.

I have generated sample from your code snippet but not able to identify how the values are populating because you have passes only one value in doughnut.

Please analyze attached PPT sample and right click on chart and click on Edit data. and please help on how we can access multiple Data points and set custom values.

Thanks in advance,

Regards,
Prasad

Hi,

I am not able to attache any PPT/PPTX and Zip file, please let me know email id so that i can send sample PPT

Thanks,
Prasad

data in excel will look like below which contains 6 row and two column.

TestChart
A 91
B 127
C 50
D 75
E 80

Thanks,
Prasad

Hi Prasad,

I would like to share with you that you may download Aspose.Slides for .NET 15.11.0 from this link. You may share with us the files using any free FTP service like Google Drive, One Drive, Dropbox etc. The values of chart are being populated as there is a comment, “Add chart with default data”. When you add a chart it contains default data and I shared with you how you can replace that data with custom value. You may want to clear that data at once by using the below code on your end.

chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();

and then the custom data as per your requirements as in the code below:

IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;
chart.ChartData.Series.Add(fact.GetCell(0, 0, 1, "TestChart"), ChartType.Doughnut);

//Adding new categories
chart.ChartData.Categories.Add(fact.GetCell(0, 1, 0, "A"));
chart.ChartData.Categories.Add(fact.GetCell(0, 2, 0, "B"));
chart.ChartData.Categories.Add(fact.GetCell(0, 3, 0, "C"));
chart.ChartData.Categories.Add(fact.GetCell(0, 4, 0, "D"));
chart.ChartData.Categories.Add(fact.GetCell(0, 5, 0, "E"));

IChartSeries series = chart.ChartData.Series[0];
series.DataPoints.AddDataPointForDoughnutSeries(fact.GetCell(0, 1, 1, 91));
series.DataPoints.AddDataPointForDoughnutSeries(fact.GetCell(0, 2, 1, 127));
series.DataPoints.AddDataPointForDoughnutSeries(fact.GetCell(0, 3, 1, 50));
series.DataPoints.AddDataPointForDoughnutSeries(fact.GetCell(0, 4, 1, 75));
series.DataPoints.AddDataPointForDoughnutSeries(fact.GetCell(0, 5, 1, 80));

I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,

Hi Adnan,

Thanks for reply, it’s helpful information as i can generate ppt as per my requirement and with custom values.

still i have one concern regarding, when i am adding Doughnut chat its generating Pie chart.
Could you please help on this.

Thanks,
Prasad

Hi Prasad,

I have observed your comments and like to share with you that the generated chart must not be a pie chart. It must be a Doughnut chart which maybe verified by using following line of code.

Console.WriteLine(chart.Type.ToString());

The generated chart appears as a pie chart because you need to set the DoughnutHoleSize property as in the code below and in this documentation article.

chart.ChartData.SeriesGroups[0].DoughnutHoleSize = 60;

Also, I would like to add here, we really appreciate if you make separate post for separate issues. Please try above code on your side and then share your kind feedback with us.

Best Regards,

Hi Adnan,

Thanks for the reply and solution which you have given, yes that property “DoughnutHoleSize” worked fine for me.

Actually i am keeping all queries in one thread to locate at one URL, I will create a separate thread for the different issues.

Regards,
Prasad

Hi Prasad,

Thank you for your valuable feedback.

We are glad to know that your issue is resolved and things have started working on your end. I have requested you for separate post for separate issues because that is easy for us to keep track of information related to any issue. In single thread, information gets mixed. Thank you for understanding. However, you can access all of the posts made by you, over this link, for future reference.

Feel free to contact us if we could be of any help to you.

Best Regards,