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

Free Support Forum - aspose.com

Setting 3D effect to all charts

Hello,


I am trying to set the 3D effect to the following charts: ClusteredBar, ClusteredColumn and StackedColumn.

I am using the following settings:

//The method applying the effects
public static void Add3DEffect(this IChartSeries series)
{
var format = series.Format;

format.Effect3D.Depth = 4;
format.Effect3D.BevelTop.BevelType = BevelPresetType.Circle;
format.Effect3D.BevelTop.Width = 6;
format.Effect3D.BevelTop.Height = 6;

format.Effect3D.Camera.CameraType = CameraPresetType.OrthographicFront;
format.Effect3D.LightRig.LightType = LightRigPresetType.ThreePt;
format.Effect3D.LightRig.Direction = LightingDirection.Top;
}

//The caller code
foreach (var s in ChartObject.ChartData.Series)
{
s.Add3DEffect();
}

Those settings have effect only on the ClusteredColumn chart, on the rest of the charts the legend is 3D, but the bars are not (see the generated pptx, attached to this post).

Thank you for you help.

Hi Cristina,

Thanks for inquiring Aspose.Slides.

I have worked with the sample code shared by you and have successfully generated a chart with 3D effects on my end. I have used following code on my end. For reference, I have also attached the generated presentation as well.

public static void AddChart3D()
{
Presentation pres = new Presentation();
ISlide slide = pres.Slides[0];

// IChart chart = slide.Shapes.AddChart(ChartType.ClusteredColumn, 10, 10, 400, 300);
IChart chart = slide.Shapes.AddChart(ChartType.ClusteredBar, 10, 10, 400, 300);
//The caller code
foreach (var s in chart.ChartData.Series)
{
Add3DEffect(s);
}

pres.Save(“C:\Aspose Data\SavedPres.pptx”, SaveFormat.Pptx);
}

////The method applying the effects
public static void Add3DEffect(IChartSeries series)
{
var format = series.Format;

format.Effect3D.Depth = 4;
format.Effect3D.BevelTop.BevelType = BevelPresetType.Circle;
format.Effect3D.BevelTop.Width = 6;
format.Effect3D.BevelTop.Height = 6;

format.Effect3D.Camera.CameraType = CameraPresetType.OrthographicFront;
format.Effect3D.LightRig.LightType = LightRigPresetType.ThreePt;
format.Effect3D.LightRig.Direction = LightingDirection.Top;
}

Many Thanks,