This is a migrated thread and some comments may be shown as answers.

Set label position in C#

1 Answer 167 Views
Gauge
This is a migrated thread and some comments may be shown as answers.
Henry
Top achievements
Rank 1
Henry asked on 31 Jul 2013, 08:48 AM
Hi

I created a radial gauge in C# and added all the scales and label. But I cant find a way to set the label position. So can anyone help me with code to do this?

Thanks
Henry

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 31 Jul 2013, 09:15 AM
Hi Henry,

The Scale Label position can be set using the Telerik.Web.UI.Gauge.ScaleLabelsPosition class. Please have a look into the following C# code I tried to set the label position.

C#:
protected void Page_Load(object sender, EventArgs e)
{
    RadRadialGauge radialGauge = new RadRadialGauge();
    radialGauge.ID = "radialGauge1";
    radialGauge.Width = Unit.Pixel(300);
    radialGauge.Height = Unit.Pixel(300);
 
    //Set Pointer properties
    radialGauge.Pointer.Value = (decimal)1.15;
    radialGauge.Pointer.Cap.Size = (float)0.05;
    radialGauge.Pointer.Cap.Color = System.Drawing.Color.Red;
    radialGauge.Pointer.Color = System.Drawing.Color.Orange;
 
    //Set Min and Max values of the Scale
    radialGauge.Scale.Min = 0;
 
    //In order the Max value to be displayed it should be multiple of the MajorUnit
    radialGauge.Scale.Max = (decimal)1.2;
    radialGauge.Scale.MajorUnit = (decimal)0.2;
    radialGauge.Scale.MinorUnit = (decimal)0.1;
 
    //Set Minor and Major Ticks properties
    radialGauge.Scale.MinorTicks.Size = 10;
    radialGauge.Scale.MinorTicks.Color = System.Drawing.Color.Blue;
    radialGauge.Scale.MajorTicks.Size = 10;
    radialGauge.Scale.MajorTicks.Color = System.Drawing.Color.Black;
 
    //Set Scale Labels properties
    radialGauge.Scale.Labels.Visible = true;
    radialGauge.Scale.Labels.Font = "15px Arial,Helvetica,sans-serif";
    radialGauge.Scale.Labels.Color = System.Drawing.Color.Black;
    radialGauge.Scale.Labels.Format = "P0";
    radialGauge.Scale.Labels.Position = Telerik.Web.UI.Gauge.ScaleLabelsPosition.Outside;
    this.form1.Controls.Add(radialGauge);
}

Thanks,
Shinu.
Tags
Gauge
Asked by
Henry
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or