Hello,
I would like to use XamLinearGauge or XamBulletGraph in order to Show following Information:
a) The Control has MinimumValue and MaximumValue set via binding -> works ok
It is a range from eg. minus 1.000 upto plus 1.000
b) The value to be displayed should start from 0. This means that the graph for a negativ value starts a 0 and continues into the left directionA positive value starts also at 0 and continues into the Right side.
c) The valuebar Color is red or green dependent on the value -> works ok via style and datatrigger
0minus --------------|-------------- plus
negativ value:
0minus --------xxxx|-------------- plus
positive value:
0minus -------------|xxxxx-------- plus
How can this be done?
Thanks
Niko
Hello Niko,
I have been investigating into the requirement you are looking to achieve, and currently, I would recommend continuing what you are doing for points A and C, in that you should continue setting the MinimumValue and MaximumValue properties and using a style and data trigger to set the value-bar color.
Regarding point B, if you are looking to have your value start from 0, you can simply set the Value property of the XamLinearGauge or XamBulletGraph to 0. This will place the “needle” in the center of the graph in your example, as it will be perfectly between -1000 and +1000.
From your “diagram” that you have provided, it looks like you are looking to “shade” the area between zero and your value as well. In order to do this, I would recommend using the Ranges collection of the XamLinearGauge. There, you can define a XamLinearGraphRange element. From there, I would recommend handling the ValueChanged event of the gauge, as this can net you the new value and allow you to change your range. If the value is negative, you can set the StartValue of your range to the e.NewValue (where ‘e’ is the event arguments of the ValueChanged event handler) and the EndValue to zero and vice versa for when the value is positive. Here, you can also change the Brush of the range, if you see fit.
I am attaching a sample project demonstrating the above. I hope this helps you.
Please let me know if you have any other questions or concerns on this matter.
LinearGaugePositiveNegative.zip