windowsforms-3440-controls-and-libraries-chart-control-examples-end-user-interaction-how-to-show-custom-information-in-a-crosshair-cursor-tooltip.md
This example demonstrates how to display information from the underlying datasource in the Crosshair Cursor label for every series point.
using System;
using System.Windows.Forms;
namespace CustomInfoInTooltips {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
// TODO: This line of code loads data into the 'nwindDataSet.Products' table. You can move or remove it.
this.productsTableAdapter.Fill(this.nwindDataSet.Products);
chartControl1.Series[0].CrosshairLabelPattern = "Unit price: {UnitPrice}\r\n" +
"Units in stock: {UnitsInStock}\r\n" +
"Quantity per unit: {QuantityPerUnit}";
}
}
}
Imports System
Imports System.Windows.Forms
Namespace CustomInfoInTooltips
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
' TODO: This line of code loads data into the 'nwindDataSet.Products' table. You can move or remove it.
Me.productsTableAdapter.Fill(Me.nwindDataSet.Products)
chartControl1.Series(0).CrosshairLabelPattern = "Unit price: {UnitPrice}" & vbCrLf &
"Units in stock: {UnitsInStock}" & vbCrLf &
"Quantity per unit: {QuantityPerUnit}"
End Sub
End Class
End Namespace
Tip
A complete sample project is available in the DevExpress Code Examples database at https://supportcenter.devexpress.com/ticket/details/e126/winforms-chart-display-data-source-values-in-crosshair-labels.
See Also
How to: Determine which Series Point Is Under the Test Point
How to: Show Custom Data in a Web Chart Using ASPxPopupControl