wpf-devexpress-dot-xpf-dot-charts-dot-chart3dcontrol-9871fed6.md
Gets or sets the position, rotation angles and scale of the chart.
Namespace : DevExpress.Xpf.Charts
Assembly : DevExpress.Xpf.Charts.v25.2.dll
NuGet Package : DevExpress.Wpf.Charts
public Transform3D ContentTransform { get; set; }
Public Property ContentTransform As Transform3D
| Type | Description |
|---|---|
| Transform3D |
The transform matrix that specifies the position, rotation angles and scale of the chart.
|
The following example rotates, scales and translates a chart:
<dxc:Chart3DControl x:Name="chartControl">
<dxc:Chart3DControl.ContentTransform>
<Transform3DGroup>
<Transform3DGroup.Children>
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="1,0,0" Angle="30" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="0,1,0" Angle="20" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="0,0,1" Angle="10" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
<ScaleTransform3D ScaleX="1.5" ScaleY="0.8" ScaleZ="1"
CenterX="0" CenterY="0" CenterZ="0" />
<TranslateTransform3D OffsetX="20" OffsetY="30" OffsetZ="80"/>
</Transform3DGroup.Children>
</Transform3DGroup>
</dxc:Chart3DControl.ContentTransform>
<!--...-->
</dxc:Chart3DControl>
The following code applies the same transformations as the markup above but at runtime:
using System.Windows.Media.Media3D;
//...
private void chartControl_Loaded(object sender, RoutedEventArgs e) {
chartControl.ContentTransform = GetContentTransformation();
}
Transform3D GetContentTransformation() {
Transform3DGroup transform = new Transform3DGroup();
transform.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1, 0, 0), 30)));
transform.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), 20)));
transform.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 10)));
transform.Children.Add(new ScaleTransform3D { ScaleX = 1.5, ScaleY = 0.8, ScaleZ = 1,
CenterX = 0, CenterY = 0, CenterZ = 0 });
transform.Children.Add(new TranslateTransform3D { OffsetX = 20, OffsetY = 30, OffsetZ = 80 });
return transform;
}
Private Sub chartControl_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
chartControl.ContentTransform = GetContentTransformation()
End Sub
Private Function GetContentTransformation() As Transform3D
Dim transform As Transform3DGroup = New Transform3DGroup()
transform.Children.Add(New RotateTransform3D(New AxisAngleRotation3D(New Vector3D(1, 0, 0), 30)))
transform.Children.Add(New RotateTransform3D(New AxisAngleRotation3D(New Vector3D(0, 1, 0), 20)))
transform.Children.Add(New RotateTransform3D(New AxisAngleRotation3D(New Vector3D(0, 0, 1), 10)))
transform.Children.Add(New ScaleTransform3D With {
.ScaleX = 1.5,
.ScaleY = 0.8,
.ScaleZ = 1,
.CenterX = 0,
.CenterY = 0,
.CenterZ = 0
})
transform.Children.Add(New TranslateTransform3D With {
.OffsetX = 20,
.OffsetY = 30,
.OffsetZ = 80
})
Return transform
End Function
For more information about 3D object transformations, see the topic: 3D Transformations Overview
See Also