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

Free Support Forum - aspose.com

Chart axis fill color does't apply

Hi,

I am using the latest Aspose.Cells 8.1.0.2 build, and try to change the chart value axis fill by using the following code, but it doesn’t work, could you please take a look?

chart.ValueAxis.Area.FillFormat.Type = Aspose.Cells.Drawing.FillType.Solid
chart.ValueAxis.Area.FillFormat.SolidFill.Color = Color.Red

Thanks,
Wei

Hi Wei,

Thanks for your posting and using Aspose.Cells.

Please download and use the latest version: Aspose.Cells for .NET 8.1.1 and it works fine.

We have tested it with the following code and it generated correct output. I have attached the source xlsx file used in this code and output file generated by it for your reference.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\source.xlsx”;


Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.Worksheets[0];


Chart chart = worksheet.Charts[0];


chart.ValueAxis.Area.FillFormat.Type = FillType.Solid;

chart.ValueAxis.Area.FillFormat.SolidFill.Color = Color.Green;


workbook.Save(“output.xlsx”);

Hi,


Also,
1) If you need to apply the fill format to data points of a series, you may try:
e.g
Sample code:

chart.NSeries[0].Points[index].Area.FillFormat.Type = Aspose.Cells.Drawing.FillType.Solid;
chart.NSeries[0].Points[index].Area.FillFormat.SolidFill.Color = Color.Red;

2) If you need to change the entire series color’s fill format, you may try:
e.g
Sample code:

Series series = chart.NSeries[0];
series.Area.FillFormat.Type = Aspose.Cells.Drawing.FillType.Solid;
series.Area.FillFormat.SolidFill.Color = Color.Red;

3) If you need to change the series markers’ fill format, you may try:
e.g
Sample code:

Series series = chart.NSeries[0];
series.Marker.Area.FillFormat.Type = Aspose.Cells.Drawing.FillType.Solid;
series.Marker.Area.FillFormat.SolidFill.Color = Color.Red;



If you still could not evaluate, kindly post your sample Excel file containing the chart with your desired formatting/ fill format for the data series, markers, title etc., we will let you know how to do it via Aspose.Cells APIs.


Thank you.


Thanks for the update.

I can see the value axis fill works in the excel, but I need to convert the Aspose.cells.chart object to an imaged using in our product, the value axis fill seems get lost during converting to image.


Dim chart As Aspose.Cells.Charts.Chart = wb.Worksheets(0).Charts(0)
chart.ValueAxis.Area.FillFormat.Type = Aspose.Cells.Drawing.FillType.Solid
chart.ValueAxis.Area.FillFormat.SolidFill.Color = Color.Green
Dim img As Image = chart.ToImage()
img.Save(“C:\img.jpeg”)

Thanks,
Wei

Hi Wei,

Thanks for your posting and using Aspose.Cells.

We have looked into your issue further. When chart is converted to image, then chart axis fill color applied does not show up.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-42794.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\source.xlsx”;


Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.Worksheets[0];


Chart chart = worksheet.Charts[0];


chart.ValueAxis.Area.FillFormat.Type = FillType.Solid;

chart.ValueAxis.Area.FillFormat.SolidFill.Color = Color.Green;


chart.ToImage().Save(filePath + “.out.jpg”);

Hi,

Please try our latest version/fix: Aspose.Cells for .NET 8.2.1.2
We have fixed the issue now. We implement the setting value axis’s fill for Chart to Image feature.

Let us know your feedback.

Thank you.

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


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

Thanks for the update. I have checked in the new build, it works now.

Hi Wei,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the latest release. Let us know if you encounter any other issue, we will be glad to look into it and help you further.