Labels

The SFCircularScale labels associate a numeric value with major scale tick marks.

Label color customization

The label color can be changed using the LabelColor property.

  • c#
  • SFCircularGauge circularGauge = new SFCircularGauge();
                ObservableCollection<SFCircularScale> scales = new ObservableCollection<SFCircularScale>();
                SFCircularScale scale = new SFCircularScale();
                scale.StartValue = 0;
                scale.EndValue = 100;
                scale.LabelColor = UIColor.Blue;
                scales.Add(scale);
                circularGauge.Scales = scales;
                this.View.AddSubview(circularGauge);

    Label font customization

    The label font can be customized by using the LabelFont property.

  • c#
  • SFCircularGauge circularGauge = new SFCircularGauge();
                ObservableCollection<SFCircularScale> scales = new ObservableCollection<SFCircularScale>();
                SFCircularScale scale = new SFCircularScale();
                scale.StartValue = 0;
                scale.EndValue = 100;
                scale.LabelFont = UIFont.FromName("Chalkduster", 20f);
                scales.Add(scale);
                circularGauge.Scales = scales; 
                this.View.AddSubview(circularGauge);

    Setting position for labels

    The labels can be positioned far away from the ticks by using the LabelOffset property.

  • c#
  • SFCircularGauge circularGauge = new SFCircularGauge();
                ObservableCollection<SFCircularScale> scales = new ObservableCollection<SFCircularScale>();
                SFCircularScale scale = new SFCircularScale();
                scale.StartValue = 0;
                scale.EndValue = 100;
                scale.LabelOffset = 0.4f;
                scales.Add(scale);
                circularGauge.Scales = scales;
                this.View.AddSubview(circularGauge);

    Setting number of decimal digits for labels

    The NumberOfDecimalDigits property is used to set the number of decimal digits to be displayed in the scale labels.

  • c#
  • SFCircularGauge circularGauge = new SFCircularGauge();
                ObservableCollection<SFCircularScale> scales = new ObservableCollection<SFCircularScale>();
                SFCircularScale scale = new SFCircularScale();
                scale.StartValue = 0;
                scale.EndValue = 100;
                scale.NumberOfDecimalDigits = 3;
                scales.Add(scale);
                circularGauge.Scales = scales;
                this.View.AddSubview(circularGauge);

    Setting postfix and prefix for labels

    You can postfix/prefix values to the scale labels by using the LabelPostfix and LabelPrefix properties, respectively.

    Label postfix

    LabelPostfix property allows you to postfix the values to the scale labels.

  • c#
  • SFCircularGauge circularGauge = new SFCircularGauge();
                ObservableCollection<SFCircularScale> scales = new ObservableCollection<SFCircularScale>();
                SFCircularScale scale = new SFCircularScale();
                scale.StartValue = 0;
                scale.EndValue = 100;
                scale.LabelPostfix = "$";
                scales.Add(scale);
                circularGauge.Scales = scales;
                this.View.AddSubview(circularGauge);

    Label prefix

    LabelPrefix property allows you to prefix the values to the scale labels.

  • c#
  • SFCircularGauge circularGauge = new SFCircularGauge();
                ObservableCollection<SFCircularScale> scales = new ObservableCollection<SFCircularScale>();
                SFCircularScale scale = new SFCircularScale();
                scale.StartValue = 0;
                scale.EndValue = 100;
                scale.LabelPrefix = "$";
                scales.Add(scale);
                circularGauge.Scales = scales;
                this.View.AddSubview(circularGauge);

    Edge label customization

    You can customize the edge label by using the ShowFirstLabel and ShowLastLabel properties, which are Boolean properties. The ShowFirstLabel property is used to enable or disable first label, and the ShowLastLabel property is used to enable or disable the last label in circular gauge.

  • c#
  • SFCircularGauge circularGauge = new SFCircularGauge();
                ObservableCollection<SFCircularScale> scales = new ObservableCollection<SFCircularScale>();
                SFCircularScale scale = new SFCircularScale();
                scale.StartValue = 0;
                scale.Interval = 1;
                scale.MinorTicksPerInterval = 5;
                scale.EndValue = 12;
                scale.StartAngle = -180;
                scale.SweepAngle = 180;
                scale.ShowFirstLabel = false;
                scales.Add(scale);
                circularGauge.Scales = scales;
                this.View.AddSubview(circularGauge);

    Show labels

    The ShowLabels property is a Boolean property, which is used to enable or disable the labels in circular gauge.

  • c#
  • SFCircularGauge circularGauge = new SFCircularGauge();
                ObservableCollection<SFCircularScale> scales = new ObservableCollection<SFCircularScale>();
                SFCircularScale scale = new SFCircularScale();
                scale.StartValue = 0;
                scale.EndValue = 100;
                scale.ShowLabels = false;
                scales.Add(scale);
                circularGauge.Scales = scales;
                this.View.AddSubview(circularGauge);

    Setting auto angle for label

    Scale labels can be rotated automatically based on the current angle. To enable or disable the auto angle, use the EnableAutoAngle property.

  • c#
  • SfCircularGauge circularGauge = new SfCircularGauge(this);
                ObservableCollection<CircularScale> scales = new ObservableCollection<CircularScale>();
                CircularScale scale = new CircularScale();
                scale.StartValue = 0;
                scale.EndValue = 100;
                scale.EnableAutoAngle = true;
                scales.Add(scale);
                circularGauge.CircularScales = scales;