Articles in this section

How to get data for circular gauge from database using ASP.NET Web Forms?

You can retrieve the value from the stored procedure and assign it to the pointer value of the circular gauge. You can initialize all the properties from the code behind.

Step 1: Create a simple circular gauge with some ranges in code behind.

   Code behind:

            CircularScales scale1 = new CircularScales();

            List<Pointers> pointers = new List<Pointers>();

            Pointers pointer1 = new Pointers();

            pointer1.Value = 0;

            scale1.Pointers.Add(pointer1);

            scale1.ShowRanges = true;

            scale1.ShowScaleBar = true;

 

            this.CircularGauge.Scales.Add(scale1);

            this.CircularGauge.BackgroundColor = "transparent";

            this.CircularGauge.EnableAnimation = true;

 

      aspx page:

               <ej:CircularGauge ClientIDMode="Static" runat="server" ID="CircularGauge">       

        </ej:CircularGauge>

 

Step 2: Initialize the data fetched from the stored procedure.

           String strConnString =  ConfigurationManager

                 .ConnectionStrings["DefaultConnection1"].ConnectionString;

            SqlDataReader rt;

            SqlConnection con;

            SqlCommand cmd = new SqlCommand();

            con = new SqlConnection(strConnString);

 

            cmd.CommandType = CommandType.StoredProcedure;

            //stored procedure command execution

            cmd.CommandText = "GetPointerDetails";

            cmd.Connection = con;

            con.Open();

 

            // read the returned result form the procedure

            rt = cmd.ExecuteReader();

            if (rt.Read())

            {

                this.CircularGauge.Scales[0].Pointers[0].Value = Convert

                            .ToDouble(rt.GetValue(0));

            }       

            con.Close();

            con.Dispose();

 

The following screenshot illustrates the result of fetching data from the stored procedure and initializing all the properties from code behind.

Circular gauge with ranges and pointers

 

Sample Link: https://github.com/SyncfusionExamples/How-to-get-data-for-circular-gauge-from-database

 

Note:

A new version of Essential Studio for ASP.NET is available. Versions prior to the release of Essential Studio 2014, Volume 2 will now be referred to as a classic versions. The new ASP.NET suite is powered by Essential Studio for JavaScript providing client-side rendering of HTML 5-JavaScript controls, offering better performance, and better support for touch interactivity. The new version includes all the features of the old version, so migration is easy.

The Classic controls can be used in existing projects; however, if you are starting a new project, we recommend using the latest version of Essential Studio for ASP.NET. Although Syncfusion will continue to support all Classic Versions, we are happy to assist you in migrating to the newest edition.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls. If you have any queries or require clarifications, please let us know in the comments section below.

You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied