Back to Devexpress

Chart3DControl.CalcHitInfo(Point) Method

wpf-devexpress-dot-xpf-dot-charts-dot-chart3dcontrol-dot-calchitinfo-x28-system-dot-windows-dot-point-x29.md

latest3.6 KB
Original Source

Chart3DControl.CalcHitInfo(Point) Method

Returns information on the chart elements located at the specified point.

Namespace : DevExpress.Xpf.Charts

Assembly : DevExpress.Xpf.Charts.v25.2.dll

NuGet Package : DevExpress.Wpf.Charts

Declaration

csharp
public Chart3DHitInfo CalcHitInfo(
    Point point
)
vb
Public Function CalcHitInfo(
    point As Point
) As Chart3DHitInfo

Parameters

NameTypeDescription
pointPoint

The test point coordinates relative to the top-left corner of the chart.

|

Returns

TypeDescription
Chart3DHitInfo

The information about chart elements located at the test point.

|

Example

This example shows coordinates for a surface point and series point marker clicked in a 3D chart:

xaml
<dxc:Chart3DControl x:Name="chart" MouseUp="Chart3DControl_MouseUp">
    ...
    <dxc:Series3DStorage>
        <dxc:Series3D DisplayName="Function">
            ...
            <dxc:Series3D.View>
                <dxc:SurfaceSeriesView MarkerVisible="True">
                    ...
                </dxc:SurfaceSeriesView>
            </dxc:Series3D.View>
        </dxc:Series3D>
    </dxc:Series3DStorage>
</dxc:Chart3DControl>
csharp
using DevExpress.Xpf.Charts;
using System.Windows;
//...
private void Chart3DControl_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) {
    Chart3DHitInfo hitInfo = chart.CalcHitInfo(e.GetPosition(this));
    if (hitInfo.InSeries) {
        string str;
        if (hitInfo.SeriesPoint != null) {
            SeriesPoint3D point = hitInfo.SeriesPoint;
            str = $"X: {point.NumericXArgument:f2}, Y: {point.NumericYArgument:f2}, Z: {point.Value:f2}";
            MessageBox.Show(str);
        }
        if (hitInfo.AdditionalItem != null) {
            SurfacePoint surfacePoint = (SurfacePoint)hitInfo.AdditionalItem;
            str = $"X: {surfacePoint.X:f2}, Y: {surfacePoint.Y:f2}, Z: {surfacePoint.Z:f2}";
            MessageBox.Show(str);
        }
    }
}
vb
Imports DevExpress.Xpf.Charts
Imports System.Windows
'...
Private Sub Chart3DControl_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs)
    Dim hitInfo As Chart3DHitInfo = chart.CalcHitInfo(e.GetPosition(Me))
    If hitInfo.InSeries Then
        Dim str As String
        If hitInfo.SeriesPoint IsNot Nothing Then
            Dim point As SeriesPoint3D = hitInfo.SeriesPoint
            str = $"X: {point.NumericXArgument:f2}, Y: {point.NumericYArgument:f2}, Z: {point.Value:f2}"
            MessageBox.Show(str)
        End If
        If hitInfo.AdditionalItem IsNot Nothing Then
            Dim surfacePoint As SurfacePoint = CType(hitInfo.AdditionalItem, SurfacePoint)
            str = $"X: {surfacePoint.X:f2}, Y: {surfacePoint.Y:f2}, Z: {surfacePoint.Z:f2}"
            MessageBox.Show(str)
        End If
    End If
End Sub

See Also

Chart3DControl Class

Chart3DControl Members

DevExpress.Xpf.Charts Namespace