Back to Devexpress

HeatmapHitInfo.InTitle Property

corelibraries-devexpress-dot-xtracharts-dot-heatmap-dot-heatmaphitinfo-805730b6.md

latest5.5 KB
Original Source

HeatmapHitInfo.InTitle Property

Indicates whether the test point in the

Namespace : DevExpress.XtraCharts.Heatmap

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public bool InTitle { get; }
vb
Public ReadOnly Property InTitle As Boolean

Property Value

TypeDescription
Boolean

true if the test point is within a title; otherwise, false.

|

Remarks

Use the Title property to obtain a title object in the test point.

Example

The following example shows how to determine what a heatmap element is in a test point, and collect information related to this element.

Call the HeatmapControl.CalcHitInfo method to obtain information about a specific point within the Heatmap Control. This method returns a HeatmapHitInfo object that contains information related to heatmap elements positioned in the test point.

csharp
using DevExpress.Utils;
using DevExpress.XtraCharts;
using DevExpress.XtraCharts.Heatmap;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace HeatmapMatrixAdapterSample {
    public partial class Form1 : Form {
        HeatmapControl heatmap;
        ToolTipController toolTipController = new ToolTipController();
        public Form1() {
            InitializeComponent();
            //...
            heatmap.MouseMove += HeatmapMouseMove;
            heatmap.MouseLeave += HeatmapMouseLeave;
        }

        private void HeatmapMouseMove(object sender, MouseEventArgs e) {
            HeatmapHitInfo hitInfo = heatmap.CalcHitInfo(e.Location);
            StringBuilder builder = new StringBuilder();
            if (hitInfo.InAxis) {
                builder.AppendLine($"In axis: {hitInfo.Axis.Name}");
                if (hitInfo.AxisLabelItem != null)
                    builder.AppendLine($" Label: {hitInfo.AxisLabelItem.Text}");
                if (hitInfo.AxisTitle != null)
                    builder.AppendLine($" Axis title: {hitInfo.AxisTitle.Text}");
            }
            if (hitInfo.InCell)
                builder.AppendLine($" In cell: X ({hitInfo.Cell.XArgument}), Y ({hitInfo.Cell.YArgument})");
            if (hitInfo.InTitle)
                builder.AppendLine($" In title: {hitInfo.Title.Text}");
            if (hitInfo.InLegend)
                builder.AppendLine($" In legend");

            if (builder.Length > 0)
                toolTipController.ShowHint($"Hit-testing results:\n {builder}", heatmap.PointToScreen(e.Location));
            else
                toolTipController.HideHint();
        }
        private void HeatmapMouseLeave(object sender, System.EventArgs e) {
            toolTipController.HideHint();
        }
    }
}
vb
Imports DevExpress.Utils
Imports DevExpress.XtraCharts
Imports DevExpress.XtraCharts.Heatmap
Imports System.Text
Imports System.Windows.Forms

Namespace HeatmapMatrixAdapterSample
    Public Partial Class Form1
        Inherits Form

        Private heatmap As HeatmapControl
        Private toolTipController As ToolTipController = New ToolTipController()

        Public Sub New()
            InitializeComponent()
            '...
            Me.heatmap.MouseMove += AddressOf HeatmapMouseMove
            Me.heatmap.MouseLeave += AddressOf HeatmapMouseLeave
        End Sub

        Private Sub HeatmapMouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
            Dim hitInfo As HeatmapHitInfo = heatmap.CalcHitInfo(e.Location)
            Dim builder As StringBuilder = New StringBuilder()

            If hitInfo.InAxis Then
                builder.AppendLine($"In axis: {hitInfo.Axis.Name}")
                If hitInfo.AxisLabelItem IsNot Nothing Then builder.AppendLine($" Label: {hitInfo.AxisLabelItem.Text}")
                If hitInfo.AxisTitle IsNot Nothing Then builder.AppendLine($" Axis title: {hitInfo.AxisTitle.Text}")
            End If

            If hitInfo.InCell Then builder.AppendLine($" In cell: X ({hitInfo.Cell.XArgument}), Y ({hitInfo.Cell.YArgument})")
            If hitInfo.InTitle Then builder.AppendLine($" In title: {hitInfo.Title.Text}")
            If hitInfo.InLegend Then builder.AppendLine($" In legend")

            If builder.Length > 0 Then
                toolTipController.ShowHint($"Hit-testing results:
 {builder}", heatmap.PointToScreen(e.Location))
            Else
                toolTipController.HideHint()
            End If
        End Sub

        Private Sub HeatmapMouseLeave(ByVal sender As Object, ByVal e As EventArgs)
            toolTipController.HideHint()
        End Sub
    End Class
End Namespace

See Also

HeatmapHitInfo Class

HeatmapHitInfo Members

DevExpress.XtraCharts.Heatmap Namespace