Change Orientation

3 Sep 20201 minute to read

SfLinearGauge supports horizontal and vertical orientations. By default, SfLinearGauge is rendered with horizontal orientation. You can the change the orientation by using the Orientation property.

  • C#
  • SfLinearGauge linearGauge = new SfLinearGauge(this);
                linearGauge.SetBackgroundColor(Color.White);
                linearGauge.SetOrientation(SfLinearGauge.Orientation.Vertical);
                LinearScale linearScale = new LinearScale();
                linearScale.Interval = 10;
                linearScale.ScaleBarLength = 350;
                linearScale.ScaleBarColor = Color.ParseColor("#e0e0e0");
                linearScale.LabelColor = Color.ParseColor("#424242");
                linearScale.MajorTickSettings.StrokeWidth = 1;
                linearScale.MinorTickSettings.StrokeWidth = 1;
                linearScale.MajorTickSettings.Length = 20;
                linearScale.MajorTickSettings.Color = Color.Gray;
                linearScale.MinorTickSettings.Color = Color.Gray;
                linearScale.MinorTickSettings.Length = 10;
                linearGauge.Scales.Add(linearScale);