Welcome to the .NET MAUI feedback portal. We’re happy you’re here! If you have feedback on how to improve the .NET MAUI, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
Hi,
We are trying to have a MAUI app produce a PowerPoint presentation and it works great except for the Graph/Chart. We need the chart to show 5 categories with 2 bars in each category which seems simple enough given the docs but we have been struggling and believe it's possibly an issue with the library.
Our code is:
//Grab the Slide for the Graph
ISlide slide = pptxDoc.Slides[6];
//Add a chart to the slide giving the Position and Size
IPresentationChart chart = slide.Charts.AddChart(75, 175, 800, 300);
//Set the chart to be transparent so the slide details show through.
chart.PlotArea.Fill.BackColor = Syncfusion.Drawing.Color.Transparent;
chart.PlotArea.Fill.ForeColor = Syncfusion.Drawing.Color.Transparent;
chart.PrimaryValueAxis.MaximumValue = 140;
chart.PrimaryValueAxis.NumberFormat = "0";
chart.HasLegend = false;
chart.ChartData.SetValue(1, 1, "DATE");
// Row 1
chart.ChartData.SetValue(1, 2, "Date 1");
chart.ChartData.SetValue(1, 3, "Date 2");
// Row 2
chart.ChartData.SetValue(2, 1, "CF");
chart.ChartData.SetValue(2, 2, 10);
chart.ChartData.SetValue(2, 3, 20);
// ROW 3
chart.ChartData.SetValue(3, 1, "OO");
chart.ChartData.SetValue(3, 2, 30);
chart.ChartData.SetValue(3, 3, 40);
// Row 3
chart.ChartData.SetValue(4, 1, "IM");
chart.ChartData.SetValue(4, 2, 50);
chart.ChartData.SetValue(4, 3, 60);
// ROW 4
chart.ChartData.SetValue(5, 1, "E3");
chart.ChartData.SetValue(5, 2, 70);
chart.ChartData.SetValue(5, 3, 80);
IOfficeChartSerie seriesCF = chart.Series.Add("CF");
seriesCF.Values = chart.ChartData[2, 2, 2, 3];
seriesCF.DataPoints.DefaultDataPoint.DataLabels.IsValue = true;
seriesCF.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Inside;
seriesCF.DataPoints.DefaultDataPoint.DataLabels.Color = OfficeKnownColors.White;
seriesCF.SerieFormat.Fill.ForeColor = Syncfusion.Drawing.Color.Green;
IOfficeChartSerie seriesOO = chart.Series.Add("OO");
seriesOO.Values = chart.ChartData[3, 2, 3, 3];
seriesOO.DataPoints.DefaultDataPoint.DataLabels.IsValue = true;
seriesOO.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Inside;
seriesOO.DataPoints.DefaultDataPoint.DataLabels.Color = OfficeKnownColors.White;
seriesOO.SerieFormat.Fill.ForeColor = Syncfusion.Drawing.Color.Pink;
IOfficeChartSerie seriesIM = chart.Series.Add("IM");
seriesIM.Values = chart.ChartData[4, 2, 4, 3];
seriesIM.DataPoints.DefaultDataPoint.DataLabels.IsValue = true;
seriesIM.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Inside;
seriesIM.DataPoints.DefaultDataPoint.DataLabels.Color = OfficeKnownColors.White;
seriesIM.SerieFormat.Fill.ForeColor = Syncfusion.Drawing.Color.Purple;
IOfficeChartSerie seriesE3 = chart.Series.Add("E3");
seriesE3.Values = chart.ChartData[5, 2, 5, 3];
seriesE3.DataPoints.DefaultDataPoint.DataLabels.IsValue = true;
seriesE3.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Inside;
seriesE3.DataPoints.DefaultDataPoint.DataLabels.Color = OfficeKnownColors.White;
seriesE3.SerieFormat.Fill.ForeColor = Syncfusion.Drawing.Color.Orange;
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 5, 1];
The result this produces is: