Pie Chart Shadow Effect

I am trying to add a shadow effect to a Pie Chart. I found some code on your site for the plot area and converted that. When I open the xlsx file that is created, I do not see the shadow effect. However when I select format dataseries and check the shadow settings, I can see all of my settings present. If I just change one of the settings than the shadow effect shows up. Am I missing a step to get the shadow to show. Here is my code and I have attached the xlsx file that is created. In the end, I will be saving this as an image which also is not showing the shadow effect

I am using version 7.2.2.0 or ASPOSE Cells

Dim workbook As Workbook = New Workbook
Dim worksheet As Worksheet = workbook.Worksheets(0)

'Adding a chart to the worksheet
Dim chartIndex As Integer = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Pie, 1, 7, 13, 11)

Dim chart As Aspose.Cells.Charts.Chart = worksheet.Charts(chartIndex)

chart.NSeries.Add("A1:A3", True)
worksheet.Cells(0, 0).PutValue(15)
chart.NSeries(0).Points(0).Area.ForegroundColor = System.Drawing.Color.PowderBlue
worksheet.Cells(1, 0).PutValue(25)
chart.NSeries(0).Points(1).Area.ForegroundColor = System.Drawing.Color.GreenYellow
worksheet.Cells(2, 0).PutValue(60)
chart.NSeries(0).Points(2).Area.ForegroundColor = System.Drawing.Color.Pink

chart.NSeries(0).Border.IsVisible = True
chart.NSeries(0).Border.Color = System.Drawing.Color.White
chart.NSeries(0).Border.Weight = 2
chart.NSeries(0).Border.Transparency = 0.5

chart.NSeries(0).Shadow = True

Dim shpt As Aspose.Cells.Drawing.ShapePropertyCollection = chart.NSeries(0).ShapeProperties

Dim shadowEffect As Aspose.Cells.Drawing.ShadowEffect = shpt.ShadowEffect
Dim cellcolor As CellsColor = workbook.CreateCellsColor
cellcolor.Color = System.Drawing.Color.Red

shadowEffect.Color = cellcolor
shadowEffect.Transparency = 0.6
shadowEffect.Size = 1
shadowEffect.Blur = 4
shadowEffect.Angle = 90
shadowEffect.Distance = 3

chart.ShowLegend = objGraphOptions.ShowLegend
chart.PlotArea.Border.IsVisible = objGraphOptions.ShowPlotAreaBorder
chart.ChartArea.Border.IsVisible = objGraphOptions.ShowChartAreaBorder

strImageName = strAccessCode & strAdditionalGraphName & CreateUniqueString(UniqueStringType.TimeOnly) & ".emf"

chart.ToImage(objEnvironmentVariables.ReportPath & strImageName, System.Drawing.Imaging.ImageFormat.Emf)

workbook.Save(objEnvironmentVariables.ReportPath & strImageName & CreateUniqueString(UniqueStringType.TimeOnly) & ".xlsx", Aspose.Cells.SaveFormat.Xlsx)

Hi,


I can find the issue as you have mentioned by using your sample code. When I open the output xlsx file that is created, I do not see the shadow effect. However when I select format data series option and check the shadow settings, I can see all of my settings present there. If I just change one of the settings than the shadow effect shows up. Also, the output is not showing the shadow effects.

My simplest sample code (equivalent C#):

Sample code:

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Adding a chart to the worksheet
int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Pie, 1, 7, 13, 11);

Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];

chart.NSeries.Add(“A1:A3”, true);
worksheet.Cells[0, 0].PutValue(15);
chart.NSeries[0].Points[0].Area.ForegroundColor = System.Drawing.Color.PowderBlue;
worksheet.Cells[1, 0].PutValue(25);
chart.NSeries[0].Points[1].Area.ForegroundColor = System.Drawing.Color.GreenYellow;
worksheet.Cells[2, 0].PutValue(60);
chart.NSeries[0].Points[2].Area.ForegroundColor = System.Drawing.Color.Pink;

chart.NSeries[0].Border.IsVisible = true;
chart.NSeries[0].Border.Color = System.Drawing.Color.White;
chart.NSeries[0].Border.Weight = WeightType.SingleLine;
chart.NSeries[0].Border.Transparency = 0.5;

chart.NSeries[0].Shadow = true;

Aspose.Cells.Drawing.ShapePropertyCollection shpt = chart.NSeries[0].ShapeProperties;

Aspose.Cells.Drawing.ShadowEffect shadowEffect = shpt.ShadowEffect;
CellsColor cellcolor = workbook.CreateCellsColor();
cellcolor.Color = System.Drawing.Color.Red;

shadowEffect.Color = cellcolor;
shadowEffect.Transparency = 0.6;
shadowEffect.Size = 1;
shadowEffect.Blur = 4;
shadowEffect.Angle = 90;
shadowEffect.Distance = 3;


chart.ShowLegend = true;
chart.PlotArea.Border.IsVisible = true;
chart.ChartArea.Border.IsVisible = true;

//strImageName = strAccessCode + strAdditionalGraphName + CreateUniqueString(UniqueStringType.TimeOnly) + “.emf”;

chart.ToImage(“e:\test2\mychartshadoweffect.emf”, System.Drawing.Imaging.ImageFormat.Emf); //No shadow effect

workbook.Save(“e:\test2\mychartshadoweffect.xlsx”, Aspose.Cells.SaveFormat.Xlsx); //No shadow effect

I have logged a ticket with an id: CELLSNET-40938 for your issue. We will look into it soon.

Thank you.

Hi,


bmeyer255:

Amjad,

Thanks for the information. After I sent this I found a few more things that may also be bugs. Let me know if I should open new issues for these.

1.In the example above, I changed my border to black and I noticed that the same thing is occuring with the border that is happening with the shadow. The settings show up when you look at the chart in the xls, but they are not visible until you modify them.

2. I added a lable to my Pie chart from the example above. I changed the font and font size on the lable and it shows in the xlsx, but when I save to image, the font changes did not take effect.

chart.NSeries(0).Points(0).DataLabels.Text = “test1”
chart.NSeries(0).Points(1).DataLabels.Text = “test2”
chart.NSeries(0).Points(2).DataLabels.Text = “test3”

chart.ChartArea.Font.Name = “Ariel”
chart.ChartArea.Font.Size = 5

3. The same issue as number 2 with the label font data not transfering to the image occured when I was working with the Bar graph type as well.


I have moved your new issues to create a new thread for you, please follow up your other thread:
https://forum.aspose.com/t/107170

Thank you.

Hi,

Thanks for using Aspose.Cells.

Please download and try this fix: Aspose.Cells for .NET v7.3.0.5.

We have fixed the shadow effect issues for saving to excel file. Shadow effect is not supported in the generated chart images and we can’t support the feature recently.

I see that this is fixed in the xls file. Unfortunately, where I was wanting it most was in the ToImage as I am going to import this graph into word using Aspose.Word. We will just go without for now.

Any idea of if or when the ToImage will work for the shadow effect? Can I plan for it to be there sometime in the next 6 months or so, or is this not something that will be there any time soon.

Thanks

Brad

Hi Brad,


I have asked the concerned developer if we could provide you an eta for Shadow Effect feature in Chart-to-Image. Once we have any feedback from him, we will let you know here.

Thank you.

Amjad,

I just wanted to check in on this issue since I am doing more work where it would be a nice effect to have the shadow feature on the ToImage. This time on Bar Graphs. Is this something that is still in the works? I am using 7.3.2.0. I see that there is a newer verision from last week that I will get, but it does not have anything to do with shadow features in the release.

Brad

Hi,

Thanks for using Aspose.Cells for .NET.

We are afraid, at the moment, there is no update for you. This issue is still unresolved as we have checked the database resolution status of this issue.

Please spare us some more time. Probably, it is a difficult feature and therefore, it might take much more time than expected.

We have again requested the developer to provide the ETA for this issue.