Get Fill Color of Series when Fill Type is Automatic

As mentioned in release notes of Aspose.Slides for .Net v15.2.0 under Minor Changes section: SLIDESNET-34872 - To get Fill Color of Series when Fill Type is Automatic. I’ve similar requirements which are supposed to be meet by ticket 34872. However, when I try to get fill color value it always returns Black.









Here is the code-line which I tried:






DirectCast(presentationObj.Slides(2).Shapes(0),Aspose.Slides.Charts.Chart).ChartData.Series(0).DataPoints(0).Format.Fill.SolidFillColor









Please find the attached file for analysis/investigation, and help me with a correct code if I’m doing something wrong here. Thanks.

Hi Azaz,

I have worked over your requirement and suggest you to please try using the following sample code on your end to get automatic series fill color of the chart.

Presentation pres = new Presentation("D:\\aspose forums\\SampleChart.pptx");
//Access required slide
ISlide sld = pres.getSlides().get_Item(1);
IChart chart = (IChart)sld.getShapes().get_Item(0);
for (int i = 0; i < chart.getChartData().getSeries().size(); i++)
{
    chart.getChartData().getSeries().get_Item(i).getAutomaticSeriesColor();
    java.awt.Color color = chart.getChartData().getSeries().get_Item(i).getAutomaticSeriesColor();
    System.out.println(color.toString());
}

I also recommend you to visit this documentation link for your reference. I hope this will be helpful. Please share, if I may help you further in this regard.

Best Regards,
Adnan Ahmad

Thanks Adnan,

Your code worked but GetAutomaticSeriesColor method returns only single Color object. I was expecting it to return all colors against each DataPoint in a single Series object, however it returned only one color value referring to color value of first DataPoint.

Is it possible to get color value of each DataPoint when Color Fill is set to Automatic and Vary Colors by Points is checked, in Series Options?

On documentation link(given by Adnan above), there are code snippets to set DataPoints’ FillType and SolidFillColor etc. I hope if we set those values using Aspose code, we will be able to get them later using Get properties. But when those values(FillType/SolidFillColor) are already set by PowerPoint, the Aspose library returns incorrect values i.e FillType=NotDefined and SolidFillColor=Black, for all DataPoints. It should return Solid as FillType and SomeColorValue as SolidFillColor, as these were the actual values I set while creating PPTX using PowerPoint.

Hi Azaz,

Yes, GetAutomaticSeriesColor method returns only one color object that is for entire series as GetAutomaticSeriesColor is applied on series level but not on DataPoints in series level. And also to address your query about FillType is NotDefined. I refer you to the chm file of Aspose.Slides for .net 15.2.0 (see the photo attached) which says:

GetAutomaticSeriesColor method returns an automatic color of series based on series index and chart style. This color is used by default and if FillType equals NotDefined.

This will hopefully clarify your query.

When you set automatic color, you are applying color according to the slide theme. If you want to set the color for DataPoint in series, you have to first set that either in PowerPoint or using Aspose.Slides. Then you will be able to access the chart series DataPoint color. Otherwise, the DataPoint follows the same color that is set on series level.

It is not possible to get color value of each DataPoint when Color Fill is set to Automatic, for series . I have verified this by PowerPoint, however If you are able to do this then share with me so that I can investigate it further to help you.

Kind Regards,

Adnan Ahmad

Hi Azaz,

I like to share that the setting automatic fill color for chart series is a new feature that has been introduced in Aspose.Slides for Java 15.2.0. Adnan has already passed you the documentation link in this regard.

I like to clarify that when you set the automatic fill color for any chart series, that is actually applied on series level. So, when you get the automatic color you will get single color instead of colors for all data points inside the series. There is single automatic color for the entire chart series and I have even verified this in PowerPoint as well. So, when there will be automatic fill color applied, you will get Undefined in series fill type as series has inherited color from presentation theme color scheme. You can access the individual data point color for chart series only if you have set that using Aspose.Slides or in PowerPoint itself. The clarification shared by Adnan is absolutely correct. Please share, if I may help you further in this regard.

Many Thanks,

Thanks guys for your quick reply.


GetAutomaticSeriesColor method’s behavior is quite clear now. Though I’m not aware of chm(maybe misspelled) file of Aspose.Slides, can you please share its link so I can refer to it in future. Also, the attached photo is inaccessible.

Regarding color value of each DataPoint, I agree the colors are applied according to slide theme, but colors are set indirectly(if not explicitly) nevertheless, and one can visualize that each DataPoint has a different color.


So my requirement is to get those color values which PowerPoint automatically set and they can be visualized. Currently it seems Aspose library is unable to get those color values, and its possible reason could be that those colors values are not stored in PPTX file’s OpenXML. But PowerPoint loads those colors values maybe using Accent colors.


Please let me know if this requirement is going to be meet in near future?
Thanks again.

Hi Azaz,

I have observed the comments shared by you. Let me reiterate the working of Aspose.Slides in terms of dealing with fill colors set for chart series by giving use cases.

When the color is set for chart series by defining the FillFormat for series to Solid and setting the desired color, the data points belonging to the series follow the color of series. When you will access the data point and check its FillType it will return NotDefined. When you get NotDefined for any chart series data point, it means that the data point is inheriting the fill color of its respective series and you need to get the fill color from the series. However, if the particular color has been set for desired series data point, it will return your FillType as Solid in this case. You can then access the SolidFill color inside Format property of that data point. I hope this will clarify the concept now. This is not an issue and the implementation is done in this way.

Now, if the series has automatic fill color set for it then you will get NotDefined in FillType of that particular series. The NotDefined for series FillType will infer that there is no explicit fill color defined for this series but the automatic fill color that is taken for presentation theme has been applied on it. You can get that color for the series from getAutomaticSeriesColor() method in this case. Obviously, when series FillType is NotDefined in this case then its respective data points will also have FillType as NotDefined. This is all logical behavior and is working as designed. I hope this will clarify the concept to you.

Now coming to chm file. When you download and install MSI installer for Aspose.Slides for .NET, you will find Aspose.Slides.chm inside the installed folder which contain the offline API docs for Aspose.Slides for .NET. The same API docs are valid for Java as well as all class names are common except for properties in .NET that are replaced by get and set methods in Java. The Aspose.Slides.chm is a quick understanding guide.

Many Thanks,


Ok, let me ask a specific question to conclude this discussion.


On Slide 3 of PPTX file which I initially attached, there is a chart with one Series and 10 DataPoints(Categories). Presentation theme colors are applied on that chart and each DataPoint have obviously a different color. I would like to get color value of each DataPoint.


From your comments(explaining the logical behavior of library), it apparently seems that it’s not possible to get color values of those 10 DataPoints by any mean, unless one apply some solid colors to those DataPoints. Please confirm, there is no way to get colors values of DataPoints when set through presentation theme?

Hi Azaz,

I have observed the chart shared and have found that you are using varying color for chart series data point. The varying color support is presently unavailable in Aspose.Slides for .NET and an issue with ID SLIDESNET-35575 has already been created in our issue tracking system to provide the support. Once the requested support will be available the requirements shared by you will then get addressed. I have linked this thread with the issue so that you may be automatically notified once the issue will be resolved.

Many Thanks,

Thanks Mudassir, for your time and support. I will be looking forward to new release of Aspose library.

The issues you have found earlier (filed as SLIDESNET-35575) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The new updates from v15.7 resolves the original issue. Thanks.



However, I’m wondering if it is possible to get color values even when there is no chart object in slide, against current PowerPoint theme?



I know it is possible to get MasterTheme’s ColorScheme which includes Accent colors etc; and those basic colors are used to generate new colors for chart’s DataPoints.



Now the question is, is it possible to get/generate those colors values in absence of any chart object?



Just to rephrase the same (new) requirement with different angle, let say there are 8 DataPoints in a chart object. Now is it also possible to get the color value that would be set for the 9th DataPoint even though it doesn’t exist yet?



Please let me know if in case the question/requirement is not clear. Thanks.



Apologize for not creating a new thread for this new question/requirement since it’s closely related to this thread.

Hi Azaz,


I have observed your requirements and like to share that there is no option to get the color for a chart series data point that has not yet been created. As you said in your comment you can get the scheme color for Main theme but not from the chart data point that has not yet been created. Please share if I may help you further in this regard.

Many Thanks,

Thanks Mudassir for quick response.



I’d like to ask, could it be possible in future updates from Aspose.Slides library?



The requirement would be… to get/generate X automatic color values of chart’s DataPoints based on current Theme, even in absence of chart object; where X would be a limited number.

Hi Azaz ul Haq,

I have observed your requirements and have discussed the possibility of implementation with our product team. Our product team will share feedback in this regard after investigation and we will share the information with you afterwards. I will really appreciate your patience in this regard.

Many Thanks,

Hi Azaz Ul Haq,

I have created an issue with ID SLIDESNET-36864 as new feature request in our issue tracking system to further investigate the possibility of implementing the requested support. This thread has been linked with the issue so that you may be automatically notified once the feature will be available.

Many Thanks,

Thanks Mudassir, for creating a new issue against our new requirements.



We are also trying some work-around e.g. adding a temporary chart object to a slide with desired number of datapionts in it and then get the chart colors values we are looking for. Hope it would work for us, for now.

Hi Azaz ul Haq,

I will share the good news with you as soon as the issue will be fixed and will really appreciate your patience in this regard.

Many Thanks,

Hi Azaz,

I have discussed the possibility of implementing the support for following requirement with our product team.

azaz.haq:
The requirement would be… to get/generate X automatic color values of chart’s DataPoints based on current Theme, even in absence of chart object; where X would be a limited number.


Is it important “to get color values even when there is no chart object in slide”? We have implemented new feature

IChartDataPoint.GetAutomaticDataPointColor(). Can you please explore this feature and share if it is suitable for your needs? Please share your feedback about it.

Many Thanks,