10-26-2017 06:59 AM
How to change MultiPlotCursor value format in C# code?
thanks
Theo
10-26-2017 10:05 AM
The display of the multi-plot cursor's Values are controlled by the ValuePresenter property. Generally you would use a ValueFormatterGroup, which supports specifying a different formatter for each dimension (i.e. the X and Y data for each value). If the ValueFormatters collection is empty or missing a value, the DefaultFormatter, will be used in its place.
Here is the answer from another question that wanted to display one dimension as time and another as numeric:
<ni:MultiPlotCursor.ValuePresenter>
<ni:ValueFormatterGroup DefaultFormatter="0.00" Separator=" — ">
<ni:GeneralValueFormatter Format="yy-MM-dd HH:mm:ss" />
</ni:ValueFormatterGroup>
</ni:MultiPlotCursor.ValuePresenter>
The equivalent in code:
cursor.ValuePresenter = new ValueFormatterGroup( " — ", new GeneralValueFormatter( "0.00" ) ) {
ValueFormatters = { new GeneralValueFormatter( "yy-MM-dd HH:mm:ss" ) }
};
10-27-2017 05:20 AM
It worked.
Thank you Paul !