Free Support Forum - aspose.com

What part of the chart is altered by setting NSeries.Point.Area and objPoint.Border?

Dear Aspose,


While looking at a part of production code I came across the following piece of code:

For Each objPoint As Aspose.Cells.Charts.ChartPoint In objChart.NSeries(0).Points
objPoint.Area.ForegroundColor = Drawing.Color.FromArgb(0, 87, 117, 152)
Next

I cannot found out what this does in the output Excel file.

I have create a piece of test code to pin point it which is run against a template with several chart types (line, pie and bar) but none of them show anything different.

Please help me by pointing me in the correct direction:

This is the test code which is applied on a chart:
Case “point area foregroundcolor”
For Each objNserie2 In objChart.NSeries
For Each objPoint As Charts.ChartPoint In objNserie2.Points
Dim objColor = System.Drawing.ColorTranslator.FromHtml(strValue)
objPoint.Area.FillFormat.FillType = Drawing.FillType.Solid
objPoint.Area.FillFormat.SolidFill.Color = objColor
objPoint.Area.ForegroundColor = objColor
objPoint.Area.BackgroundColor = objColor
objPoint.Border.Color = System.Drawing.Color.Black
objPoint.Border.Weight = Drawing.WeightType.WideLine
Next
Next

I have attached the file I try to apply the changes to.

I have tested this with the newest version and a version of Aspose.cells 8.*.

Hi Hilbert,

Thank you for contacting Aspose support.

Please note, your provided snippet isn’t executable therefore I have modified it as follow. Also attached is the resultant spreadsheet which shows how chart points have been modified with this code. Please note, the latest version of Aspose.Cells for .NET is 16.11.3 which I have used for testing purposes.

VB.NET

Dim book = New Workbook(dir & “Set+point+area+foregroundcolor+to+red.xlsx”)
Dim sheet = book.Worksheets(“Sheet1”)
For Each objChart As Chart In sheet.Charts
objChart.Calculate()
For Each series As Series In objChart.NSeries
For p As Integer = 0 To series.Points.Count - 1
Dim objPoint As ChartPoint = series.Points§
objPoint.Area.FillFormat.FillType = Aspose.Cells.Drawing.FillType.Solid
objPoint.Area.FillFormat.SolidFill.Color = Color.Red
objPoint.Border.IsVisible = True
objPoint.Border.IsAuto = False
objPoint.Border.Style = Aspose.Cells.Drawing.LineType.Dash
objPoint.Border.Color = System.Drawing.Color.Blue
objPoint.Border.Weight = Aspose.Cells.Drawing.WeightType.WideLine
Next p
Next series
'objChart.Calculate();
Next objChart
book.Save(dir & “output.xlsx”)