Articles in this section
Category / Section

How to customize a circular gauge control as a TimeLine gauge?

2 mins read

This article explains the steps required to design a custom timeline render. The marker pointer has been customized as image to indicate the time line value. Header is used for displaying the updated value.

Circular gauge control can be customized as follows:


  1. Create a Xamarin application and initialize SfCircularGauge control on it.



<gauge:SfCircularGauge BackgroundColor="#50707A" x:Name="circulargauge">
     <gauge:Scale StartAngle="270" StartValue="0" EndValue="100" Interval="10"     SweepAngle="360" ScaleStartOffset="0.85" ScaleEndOffset="0.8"                                 RimColor="#042F3F" MinorTicksPerInterval="0" ShowLabels="false" ShowTicks="false">


  1. Ranges can be used to know the dim value of weather data.



     <gauge:Range StartValue="5" EndValue="35" OuterStartOffset="0.85" InnerStartOffset="0.8" OuterEndOffset="0.85" InnerEndOffset="0.8"  Color="#94C93D">


  1. Pointers can be used to set images in gauges as per the values. Images can be touched and moved to the respective position.


   <gauge:MarkerPointer MarkerShape="Image"  Value="4" ImageSource="image1.png" MarkerWidth="60" MarkerHeight="60" >        <gauge:MarkerPointer.Offset>
  <OnPlatform x:TypeArguments="x:Double" iOS="0.92" Android="0.95" />  </gauge:MarkerPointer.Offset>
  <gauge:MarkerPointer MarkerShape="Image"  Value="30" ImageSource="image2.png" MarkerWidth="60" MarkerHeight="60" >
       <OnPlatform x:TypeArguments="x:Double" iOS="0.9" Android="0.95" />
   <gauge:MarkerPointer MarkerShape="Image"  Value="70" ImageSource="image3.png" MarkerWidth="60" MarkerHeight="60">
      <OnPlatform x:TypeArguments="x:Double" iOS="0.9" Android="0.95" />


  1. Add Headers to know the weather dim value. By using the header, position can be altered as required.


   <gauge:Header Text="DIM" TextSize="30" ForegroundColor="White" Position="0.5,0.45"/>
   <gauge:Header x:Name="weatherData" TextSize="25" ForegroundColor="White" Position="0.5,0.56"/>
   <gauge:Header Text="78d" TextSize="25" ForegroundColor="White" Position="0.9,0.2"/>
   <gauge:Header Text="1d" TextSize="25" ForegroundColor="White" Position="0.9,0.75"/>


  1. In code behind, weather dim values can be updated dynamically.


public partial class CircularTimelinePage : ContentPage
        Random random = new Random();
        public CircularTimelinePage()
            this.BindingContext = this;
            Device.StartTimer(new TimeSpan(0, 0, 0, 0, 1000), TimerElapsed);
        private bool TimerElapsed()
            Device.BeginInvokeOnMainThread(() =>
                Random s = new Random();
                int random = s.Next(0, 100);
                weatherData.Text = "Dim:" + random;
            return true;



The following screenshot illustrates the custom timeline render gauge. 


Customize SfCircularGauge control as TimeLine gauge

Please find the complete sample for the above document in the link.


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied