Circular Gauge wrapping around its maximum and minimum values

Gauge for WPF Forum

Posted 4 months ago by John king
Version: 23.1.3
Avatar

<gauge:CircularGauge Width="180" Height="180" BackgroundType="None">
<gauge:CircularGauge.Scales>
<gauge:CircularScale StartAngle="135" SweepAngle="180" Background="Transparent">
<gauge:CircularScale.TickSets>
<gauge:CircularTickSet Name="VolumeTickset" Minimum="0" Maximum="270" MajorInterval="1" MinorInterval="1">
<gauge:CircularTickSet.Pointers>
<gauge:CircularPointerNeedle Name="VolumeNeedle" NeedleType="Knob" PointerExtent="88" PointerAscent="0" CanDrag="True"
Focusable="True" Background="#FF323232" PointerDirection="Normal" BorderWidth="0" HasDropShadow="False" Value="0" ValueChanged="VolumeNeedle_ValueChanged" />
</gauge:CircularTickSet.Pointers>
</gauge:CircularTickSet>
</gauge:CircularScale.TickSets>
</gauge:CircularScale>
</gauge:CircularGauge.Scales>
</gauge:CircularGauge>

This is the Ciruclar Gauge I have in Xaml in my C#. I have seen in the documentation that Pointerdirection = Normal makes it not wrap around the minimum and maximum values but I tried setting it and it didn't do anything it still doesn't work. Any suggestion or help would be appreciated. Thank you.

Comments (3)

Posted 4 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

I believe the PointerDirection property only affects behavior of a pointer when the parent scale has a 360 degree SweepAngle.  Otherwise, it is not used.  If you make your SweepAngle 360, then you should see a difference when using the PointerDirection property.


Actipro Software Support

Posted 4 months ago by John king
Avatar

Hey thanks for the reply. I still haven't seen a difference setting it still allowed the knob to rotate both directions and overlapping the max and min values when set to normal contrary to the documentation. Is there any way to limit or stop any movement further than the max and min value. Note: it directly jumps from the max 270 to min 0 or vice versa it doesn't incrementally get past the values.

Posted 4 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

In our CircularGaugeInteractive sample, make these changes in XAML to see how it can affect things:

Line 68 (set 360 degree sweep angle):

<gauge:CircularScale Radius="85" StartAngle="0" SweepAngle="360" BarExtent="15"

Line 91 (add x:Name and remove zero dampening properties):

<gauge:CircularPointerMarker x:Name="needleMarker" MarkerType="Ellipse" PointerAscent="12" PointerExtent="12"
Background="#AAAAAA" BorderBrush="#666666" BorderWidth="1" ScaleOffset="-17"
HasDropShadow="False" IsHitTestVisible="False" 
Value="{Binding ElementName=needle, Path=DisplayValue}" />

Then add this at line 40:

<grids:PropertyModel CanAutoConfigure="True" Value="{Binding Mode=TwoWay, ElementName=needleMarker, Path=PointerDirection}" />

Once you do that and run the sample, move the knob around and you can see how the marker dot animates based on the PointerDirection setting chosen in the property grid on the right.

The Normal value for PointerDirection prevents the needle marker from going from say 1 degree directly to 359 degrees on a small change to that value.  Instead it will animate the needle marker all the way around the gauge to get to 359.  Whereas the ShortestDistance value will allow the needle marker to animated directly over that 0 degree barrier.  But note that as previously mentioned, the PointerDirection property is only used for 360 degree sweep angles and ignored otherwise.

Now if I take all the code above and reset the SweepAngle to 270, then go move the know from 0 to 270, it behaves like the Normal PointerDirection (since < 360 degree sweep angle).  It animates the needle marker the long way around the knob from 0 to 90 to 180 to 270 degrees.

Given the above, if you have a followup question, perhaps you can tell us how to update our sample so that we can better see what you mean since it's hard to visualize things with the original XAML posted in the thread.  Thanks!


Actipro Software Support

The latest build of this product (v24.1.2) was released 5 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.