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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to apply gradient color for ranges in Xamarin.Forms SfCircularGauge

Platform: Xamarin.Forms |
Control: SfCircularGauge |
Published Date: June 3, 2019 |
Last Revised Date: June 3, 2019

SfCircularGauge contains a collection of scales, and each scale contains sub elements such as ranges, pointers, and labels.

Ranges contain a collection of range elements, and each range begins and ends at the specified values within a scale. You can apply the gradient color to a range element using the GradientStops property to give smooth color transition. 

The following code sample demonstrates how to apply the gradient color to a range element in circular gauge.

XAML

 
<gauge:Scale.Ranges>
    <gauge:Range EndValue="100" Offset="1">
        <gauge:Range.GradientStops>
            <gauge:GaugeGradientStop Color="Yellow" Value="0"/>
            <gauge:GaugeGradientStop Color="Red" Value="50"/>
            <gauge:GaugeGradientStop Color="Blue" Value="100"/>
        </gauge:Range.GradientStops>
    </gauge:Range>
</gauge:Scale.Ranges>
 

 

C#

 
Scale scale = new Scale();
Range range = new Range();
range.EndValue = 100;
range.Offset = 1;
range.GradientStops = new ObservableCollection<GaugeGradientStop>()
{
    new GaugeGradientStop(){Color= Color.Yellow,  Value = 0},
    new GaugeGradientStop(){Color= Color.Red,  Value = 50},
    new GaugeGradientStop(){Color= Color.Blue,  Value = 100},
};
 
scale.Ranges.Add(range);
 

 

Output

 

Xamarin.Forms SfCircularGauge Gradient Range

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon 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.Close Icon

Live Chat Icon For mobile