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

Free Support Forum - aspose.com

Chart Area Formatting

Hi,

I am using Aspose.Slides to create a MSO chart. I wants to format the backgroud of the chart.

How can i set the background as transparent and multitoned color for chart Background and Foreground?

Thanks,

Amit

Hi Amit,

Thanks for inquiring Aspose.Slides.

I have observed the requirement shared. Can you please share the requirement in the form of sample presentation so that I may observe it clearly to help you further about its possibility of implementation.

Many Thanks,

Hi,

I am attaching the image of PPTx file. If you see in chart Area then we have option to set gradient background color. How we can achieve same using Aspose Slide.

Hi Amit,


I have observed the requirement shared and it seems that you are trying to set the chart back wall color to gradient. Please visit this article for your kind reference where I have shared the sample code for setting chart entities properties. Please look for comment, “Setting chart back wall color”. It is your target.

 public static void test3D()
 {
     PresentationEx pres = new PresentationEx();
     SlideEx slide = pres.Slides[0];
     ChartEx chart=slide.Shapes.AddChart(ChartTypeEx.ClusteredColumn3D, 20, 20, 300, 300);
     
     chart.PlotArea.Format.Fill.FillType = FillTypeEx.Solid;
     chart.PlotArea.Format.Fill.SolidFillColor.Color = Color.LightCyan;
     chart.PlotArea.Format.Fill.FillType = FillTypeEx.Gradient;
     chart.PlotArea.Format.Fill.GradientFormat.GradientShape = GradientShapeEx.Linear;

     //Set the Gradient Direction
     chart.PlotArea.Format.Fill.GradientFormat.GradientDirection = GradientDirectionEx.FromCorner2;

     //Add two Gradiant Stops
     chart.PlotArea.Format.Fill.GradientFormat.GradientStops.Add((float)1.0, PresetColorEx.Purple);
     chart.PlotArea.Format.Fill.GradientFormat.GradientStops.Add((float)0, PresetColorEx.Red);

     
     ChartSeriesEx series = chart.ChartData.Series[0];
     
     series.Format.Effect3D.Camera.CameraType = CameraPresetTypeEx.OrthographicFront;

     series.Format.Effect3D.BevelBottom.BevelType = BevelPresetTypeEx.Convex;
     series.Format.Effect3D.BevelBottom.Height = 10;
     series.Format.Effect3D.BevelTop.BevelType = BevelPresetTypeEx.Convex;
     series.Format.Effect3D.BevelTop.Height = 5;

     pres.Write(“D:\Aspose Data\Test3d.pptx”);
 }

Many Thanks,

Hi,

Thanks for your reply.

But if i wants to use any HTML color code combination to set GradientStop position instead of the PresetColorEx enum. Because i am not able to get the PresetColorEx value for every HTML color code. How can i do that?

Thanks,

Amit

Hi Amit,


I like to share that Aspose.Slides expect System.Drawing.Color for setting the color. Instead of using preset color, you can set the color using HTML codes or using RGB values. The following sample code will help you in achieving the goal. Please share, if I may help you further in this regard.

Color color1 = Color.FromArgb(255,255,255);
shape.FillFormat.SolidFillColor.Color = System.Drawing.ColorTranslator.FromHtml("#E9E9E9");


Many Thanks,

Hi,

I am using the gradient formatting to apply in the series. But i can see the GradientDirectionEx allows only for "cornor 1 to cornor 4" but there is no option for "top","bottom". we do have these options in PPT.

Please see the attached screen shot.

Thanks,

Amit

Hi Amit,


I have observed your requirement and like to share the Aspose.Slides provides different names to Gradient direction as they are available in case of PowerPoint. I have created an issue with ID SLIDESNET-34448 as new feature request to further investigate the requirements and also provide some mapping between Aspose.Slides and PowerPoint gradient directions. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolve.

Many Thanks,