Set label position in C#

2 posts, 0 answers
  1. Henry
    Henry avatar
    44 posts
    Member since:
    Feb 2013

    Posted 31 Jul 2013 Link to this post


    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?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 31 Jul 2013 Link to this post

    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.

    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;

Back to Top