Question

Circualr compass gauge: StartAngle and Value questions.

Posted 5 years ago by Avatar David Bagby - Calypso Ventures, Inc.

Hi,

I'm trying to make a circular gauge that displays the angle of an object (0-360 degrees).

The Gage needs to have 0 at the top of the gauge. The scale rotates instead of the needle (like a compass).

I created a stationary needle by making a scale with only a needle, which has a Value = 270 to get the pointer to point straight up.

Then I made the core scale rotate by binding the scale's StartAngle to an angle value...

I'm close, but a couple of things I have not found how to do - a pointer to the right properties would be appreciated.

The questions:

Question 1) To get the center scale to rotate the correct amount AND on the correct direction,  I have to set the StartAngle to

(360 - Angle + StartAngle ) modulo  360

I'm wishing there were separate properties for a) Scale angular offset, and b) "scale rotation value", but that does not appear to be how things were constructed as the pointer only has Value and the scale only has StartAngle. Thus I have to do some value fiddling outside the control (which feels a bit messy). 

Is there a better approach I've missed?

Question 2) The scale has 360 degrees... but I don't want to show the number 360 at the top, I want to show 0.... so I set SkipValues="360" ...

Yeah, the 360 goes away, but I'm stumped as to how to get a 0 to show up... what am I not seeing?

 

In case it helps, here is the Gauge XAML

<!-- Angle Display; 0 @ TDC; Rotating scale -->
<gauge:CircularGauge x:Name="PartAngleGOOD" Grid.Column="3" Radius="90"
	FrameType="CircularThickRim" Background="#FF063818" RimBrush="#504E5F"
	ToolTip="Part Angle" Margin="84.4,301,23,8.2" Grid.RowSpan="2">
	<gauge:CircularGauge.Items>
		<TextBlock gauge:GaugeBase.Y="30" Text="Angle" FontFamily="Arial" Foreground="Wheat"
			FontSize="18" Margin="0,-3.996,0,3.996" />
	</gauge:CircularGauge.Items>
		<gauge:CircularScale BorderBrush="Black" Background="#58667A" SweepAngle="360" Radius="48" StartAngle="{Binding VMPartAngleDegrees, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}">
		<gauge:CircularTickSet Maximum="360" MajorInterval="30" MinorInterval="5">
			<gauge:CircularTickSet.Ticks>
				<gauge:CircularTickMarkMinor TickMarkExtent="3" TickMarkAscent="3"
					TickMarkType="Rectangle" ScalePlacement="Outside" />
				<gauge:CircularTickMarkMajor TickMarkExtent="10" TickMarkAscent="3"
					TickMarkType="Rectangle" ScalePlacement="Outside" ScaleOffset="1" />
				<gauge:CircularTickLabelMajor FontFamily="Tahoma" FontSize="11"
					ScalePlacement="Outside" SkipValues="360"
					ScaleOffset="11" Foreground="Wheat" />
			</gauge:CircularTickSet.Ticks>
		</gauge:CircularTickSet>
	</gauge:CircularScale>
	<gauge:CircularScale StartAngle="{Binding GaugeStartAngle}" AllowDrop="False">
		<gauge:CircularTickSet >
			<gauge:CircularTickSet.Pointers>
				<gauge:CircularPointerNeedle x:Name="RightSensorForce12" BorderBrush="Wheat"
					Background="{shared:LinearGradientBrush GhostWhite, White, GradientType=LeftToRight}"
					PointerAscent="5" PointerExtent="70" NeedleType="PivotSwordSharp"
					HasDropShadow="False" DampeningMinimumDuration="0:0:0.100" />
				<gauge:CircularPointerCap CapType="CircleConvex" PointerExtent="10"
					Background="#58667A" />
			</gauge:CircularTickSet.Pointers>
		</gauge:CircularTickSet>
	</gauge:CircularScale>
</gauge:CircularGauge>

 Dave

[Modified 5 years ago]


Comments (2)

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Dave,

1) Sorry but as you saw, there is only the StartAngle on scale.  So what you are doing is probably best.

2) 0 and 360 are the same value, so what you did to remove 360 is correct.  Then you can manually add in zero like this:

<gauge:CircularTickLabelCustom Value="0" Text="0" FontFamily="Tahoma" FontSize="11" ScalePlacement="Outside" ScaleOffset="11" Foreground="Wheat" />

Actipro Software Support
Posted 5 years ago by David Bagby - Calypso Ventures, Inc.

Thanks. That did what was needed.

Dave

Information The latest build of this product (2018.1 build 0671) was released 1 month ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.