From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Modify the Cursor Value/Label in wpf

Solved!
Go to solution

Hello,

 

I have a graph from NI Measurement Studio 2013 WPF

 

I've insered a cursor into it.

 

I would like to show the cursor value but only the x value.

 

How to do this ?

0 Kudos
Message 1 of 5
(1,883 Views)

If you want a single interactive line, consider using a MultiPlotCursor instead of a Cursor. This can be configured to only show the value of the horizontal axis by excluding association with any plots (using an empty include list):

 

<ni:MultiPlotCursor AllowablePlots="Include:" />

 

 

Otherwise, you would need to create a custom class to use as the ValuePresenter for the cursor, and have it only display the first dimension of incoming data. Something like this:

 

protected override string FormatCore<TData>( TData value, ValuePresenterArgs args ) {
    string result =
        value is IList dimensions
            ? DimensionFormatter.Format( dimensions[0], args )
            : DimensionFormatter.Format( value, args );
    return result;
}

 

~ Paul H
Message 2 of 5
(1,861 Views)

Hello Phansen,

 

Thank you for the answer.

 

For the second solution, I don't understand your solution. 🤔.

 

the Cursor.ValuePresenter property type is ValuePresenter and I don't understand how to use your proposition.

 

 

Thx.

F.

 

0 Kudos
Message 3 of 5
(1,850 Views)
Solution
Accepted by topic author Flow75

Sorry for the isolated example code! Attached is a complete implementation of a custom value presenter class.

~ Paul H
0 Kudos
Message 4 of 5
(1,833 Views)

Hello,

 

sorry for the delay, some other stuffs to take care 😋.

 

I've finally managed to integrate your code into my application

 

Some adaptation to downgrade into c# 4.8 but all is ok !

 

Thx very much.

 

F.

0 Kudos
Message 5 of 5
(1,818 Views)