07-30-2015 08:11 AM
Is there a way to display value of a cell in a "tooltip-like" popup when you click/hover anywhere on IntensityGraph?
Thank you
Solved! Go to Solution.
07-30-2015 11:19 AM
Using the technique from WPF graph display point value on hover, here is a version specific to intensity data:
private static readonly GraphQueryArgs query = new GraphQueryArgs(
PlotsToSearch.Any, SearchDimensions.HorizontalAndVertical,
SearchDirections.ForwardAndReverse, isInclusive: true );
public MainWindow( ) {
InitializeComponent( );
graph.PlotAreaMouseMove += this.OnPlotAreaMouseMove;
graph.PlotAreaMouseLeave += delegate { graph.ToolTip = null; };
ToolTipService.SetInitialShowDelay( graph, 0 );
ToolTipService.SetShowDuration( graph, int.MaxValue );
}
private void OnPlotAreaMouseMove( object sender, MouseEventArgs e ) {
IPlot plot = graph.AllPlots[0];
Point screenPosition = graph.GetPlotAreaPosition( e );
Point relativePosition = graph.ScreenToRelative( screenPosition );
PlotValue nearestValue = graph.FindNearestValue( plot, relativePosition, query );
if( nearestValue != null )
graph.ToolTip = string.Format(
"Nearest intensity value is {2} at ({0},{1}).",
nearestValue.Value.Cast<object>( ).ToArray( ) );
}
07-30-2015 01:35 PM
Much appreciated!