Can a Scale be hidden at runtime?

I have a compass on my app, I want to give the user the option to choose between Degrees, and Mils. I suppose in a pinch I could create and hide two different compasses using a stack layout and set its visibility setting based on the users selection. But it would be nice if there simply were a IsVisible option for the scale, I could toggle that.

I'm not sure if there is a better or more elegant solution.

Thanks!
Jesse


7 Replies 1 reply marked as answer

SS Sridevi Sivakumar Syncfusion Team January 5, 2021 12:29 PM UTC

Hi Jesse Knott,

Greetings from Syncfusion.

We have checked the reported query and we would like to inform you that we don't have visibility change support in SfCircularGauge scale. So, we have achieved your requirement by using below solutions.

Solution 1:

We have achieved your requirement by adding two gauges and changed the visibility of the gauge depending on the selection.

Sample link: https://www.syncfusion.com/downloads/support/forum/161112/ze/GaugeSample_11065187609

Code snippet:
C#:
 
            if (picker.SelectedIndex == 0) 
            { 
                degreeGauge.IsVisible = true; 
                mileGauge.IsVisible = false; 
            } 
            else 
            { 
                degreeGauge.IsVisible = false; 
                mileGauge.IsVisible = true; 
            } 

Note: In the above sample, the needle is rendered in the wrong position, we have considered this bug internally and it will be included in our upcoming weekly NuGet which is expected to be rolled out on January 12, 2021.

Solution 2: 

We can able to change the scale StartAngle and SweepAngle value dynamically based on the selection. Please have a sample from the below link

Sample link: https://www.syncfusion.com/downloads/support/forum/161112/ze/GaugeSample_21201207457

Code snippet:
C#:

 
    if (picker.SelectedIndex == 0)
   
       scale.StartAngle = 0; 
        scale.SweepAngle = 360; 
        scale.StartValue = 0; 
        scale.EndValue = 360; 
        scale.Interval = 90; 
   
    else 
   
        scale.StartAngle = 130; 
        scale.SweepAngle = 280; 
        scale.StartValue = 0; 
        scale.EndValue = 100; 
        scale.Interval = 10; 
   
 

Solution 3:

We can change the scale dynamically by clearing current scale and adding new scale to the scale collection as per the below code snippet.

Code snippet:
C#:
 
                if (circularGauge.Scales.Count > 0) 
                { 
                    circularGauge.Scales.Clear(); 
                } 
  
                circularGauge.Scales.Add(scale); 
  
For more information about the scale,
https://help.syncfusion.com/xamarin/circular-gauge/scales#scale


Regards,
Sridevi S.
 
 



SS Sridevi Sivakumar Syncfusion Team January 12, 2021 12:09 PM UTC

Hi Jesse Knott,

Sorry for the inconvenience caused.

Due to having some pending test cases to ensure that fix, Hence, we are unable to move this fix in our today(Jan 12, 2021) weekly NuGet.

We will complete all the test cases and move this fix in our upcoming weekly NuGet release which is expected to be rolled out by January 19, 2021.

Regards,
Sridevi S. 



JK Jesse Knott January 12, 2021 04:05 PM UTC

Excellent! Thanks! I'll give those a look when I can, another area of code has become more pressing. Thanks!
I look forward to implementing the recommended code!

Cheers!


SS Sridevi Sivakumar Syncfusion Team January 13, 2021 06:35 AM UTC

Hi Jesse Knott, 

Thanks for your update.


As promised earlier we will include the fix in our upcoming weekly NuGet, and it will be rolled out by January 19, 2021.


Please let us know if you need any further assistance.


Regards,
Sridevi S.
 



ET Eswaran Thirugnanasambandam Syncfusion Team January 19, 2021 04:16 PM UTC

Hi Jesse Knott, 
 
Thanks for your patience, 
 
We have moved the fix to the latest weekly NuGet (18.4.0.35).  
 
Regards, 
Eswaran 


Marked as answer

JK Jesse Knott January 19, 2021 05:27 PM UTC

Excellent! Thanks!


SS Sridevi Sivakumar Syncfusion Team January 20, 2021 06:13 AM UTC

Hi Jesse Knott,

Thanks for your update.


Let us know if you need any further assistance.

Regards,
Sridevi S, 


Loader.
Up arrow icon