We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Circular Gauge binding problems

Thread ID:

Created:

Updated:

Platform:

Replies:

121301 Nov 29,2015 02:24 PM Nov 30,2015 05:32 AM Xamarin.Forms 2
loading
Tags: SfCircularGauge
Derrick Willer
Asked On November 29, 2015 02:24 PM

It doesn't seem like binding to StartValue / EndValue for both Scales and multiple Ranges really works.  I dont see them having any effect.  I have a scenario where the bounds of the gauge need to change dynamically - basically the viewmodel tracks the min and max values seen and I want the extents of the gauge to track these, so that the needle is always in the middle.  If I bind to StartValue / EndValue nothing happens when I change the properties in my viewmodel.

I have other properties bound (StartValue / EndValue on a single range when the scale has fixed start/end seems to work) so it isn't a vm problem.

If I hook my view up to the propertychanged event of my viewmodel directly, I'm able to set startvalue/endvalue on the scale and 2nd range just fine, but this is ugly and not MVVM.  I saw a prior thread from 2013 relating to the winrt controls, so maybe there's something similar going on here.


Here is my creation code
    _radialGauge =
                new SfCircularGauge
                {
                    GaugeType = GaugeType.North
                };
            _scale =
                new Scale
                {
                    StartValue = 0,
                    StartAngle = 200,
                    SweepAngle = 140,
                    EndValue = 20, //DefaultAutoMax, //20,
                    ShowRim = false,
                    MajorTickSettings =
                        new TickSettings
                        {
                            Color = Color.FromRgba(128, 128, 128, 128),
                            Length = 200,
                            Offset = 0.08
                        },
                    MinorTicksPerInterval = 1,
                    MinorTickSettings =
                        new TickSettings
                        {
                            Color = Color.FromRgba(200, 200, 200, 128),
                            Length = 200,
                            Offset = 0.08,
                        },
                    Interval = 1.0,
                    //NumberOfDecimalDigits = 3,
                    LabelColor = CurrentTheme.ColorScheme.Gray50,
                    LabelOffset = 0,
                    LabelFontSize = 20,  //known issue - this has no effect until next update
                };
            //_scale.SetBinding(Syncfusion.SfGauge.XForms.Scale.StartValueProperty, "RangeStart");
            //_scale.SetBinding(Syncfusion.SfGauge.XForms.Scale.EndValueProperty, "RangeEnd");
            //_scale.SetBinding(Syncfusion.SfGauge.XForms.Scale.IntervalProperty, "RangeInterval");

            var pointer =
                new NeedlePointer
                {
                    Color = Color.FromRgb(228, 56, 130),
                    KnobColor = this.BackgroundColor,
                    KnobRadius = 400,
                    LengthFactor = 0.98,
                    EnableAnimation = false
                };
            pointer.SetBinding(NeedlePointer.ValueProperty, "Current");
            _scale.Pointers.Add(pointer);
            
            _backRange =
                new Range
                {
                    Color = Color.FromRgb(239, 227, 211),
                    Thickness = 220,
                    Offset = 0.05,
                    StartValue = 0,// scale.StartValue,
                    EndValue = _scale.EndValue//DefaultAutoMax,// scale.EndValue
                };
            //_backRange.SetBinding(Range.StartValueProperty, "RangeStart");
            //_backRange.SetBinding(Range.EndValueProperty, "RangeEnd");
            _scale.Ranges.Add(_backRange);

            var range =
                new Range
                {
                    Color = Color.FromRgb(178, 216, 239),
                    Thickness = 220,
                    Offset = 0.05
                };
            range.SetBinding(Range.StartValueProperty, "Minimum");
            range.SetBinding(Range.EndValueProperty, "Maximum");
            _scale.Ranges.Add(range);

            _radialGauge.Scales.Add(_scale);


Derrick Willer
Replied On November 29, 2015 05:43 PM

LinearRange bindings for StartValue / EndValue in a LinearGauge don't appear to work either.

Even if I manually bind to property changing and try to directly update the values, the displayed range is never changed.

Nijamudeen Mohamed Sulaiman [Syncfusion]
Replied On November 30, 2015 05:32 AM

Hi Derrick,


Thanks for your interest in Syncfusion products.


We have created a separate incidents for this query, please login to below location to have follow up regarding this query.


Linkhttps://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents


Please let us know if you have any concern.


Regards,

Nijamudeen M.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;