04-06-2020 05:36 PM
Hello all, it would be great to know how also set a rounding precision for the mins and maxs of each axis. As I zoom in they become this odd exponential abbreviation and it would be nice if they always rounded to say 2 decimal places instead of #.##E0. I notice the center tick marks are always to 2 decimal point precision, can that be applied to the min and max for each axis?
Thanks,
Solved! Go to Solution.
04-22-2020 03:11 PM
If you simply want to avoid seeing the exactly label values, you can change the Mode
on the axis to only generate the interior divisions:
<ni:AxisDouble.MajorDivisions>
<ni:RangeLabeledDivisions Mode="AutoWithoutExtremes" />
</ni:AxisDouble.MajorDivisions>
If you want to keep the extreme divisions, but use a truncated label, then you can change the format used to display the division labels:
<ni:AxisDouble.MajorDivisions>
<ni:RangeLabeledDivisions>
<ni:GeneralValueFormatter ShortFormat="0.##" />
</ni:RangeLabeledDivisions>
</ni:AxisDouble.MajorDivisions>
If you want to restrict the actual underlying extremes to rounded numbers, then you can handle the RangeChanged
event to coerce the final range value.
04-22-2020 06:02 PM
Thanks for the response, I tried the first method but I get a xaml parser error:
An exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll but was not handled in user code
Additional information: 'Failed to create a 'Mode' from the text 'AutoWithoutExtremes'.' Line number '61' and line position '22'.
Also, I tried the second method by embedding the xaml but it returns with a build error:
Severity Code Description Project File Line Suppression State
Error Cannot add content to object of type 'NationalInstruments.Controls.RangeLabeledDivisions'. Line 62 Position 30.
Thanks,
04-23-2020 10:49 AM
It looks like the AutoWithoutExtremes
mode, and the content property attribute on RangeLabeledDivisions
, were added in Measurement Studio 2019.
For the second approach, you can just add the explicit property name that the formatter should be assigned to:
<ni:AxisDouble.MajorDivisions>
<ni:RangeLabeledDivisions>
<ni:RangeLabeledDivisions.LabelPresenter>
<ni:GeneralValueFormatter ShortFormat="0.##" />
</ni:RangeLabeledDivisions.LabelPresenter>
</ni:RangeLabeledDivisions>
</ni:AxisDouble.MajorDivisions>
For the first approach, you could create a custom RangeDivisionsMode
to remove the extremes from the call to get divisions: basically the reverse of the answer to this question.
04-23-2020 11:45 AM
Yes we have an older version it looks. The second solution worked for us thanks!