Free Support Forum - aspose.com

Series Points coloring in ColumnStacked100 chart

Dear,


I am using ASPose.Slide version 6.5 to generate a .pptx presentation.
Is it possible to set the coloring of some particular “Series Points” in a ColumnStacked100 chart. If this is doable, can you please provide me with a code snippet for my request.

Kindly find attached 2 snapshots CurrentColoring.png and SeriesPointColoring.png.
CurrentColoring.png shows the coloring of the chart that I am actually having. Based on some business rules in my application i need to set the coloring of some particular Points as shown in SeriesPointColoring.png (green color) and not all the series.

Thank you so much,
Sami Simon

Hi Sami Simon,


I have created the sample code for you with which you will be able to change the chart series colors. Please share, if I may help you further in this regard.

public static void ChangeSeriesColor()
{
PresentationEx pres = new PresentationEx();
SlideEx slide = pres.Slides[0];
ChartEx chart = slide.Shapes.AddChart(ChartTypeEx.StackedColumn, 100, 100, 300, 300);
ChartSeriesExCollection seriesCollection=chart.ChartData.Series;
ChartSeriesEx series = seriesCollection[0];
series.Format.Fill.FillType = FillTypeEx.Solid;
series.Format.Fill.SolidFillColor.Color = Color.Green;
series = seriesCollection[1];
series.Format.Fill.FillType = FillTypeEx.Solid;
series.Format.Fill.SolidFillColor.Color = Color.Yellow;
series = seriesCollection[2];
series.Format.Fill.FillType = FillTypeEx.Solid;
series.Format.Fill.SolidFillColor.Color = Color.Cyan;
pres.Write("D:\\Aspose Data\\ChartExample.pptx");
}


Many Thanks,

Dear,


Thank you so much for your quick reply, but in fact this is not my request.
What i really want to do is to change the colors of “certain points” in the series and not all the series.
As you can see from my first screenshot, I was able to set the color of the the second series to “Purple”. But my question is: is it possible to change the color of some points in the series? As shown in second screenshot, I want to keep the series color “Purple” but only change the color of points “G2” and “G4” to green.

Thank you,
Sami Simon

Hi Sami Simon,


I have observed the requirements shared and regret to share that presently changing the color of individual series point is unenviable in Aspose.Slides. An issue with ID SLIDESNET-33630 has been created as new feature request so that our development team may further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

Dear,


Any news regarding the above request? Could you please give me an estimation on when this could be done since I need to schedule my project according to this fix.

Thank you so much for your understanding
Sami Simon

Hi Sami Simon,


I regret to share that the issue shared has not yet been resolved. However, I have requested our development team to schedule the issue for investigation and ETA on their end. I will be able to share the further updates with you as soon as it will be shared by our development team.

We are sorry for your inconvenience,

Hi Sami Simon,


I like to share that the issue shared has been resolved. Please use the following sample code to serve the purpose. Please share, if I may help you further in this regard.

public static void ChartWithSeriePointColor()
{
PresentationEx pres = new PresentationEx();
SlideEx slide = pres.Slides[0];

ChartEx chart = slide.Shapes.AddChart(ChartTypeEx.StackedColumn, 100, 100, 300, 300);

ChartSeriesExCollection seriesCollection = chart.ChartData.Series;

ChartSeriesEx series = seriesCollection[0];
series.Format.Fill.FillType = FillTypeEx.Solid;
series.Format.Fill.SolidFillColor.Color = Color.Green;


series = seriesCollection[1];
series.Format.Fill.FillType = FillTypeEx.Solid;
series.Format.Fill.SolidFillColor.Color = Color.Yellow;

series = seriesCollection[2];

ChartPointEx point = new ChartPointEx(series);
point.Index = 0;
point.Format.Fill.FillType = FillTypeEx.Solid;
point.Format.Fill.SolidFillColor.Color = Color.DeepSkyBlue;
series.Points.Add(point);

point = new ChartPointEx(series);
point.Index = 1;
point.Format.Fill.FillType = FillTypeEx.Solid;
point.Format.Fill.SolidFillColor.Color = Color.LightGreen;
series.Points.Add(point);

point = new ChartPointEx(series);
point.Index = 2;
point.Format.Fill.FillType = FillTypeEx.Solid;
point.Format.Fill.SolidFillColor.Color = Color.Orange;
series.Points.Add(point);

point = new ChartPointEx(series);
point.Index = 3;
point.Format.Fill.FillType = FillTypeEx.Solid;
point.Format.Fill.SolidFillColor.Color = Color.OrangeRed;
series.Points.Add(point);

series.Format.Fill.FillType = FillTypeEx.Solid;
series.Format.Fill.SolidFillColor.Color = Color.Cyan;

pres.Write(@“D:\Aspose Data\ChartExample.pptx”);
}

Many Thanks,

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.