We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How can i prepare a StackedColumn chart in a ppt

IChart chart = slide.Shapes.AddChart(ChartType.StackedColumn, 100, 100, 400, 400);
// Getting the chart data worksheet
IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;

// chart.ChartData.Series.Clear();
// chart.ChartData.Categories.Clear();
IChartSeries series = chart.ChartData.Series[0];

IDataLabel lbl = series.DataPoints[0].Label;
// dataPoint.Label.DataLabelFormat.ShowValue = true;
lbl.DataLabelFormat.ShowValue = true;
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.DataLabelFormat.ShowValue = true;
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;


Here the graph is automatically generated, but can you please help how to manually enter values to each series and categories according to the attachment

Hi,


I have observed your comments. Please visit this thread link for more details. Please share feedback with us if there is still an issue.

Best Regards,

How will i add n Number of series in graph

Presentation presentation = new Presentation(source + “MyPPTAspose.pptx”);
//ISlideCollection slidescollection = presentation.Slides;

//Accessing the first slide
ISlide slide = presentation.Slides[0];

IChart chart = slide.Shapes.AddChart(ChartType.StackedColumn, 100, 100, 400, 400);
// Getting the chart data worksheet
IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;

// chart.ChartData.Series.Clear();
// chart.ChartData.Categories.Clear();
IChartSeries series1 = chart.ChartData.Series[0];
IChartSeries series2= chart.ChartData.Series[1];
IChartSeries series3 = chart.ChartData.Series[2];
IChartSeries series4 = chart.ChartData.Series[3];

Using this if i add series4 it gives an error. How can i add 10 series as per my requirement?

Also,

It turns out to be staggered :
string source = Request.MapPath("\PPT\");
Presentation presentation = new Presentation(source + “MyPPTAspose.pptx”);
ISlide slide = presentation.Slides[0];
int defaultWorksheetIndex = 0;
IChart chart = slide.Shapes.AddChart(ChartType.StackedColumn, 0, 0, 400, 400);
chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();
// Getting the chart data worksheet
IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 1, “Series 1”), chart.Type);
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 2, “Series 2”), chart.Type);
// chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 3, “Series 3”), chart.Type);
// chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 4, “Series 4”), chart.Type);

// Add Catrgories
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 1, 0, “Category 1”));
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 2, 0, “Category 2”));
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 3, 0, “Category 3”));
IChartSeries series4 = chart.ChartData.Series[1];
IChartSeries series3 = chart.ChartData.Series[0];
// Now populating series data
series3.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 1, 1, 10));
series3.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 2, 1, 10));
series4.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 1, 2, 5));
series4.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 2, 2, 5));
// series4.ParentSeriesGroup.GapWidth = 50;
presentation.Save(source + “GapWidth_out.pptx”, SaveFormat.Pptx);

Hi ,

I have observed the code sample and requirements shared by you. I have observed that you have made similar inquiry in another forum thread as well. Please try using Aspose.Slides for .NET 16.12.0 on your end. If there is still an issue then please share the source presentation with us for further investigation on our end.

Many Thanks,

Hi,

I am already using 16.2 but still I am getting staggered chart
Please help

Regards

Hi,

Thank you for sharing the feedback. Can you please share the source and generated presentations so that I may investigate issue further on my end.

Many Thanks,