Free Support Forum - aspose.com

chart.PlotArea.Border settings unexpectedly resets the PlotArea size

hello.

i've adapted your sample code for "custom charts" to create a pie chart. my code (below) creates the PlotArea to the left and the Legend to the right.

the last thing i need to do is remove the border from the PlotArea. this seems simple enough:
chart.PlotArea.Border.IsVisible = False
however this unexpectedly resets the PlotArea to take up the full width of the chart area.
also i tried:
chart.PlotArea.Border.Color = System.Drawing.Color.White
but this does the very same thing!

please help! cheers, rob johnson

- - - - - - - - - -

Dim workbook As Aspose.Excel.Excel = New Aspose.Excel.Excel
Dim worksheet As worksheet = workbook.Worksheets(0)
worksheet.Cells("A1").PutValue("Finance")
worksheet.Cells("B1").PutValue(5)
worksheet.Cells("A2").PutValue("Underwriting")
worksheet.Cells("B2").PutValue(1)
worksheet.Cells("A3").PutValue("Advisory")
worksheet.Cells("B3").PutValue(1)
Dim intChartIndex As Integer = worksheet.Charts.Add(ChartType.Pie3D, 0, 3, 10, 8)
Dim chart As chart = worksheet.Charts(intChartIndex)
chart.Title.Text = "Overdue Action Points by Area"
chart.Title.TextFont.Size = 9
chart.Title.TextFont.Color = System.Drawing.Color.Black
chart.Title.TextFont.IsBold = True
chart.Legend.Position = LegendPositionType.Right
chart.Legend.TextFont.Size = 9
chart.NSeries.Add("B1:B3", True)
chart.NSeries(0).Type = ChartType.Pie3D
chart.NSeries.CategoryData = "A1:A3"
'chart.PlotArea.Border.IsVisible = False
Return workbook

Hi

Thanks for considering Aspose.

Which version of Aspose.Excel are you using? For your information Aspose.Excel has been reshaped to become Aspose.Cells now with much improved and most extensive features related to performance and reliability.

I ran your code with Aspose.Cells (4.0.3 latest version) and it showed perfect results to off border of the PlotArea (You may download from Aspose site and test it):

' Aspose.Cells.Workbook class is included instead of Aspose.Excel.Excel class.

Dim workbook As Aspose.Cells.Workbook = New Aspose.Cells.Workbook()

Dim worksheet As Worksheet = workbook.Worksheets(0)

worksheet.Cells("A1").PutValue("Finance")

worksheet.Cells("B1").PutValue(5)

worksheet.Cells("A2").PutValue("Underwriting")

worksheet.Cells("B2").PutValue(1)

worksheet.Cells("A3").PutValue("Advisory")

worksheet.Cells("B3").PutValue(1)

Dim intChartIndex As Integer = worksheet.Charts.Add(ChartType.Pie3D, 0, 3, 10, 8)

Dim chart As Chart = worksheet.Charts(intChartIndex)

chart.Title.Text = "Overdue Action Points by Area"

chart.Title.TextFont.Size = 9

chart.Title.TextFont.Color = System.Drawing.Color.Black

chart.Title.TextFont.IsBold = True

chart.Legend.Position = LegendPositionType.Right

chart.Legend.TextFont.Size = 9

chart.NSeries.Add("B1:B3", True)

chart.NSeries(0).Type = ChartType.Pie3D

chart.NSeries.CategoryData = "A1:A3"

chart.PlotArea.Border.IsVisible = False

workbook.Save("d:\charts.xls")

Regards

Amjad Sahi

Aspose Nanjing Team

i've just started using version 4.

but most of my projects use version 3.5.

thanks for your response!