ChartHitInfo.AxisTitle Property
Gets an axis title which is located under the test point.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v20.2.dll
NuGet Packages: DevExpress.Charts, DevExpress.WindowsDesktop.Charts
Declaration
Property Value
Type | Description |
---|---|
AxisTitle | An AxisTitle object which represents the axis title located under the test point. |
Remarks
Use the AxisTitle property to access the axis title located under the test point if the ChartHitInfo.InAxis property returns true.
Note
The AxisTitle property returns null (Nothing in Visual Basic), if the ChartHitInfo.InAxis property is set to false. The AxisTitle property isn’t null only if the mouse pointer actually hovers over an axis title, so the AxisTitle property may return null even if the ChartHitInfo.InAxis property is set to true.
For more information, refer to Axis Titles.
Example
This example demonstrates how you can determine whether an axis title is being hovered by the mouse pointer, and if so, display its type (AxisTitleX or AxisTitleY) in a tooltip.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-determine-if-an-axis-title-is-being-hovered-by-the-mouse-pointer-t284024
using DevExpress.XtraCharts;
using System;
using System.Windows.Forms;
namespace AxisTitleHitTestSample {
public partial class SampleForm : Form {
public SampleForm() {
InitializeComponent();
}
private void OnMouseMove(object sender, MouseEventArgs e) {
ChartHitInfo hitInfo = chart.CalcHitInfo(e.X, e.Y);
if (hitInfo.AxisTitle != null)
tooltipController.ShowHint(
String.Format(
"The pointer is over the {0} object.",
hitInfo.AxisTitle.GetType().ToString()
)
);
else
tooltipController.HideHint();
}
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AxisTitle property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.