Hi Scott,
I suggest you to please try using following sample code on your end using Aspose.Slides for .NET 17.5. Actually, when you apply chart color scheme then you don’t really need to set the color for chart series. When you do so, it will overwrite the automatic chart color scheme.
public static void ChartWithTheme()
{
using (Presentation pres = new Presentation())
{
pres.Slides.AddClone(pres.Slides[0]);
ISlide slide = pres.Slides[0];
pres.Slides.AddClone(pres.Slides[0]);
IChart chart = slide.Shapes.AddChart(ChartType.ClusteredColumn, 80, 100, 600, 300);
slide = pres.Slides[1];
chart = slide.Shapes.AddChart(ChartType.ClusteredBar, 80, 100, 600, 300);
chart.Style = StyleType.Style6;
///
slide = pres.Slides[2];
chart = slide.Shapes.AddChart(ChartType.ClusteredBar, 80, 100, 600, 300);
chart.Style = StyleType.Style6;
chart.ChartTitle.AddTextFrameForOverriding(“Sample Title”);
chart.ChartTitle.TextFrameForOverriding.TextFrameFormat.CenterText = NullableBool.True;
chart.ChartTitle.Height = 20;
chart.HasTitle = true;
// Set first series to Show Values
chart.ChartData.Series[0].Labels.DefaultDataLabelFormat.ShowValue = true;
// Setting the index of chart data sheet
int defaultWorksheetIndex = 0;
// Getting the chart data worksheet
IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;
// Delete default generated series and categories
chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();
int s = chart.ChartData.Series.Count;
s = chart.ChartData.Categories.Count;
chart.Style = StyleType.Style12;
// chart.Style = StyleType.Style6;
// Adding new series
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);
// Adding new categories
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”));
// Take first chart series
IChartSeries series = chart.ChartData.Series[0];
// Now populating series data
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 1, 1, 20));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 2, 1, 50));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 3, 1, 30));
// Setting fill color for series
// series.Format.Fill.FillType = FillType.Solid;
// series.Format.Fill.SolidFillColor.Color = Color.Red;
// Take second chart series
series = chart.ChartData.Series[1];
// Now populating series data
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 1, 2, 30));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 2, 2, 10));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 3, 2, 60));
// Setting fill color for series
// series.Format.Fill.FillType = FillType.Solid;
// series.Format.Fill.SolidFillColor.Color = Color.Green;
// First label will be show Category name
IDataLabel lbl = series.DataPoints[0].Label;
lbl.DataLabelFormat.ShowCategoryName = true;
lbl = series.DataPoints[1].Label;
lbl.DataLabelFormat.ShowSeriesName = true;
// Show value for third label
lbl = series.DataPoints[2].Label;
lbl.DataLabelFormat.ShowValue = true;
lbl.DataLabelFormat.ShowSeriesName = true;
lbl.DataLabelFormat.Separator = “/”;
chart.Style = StyleType.Style6;
pres.Save(“C:\Aspose Data\ThemeChart.pptx”, SaveFormat.Pptx);
}
}
Many Thanks,