Back to Devexpress

Chart3DControl.ContentTransform Property

wpf-devexpress-dot-xpf-dot-charts-dot-chart3dcontrol-9871fed6.md

latest4.7 KB
Original Source

Chart3DControl.ContentTransform Property

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

Declaration

csharp
public Transform3D ContentTransform { get; set; }
vb
Public Property ContentTransform As Transform3D

Property Value

TypeDescription
Transform3D

The transform matrix that specifies the position, rotation angles and scale of the chart.

|

Remarks

The following example rotates, scales and translates a chart:

xaml
<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:

csharp
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;
}
vb
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

Chart3DControl Class

Chart3DControl Members

DevExpress.Xpf.Charts Namespace