Free Support Forum - aspose.com

Colors of series in a line graph

How can I set the colors of the series in a line graph? Which property of the Chart.NSeries object do I need to set?

If I don't set any colors, does it generate the colors automatically/randomly?

Please try:

chart.NSeries[0].Line.IsVisible = true;
chart.NSeries[0].Line.Color = Color.Blue;

That worked. But what I need to change the colors in a loop using the ChangePalette method? That does not seem to work. Here is my code:

//Set color for each series

for (int i = 0; i < chart.NSeries.Count; i++)

{

//Set different values for seriesColorR, seriesColorG and seriesColorB here in every iteration of the loop

chart.NSeriesIdea [I].Line.IsVisible = true;
excel.ChangePalette(Color.FromArgb(seriesColorR,seriesColorG,seriesColorB),53);
chart.NSeriesIdea [I].Line.Color = Color.FromArgb(seriesColorR,seriesColorG,seriesColorB);

}

What happens if:

//Set color for each series

for (int i = 0; i < chart.NSeries.Count; i++)

{

//Set different values for seriesColorR, seriesColorG and seriesColorB here in every iteration of the loop

chart.NSeriesIdea [I].Line.IsVisible = true;
excel.ChangePalette(Color.FromArgb(seriesColorR,seriesColorG,seriesColorB),53 - i);
chart.NSeriesIdea [I].Line.Color = Color.FromArgb(seriesColorR,seriesColorG,seriesColorB);

}

This worked. Thanks. But what is the reason for having to do 53-i ? Also, what does the index parameter (0-55) of ChangePalette do ?

Please lauch MS Excel, "Tools"->"Option"->"Colors", you can see the palette in an Excel file.

There are only 56 different colors in an Excel file. If you want to use color other than the colors in palette, you have to change the palette first.

Thanks.

In the same loop of code that I sent you before, I am also trying to smooth the line by using:

chart.NSeriesIdea [I].smooth = true;

But it does not seem to be working. The lines still appear jagged.

Please try this attached fix.

When will this fix be integrated into a release version? We are currently working with an Evaluation version, and we plan to purchase a few Professional Developer licenses for our company and also for our client by next week.

We will release a public fix within this week.

Is the fix for smoothing of series lines available now? Our company is planning to order a few Developer Enterprise licenses by Monday March 6th.

Thanks for purchasing Aspose.Cells. This fix is available. Please download and try v3.7.1.