Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the y-values from all plots of WPF Graph at the same known x-value?

Solved!
Go to solution

Hi all!

 

WPF question.How to get the y-values from all plots of WPF Graph at the same known x-value (got the x-value from textbox)?

 

Thanks!

0 Kudos
Message 1 of 3
(4,706 Views)
Solution
Accepted by topic author mengly

You can use the FindNearestValues method to find the data values corresponding to a specified axis intercept across multiple plots. This method takes a relative value, so you will want to convert your raw data value using DataToRelative first. For example:


    var xAxis = ...;
    double relativeValue = graph.DataToRelative( xAxis, xValue );
    var query = new GraphQueryArgs( PlotsToSearch.Any, SearchDimensions.Horizontal, SearchDirections.ForwardAndReverse, isInclusive: true );

    var foundValues = graph.FindNearestValues( xAxis, relativeValue, query );
    foreach( PlotValue found in foundValues ) {
        object x = found.Value[0];
        object y = found.Value[1];
        ...
    }

~ Paul H
Message 2 of 3
(4,697 Views)

Thanks a lot Paul. It works like a charm.

0 Kudos
Message 3 of 3
(4,692 Views)