Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiplot Cursor seems to truncate data to integer values

Solved!
Go to solution

Start with example program PlotRenderer.  I used VS2010.

 

Add Cursor To graph:

 

<ni:Graph.Children>
<ni:MultiPlotCursor ValuePresenter="Group: 0;0.00" Label="multiPlotCursor1" />
</ni:Graph.Children>

 

the Y axis data displays 2 Digits after the decimal point but they are always .00

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

I was able to reproduce the issue in the PlotRenderers example you mentioned. This appears to be a problem with our native value formatting implementation, and I have created a task to fix this in our next release.


As a workaround, you can use a custom formatter to display the original value, instead of the incorrectly converted value:


    Code
    public class DoubleFormatter : GeneralValueFormatter {
        public DoubleFormatter( ) : base( "0.00" ) { }

        protected override string FormatCore<TData>( TData value, ValuePresenterArgs args ) {
            object originalValue;
            string result =
                args.Data.TryGetValue( "Original Value", out originalValue )
                    ? base.FormatCore( (double)originalValue, args )
                    : base.FormatCore( value, args );
            return result;
        }
    }

    XAML
    <ni:MultiPlotCursor.ValuePresenter>
        <ni:ValueFormatterGroup>
            <ni:ValueFormatterGroup.DefaultFormatter>
                <local:DoubleFormatter />
            </ni:ValueFormatterGroup.DefaultFormatter>

            <ni:GeneralValueFormatter Format="0" />
        </ni:ValueFormatterGroup>
    </ni:MultiPlotCursor.ValuePresenter>

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

Just wanted to let you know this issue was fixed in the Measurement Studio 2019 release.

~ Paul H
0 Kudos
Message 3 of 3
(1,851 Views)