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

Free Support Forum - aspose.com

About the chart series color - slides6.7.1

i have a problem about the series's color, the slides is version 6.7.1
the result have 2.One is not clear default data,the other is clear default data.Why the color not correct???

PresentationEx pres = new PresentationEx();
SlideEx sld = pres.getSlides().get_Item(0);
ChartEx chart = sld.getShapes().addChart(ChartTypeEx.ClusteredColumn, 50, 120, 430, 360);
int defaultWorksheetIndex = 0;
ChartDataCellFactory fact = chart.getChartData().getChartDataCellFactory();
int categoriesCount = 6;
for(int i=1; i<=categoriesCount; i++){
int index = chart.getChartData().getCategories().add(fact.getCell(defaultWorksheetIndex, i, 0, "Q." + i));
int serierCount = 5;
for(int i=1; i<=serierCount; i++){
int index = chart.getChartData().getSeries().add(fact.getCell(defaultWorksheetIndex, 0, i, "answer" + i), chart.getType());
ChartSeriesEx series = chart.getChartData().getSeries().getChartSeries(index);
for(int j=1; j<=categoriesCount; j++){
series.getValues().add(fact.getCell(defaultWorksheetIndex, j, i, (int)(Math.random()*1000)));

Hi Yang,

I have observed the sample code share by you and have observed that you are clearing series and categories. When you do so the default series and their configurations are lost. When you create new series, you need to set the format as per your convenience. Please use the following sample code in for loop where by you are adding series and things will work for you.


else if(i==2)
else if(i==3)
else if(i==4)
else if(i==5)
else if(i==0)

Many Thanks,


thank you for your help,but the problem not solve.

the serierCount is Dynamic, maybe is 5, maybe is 20.

i hope the color is auto , just like the excel’s chart

Hi Yang,

I have investigated your requirement and regret to share that the feature for auto setting of series fill color is unavailable. An issue with ID SLIDESJAVA-33670 has been created as new feature request to provide the feature. For the time being, I suggest you to please set the series fill colors independently. You can also surf over the internet for random selection of color and applying it on series. This way you can select a random color on every for loop iteration inside your code and set that for series. The following three links may help you in this regard.

  • http://stackoverflow.com/questions/4246351/creating-random-colour-in-java
  • http://oucsace.cs.ohiou.edu/~waustad/web/applets/RandomColorCode.html
  • http://www.roseindia.net/answers/viewqa/Java-Beginners/15890-random-color-fill-.html

We are sorry for your inconvenience,

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

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