Articles in this section
Category / Section

How to position tooltip relative to mouse pointer in WPF Charts

3 mins read

In WPF Chart, the tooltip  is used to show the y-value or the data point value of related ChartSegment, when the user moves the mouse pointer over any chart segment. Chart tooltip is enabled by setting the ShowTooltip property of ChartSeries to true.

The following steps explain how to position the tooltip based on the mouse pointer position:


Step 1: Create an instance of ChartTooltipBehavior class and add it to the SfChart Behaviors collection.

 

Step 2: By default, the Position property of ChartTooltipBehavior value is Auto, which positions the tooltip at the data point position. You can also change the Position property value to Pointer to show the tooltip on the mouse pointer position, as shown in the following code example.


 [XAML]

<chart:SfChart.Behaviors>
    <chart:ChartTooltipBehavior Position="Pointer"/>
</chart:SfChart.Behaviors>

[C#]

SfChart chart = new SfChart();
…
ChartTooltipBehavior chartTooltipBehavior = new ChartTooltipBehavior();
chartTooltipBehavior.Position = TooltipPosition.Pointer;
chart.Behaviors.Add(chartTooltipBehavior);

Output


Show tooltip on mouse pointer position in WPF Charts

 

See also

How to customize the tooltip in chart

How to display the tooltip when the mouse is in any region of the FastLineBitmapSeries in WPF Charts

How to set the duration for chart tooltip


Conclusion

I hope you enjoyed learning how to position a tooltip relative to the mouse pointer in the WPF Chart.

You can refer to our WPF Chart feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF Chart Examples to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied