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.

Tue Aug 09, 2022 9:45 am

According to the following document I can assign different colors for the same series of data markers.

https://www.e-iceblue.com/Knowledgebase ... B.NET.html

Is there any way to change the whole series data markers color?
Thanks

omur.ertanis
 
Posts: 22
Joined: Mon Feb 21, 2022 6:49 am

Tue Aug 09, 2022 1:50 pm

Do you think this is the correct way to implement it?

Code: Select all
for (int serieIndex = 0; serieIndex < chart.Series.Count; serieIndex++)
{
   for (int categoryIndex = 0; categoryIndex < chart.Categories.Count; categoryIndex++)
   {
      ChartDataPoint dataPoint = new ChartDataPoint(chart.Series[serieIndex]);
      dataPoint.Index = categoryIndex;

      dataPoint.MarkerFill.Fill.FillType = FillFormatType.Solid;
      dataPoint.MarkerFill.Fill.SolidColor.Color = Color.Red;;

      dataPoint.MarkerFill.Line.FillType = FillFormatType.Solid;
      dataPoint.MarkerFill.Line.SolidFillColor.Color = Color.Red;;

      chart.Series[serieIndex].DataPoints.Add(dataPoint);
   }
}

omur.ertanis
 
Posts: 22
Joined: Mon Feb 21, 2022 6:49 am

Wed Aug 10, 2022 7:36 am

Hello Omur Ertanis,

Thanks for your inquiry.
Please refer to the below sample code to directly change the whole series data markers color. If there is any issue when you test your file, please share us with your PPT file for further investigation. You can attach it here or send it to us via email(support@e-iceblue.com).

Code: Select all
 //Create a PowerPoint document.
 Presentation presentation = new Presentation();
 //Load the file from disk.
 presentation.LoadFromFile("input.pptx");
 //Get the chart from the presentation.
 IChart chart = presentation.Slides[0].Shapes[0] as IChart;
 //Set the fill color of the data marker.
 chart.Series[0].MarkerFill.Fill.FillType = FillFormatType.Solid;
 chart.Series[0].MarkerFill.Fill.SolidColor.Color = Color.Red;
 chart.Series[0].MarkerFill.Line.FillType = FillFormatType.Solid;
 chart.Series[0].MarkerFill.Line.SolidFillColor.Color = Color.Red;
 //Save to file.
 presentation.SaveToFile("output.pptx", Spire.Presentation.FileFormat.Pptx2013);


Sincerely,
Simple
E-iceblue support team
User avatar

Simple.Li
 
Posts: 248
Joined: Fri Jul 01, 2022 2:33 am

Return to Spire.Presentation