Fractional tick labels

Gauge for WPF Forum

Posted 9 years ago by Ralph
Avatar
I'm trying to display a fractional value in a circular gauge label. I can set TextFormat on the CircularTextLabelMajor and it seems to display the value, but unfortunately it always seems to have the fractional part truncated.

My gauge has: gauge:CircularTickSet Minimum="-1" Maximum="1" MajorInterval=".5" MinorInterval=".1" IntervalOrigin="Zero"

This is the only style applied to it:

<Style TargetType="{x:Type gauge:CircularTickLabelMajor}">
<Setter Property="FontSize" Value="15%" />
<Setter Property="ScalePlacement" Value="Inside" />
<Setter Property="ScaleOffset" Value="8" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Foreground" Value="Black" />
</Style>

Any suggestions? Is this possible?

[Modified at 07/26/2010 01:21 PM]

Comments (4)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ralph,

You would need to set CircularTickLabelMajor.RoundMode to None, then use the TextFormat to truncate/format your fractional values.


Actipro Software Support

Posted 9 years ago by Ralph
Avatar
That works great. Now I have one slight problem.

My fractional gauge is part of two needle/ranges on a single face.

The fractional gauge is on the bottom of the gauge face, so I need the ticks to range counterclockwise ascending.

I accomplished this by setting FlowDirection to RightToLeft. When I do this, the labels show "0.5-" instead of "-0.5"

Also, oddly, if I set TextFormat to {}{0:.0}, I get labels that read "5.-" instead of "-0.5"

Is there a correct way to accomplish this?
Posted 9 years ago by Ralph
Avatar
Ok, as I posted this I figured out the obvious.

The TickLabel seems to be inheriting the FlowDirection from the CircularGauge. So I set the TickLabel to LeftToRight and the labels look correct.
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ralph,

In the future, please try to post distinct questions separately. But I believe you are looking for the IsReversed property on the CircularTickSet.

Setting the FlowDirection does "reverse" the drawing and also causes text drawing to be altered. But this isn't really what the FlowDirection was designed for, since you are effectively flipping it in some locations and restoring it in others. The IsReversed will handle everything for you and the text will always render correctly.


Actipro Software Support

The latest build of this product (v2019.1 build 0681) was released 9 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.