New to WPF and definitely new to the xamGauge. What I'd like to do is have a vertical XamLinearGauge and rather than have the numeric labels on the gauge I'd like to place some text labels instead since the text means more to the user than just tics or some numeric value. Also, the labels aren't equally spaced out. For example, the numeric values might be something like so:
State 1.0
Town 0.5
Neighborhood 0.25
Street 0.15
House 0.10
The "State" label would be at the top of the gauge and "Town" label halfway, etc. I didn't see an example of this (might have missed it).
Can this be done?
So, I did a little poking around and can use the LinearGaugeScale.LabelGroups like so:
<ig:LinearGaugeScale.LabelGroups>
<ig:LinearGaugeLabelGroup Interval="0.1" PostInitial="0.1" PreTerminal="0.9" Name="houseLabelGroup" />
<ig:LinearGaugeLabelGroup Interval="0.15" PostInitial="0.15" PreTerminal="0.85" Name="streetLabelGroup" />
<ig:LinearGaugeLabelGroup Interval="0.25" PostInitial="0.25" PreTerminal="0.75" Name="neighborhoodLabelGroup" />
</ig:LinearGaugeScale.LabelGroups>
and that will spread the tick labels out like I want.
Still working on this solution.
So, a thought I have for solving this is as follows:
Assuming I have a dictionary that maps the label values (e.g., 0.1, 0.15, 0.5, etc) to some string (e.g., "House", "Street", "Neighborhood") I can create a LabelAdding event handler like this:
private void myGauge_LabelAdding(object sender, LabelAddingEventArgs e)
{
e.Text = ValueToText[e.Text];
}
This seems to work well enough though there might be a better way. Ideas?
Hello Matthew,
Excuse me for the late reply. Since there is no built-in functionality to set the Labels explicitly for you, any custom approach is good if it works for you. In fact I myself have suggested something similar a while ago for a RadialGauge. Come to think of it I cannot think of anything else that would suite your scenario.
Thank you for sharing this solution with everyone, it should be useful to many users with a similar predicament.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support