locked
show my value in progress RRS feed

  • Question

  • User66371569 posted

    I have select statement

    select count(*) from emp   

    select count(*) from emp where status='Approved' 

    I Want to show values in 2 ciricle progress  showing value in one and  parentage in another one

    circle progress almost looks like this link

    https://bootsnipp.com/snippets/nrDmZ

    Monday, February 11, 2019 11:24 AM

All replies

  • User753101303 posted

    Hi,

    Seems you have all the building blocks. If the problem is reading those values you could use https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlcommand.executescalar?view=netframework-4.7.2

    Or the problem is with understanding the drawing ? Aother option could be to use SVG : https://medium.com/@pppped/how-to-code-a-responsive-circular-percentage-chart-with-svg-and-css-3632f8cd7705

    When posting about a problem always try to be explicit so that we can understand on which point exactly you have a problem (or you need realyl a full demo ?)

    Monday, February 11, 2019 12:11 PM
  • User66371569 posted

    But how can I  relate  value with  circle progress

    Monday, February 11, 2019 12:16 PM
  • User36583972 posted


    Hi thepast,

     

    But how can I  relate  value with  circle progress

    You can extract the value data through a Web API. Or you can add a timer to extract value timely.

    You can refer the following sample.

    Create Circular Progress Bar Dynamically In ASP.NET
    https://www.c-sharpcorner.com/blogs/create-circular-progress-bar-dynamically-in-asp-net

    Best Regards,

    Yong Lu

    Tuesday, February 12, 2019 6:13 AM
  • User66371569 posted

    I will  put my select query value in textbox  then    I want  circle progress read this value from textbox

    how can I do that

    Tuesday, February 12, 2019 8:15 AM
  • User36583972 posted

    Hi thepast,

    I will  put my select query value in textbox  then    I want  circle progress read this value from textbox

    how can I do that

    When you extract the query value and put it in the textbox, you can calculate the percentage value and bring it in the show circle progress method.

         Dim percent As Integer
    		percent = Convert.ToInt32(TextBox1.Text.Trim())
    		CalculateActiveAngle(percent)

    Best Regards,

    Yong Lu

    Tuesday, February 12, 2019 8:47 AM
  • User66371569 posted

    sorry  but I don't get it

    and tried to use same example in link you sent   but  I couldn't success  a lot of errors appears      I am suing  visual studio 2012   vb.net code

    Tuesday, February 12, 2019 9:24 AM
  • User66371569 posted

    still I get error in code behind I convert code from c# to vb  and paste it in my page

    Tuesday, February 12, 2019 10:13 AM
  • User66371569 posted
    Private val1 As String = "90deg"
    
        Public Property Val1 As String
            Get
                Return val1
            End Get
            Set(ByVal value As String)
                val1 = value
            End Set
        End Property
    
    
        Private val2 As String = "90deg"
    
        Public Property Val2 As String
            Get
                Return val2
            End Get
            Set(ByVal value As String)
                val2 = value
            End Set
        End Property
    
        Private colorCode As String = "#ffffff"
    
        Public Property ColorCode As String
            Get
                Return colorCode
            End Get
            Set(ByVal value As String)
                colorCode = value
            End Set
        End Property
    
    
    
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
            ProgressText.InnerText = "0%"
            CalculateActiveUsersAngle(75)
        End Sub
    
        Private Sub CalculateActiveUsersAngle(ByVal TotalUser As Integer)
            If TotalUser = 0 Then
                val2 = "90deg"
                val1 = "90deg"
                ColorCode = "#ffffff"
            ElseIf TotalUser < 50 AndAlso TotalUser > 0 Then
                Dim percentageOfWholeAngle As Double = 360 * (Convert.ToDouble(TotalUser) / 100)
                val2 = (90 + percentageOfWholeAngle).ToString() & "deg"
                val1 = "90deg"
                ColorCode = "#ffffff"
            ElseIf TotalUser > 50 AndAlso TotalUser < 100 Then
                Dim percentage As Double = 360 * (Convert.ToDouble(TotalUser) / 100)
                val1 = (percentage - 270).ToString() & "deg"
                val2 = "270deg"
                ColorCode = "#AC2D36"
            ElseIf TotalUser = 50 Then
                val1 = "-90deg"
                val2 = "270deg"
                ColorCode = "#AC2D36"
            ElseIf TotalUser >= 100 Then
                val1 = "90deg"
                val2 = "270deg"
                ColorCode = "#AC2D36"
            End If
    
            ProgressText.InnerText = TotalUser & "%"
        End Sub
    
        Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Dim percent As Integer
            percent = Convert.ToInt32(TextBox1.Text.Trim())
            CalculateActiveUsersAngle(percent)
        End Sub

    Tuesday, February 12, 2019 10:23 AM
  • User36583972 posted


    Hi thepast,

    thepast

    still I get error in code behind I convert code from c# to vb  and paste it in my page

       Private _val1 As String = "90deg"
    
    	Public Property Val1 As String
    		Get
    			Return _val1
    		End Get
    		Set(ByVal value As String)
    			_val1 = value
    		End Set
    	End Property
    
    	Private _val2 As String = "90deg"
    
    	Public Property Val2 As String
    		Get
    			Return _val2
    		End Get
    		Set(ByVal value As String)
    			_val2 = value
    		End Set
    	End Property
    
    	Private _colorCode As String = "#ffffff"
    
    	Public Property ColorCode As String
    		Get
    			Return _colorCode
    		End Get
    		Set(ByVal value As String)
    			_colorCode = value
    		End Set
    	End Property
    
    
    	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    		ProgressText.InnerText = "0%"
    	End Sub
    
    
    	Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    		Dim percent As Integer
    		percent = Convert.ToInt32(TextBox1.Text.Trim())
    		CalculateActiveUsersAngle(percent)
    
    	End Sub
    
    	Private Sub CalculateActiveUsersAngle(ByVal TotalUser As Integer)
    		If TotalUser = 0 Then
    			Val2 = "90deg"
    			Val1 = "90deg"
    			ColorCode = "#ffffff"
    		ElseIf TotalUser < 50 AndAlso TotalUser > 0 Then
    			Dim percentageOfWholeAngle As Double = 360 * (Convert.ToDouble(TotalUser) / 100)
    			Val2 = (90 + percentageOfWholeAngle).ToString() & "deg"
    			Val1 = "90deg"
    			ColorCode = "#ffffff"
    		ElseIf TotalUser > 50 AndAlso TotalUser < 100 Then
    			Dim percentage As Double = 360 * (Convert.ToDouble(TotalUser) / 100)
    			Val1 = (percentage - 270).ToString() & "deg"
    			Val2 = "270deg"
    			ColorCode = "#AC2D36"
    		ElseIf TotalUser = 50 Then
    			Val1 = "-90deg"
    			Val2 = "270deg"
    			ColorCode = "#AC2D36"
    		ElseIf TotalUser >= 100 Then
    			Val1 = "90deg"
    			Val2 = "270deg"
    			ColorCode = "#AC2D36"
    		End If
    
    		ProgressText.InnerText = TotalUser & "%"
    	End Sub

    Besides, It would be appreciated if you could close the thread by marking helpful posts as an answer. If you have a new question you can start a new thread with all necessary code snippets for anyone else to be able to reproduce your issue from scratch along with a detailed description about the results including any exception messages.

    Best Regards,

    Yong Lu

    Wednesday, February 13, 2019 1:18 AM