Results 1 to 1 of 1

Thread: pie graphs need help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2005
    Posts
    19

    pie graphs need help

    i have asked before and got no help but now have nearly got this one just needs tweeking hope somone can help this time.
    the problem i have is this pie chart it gives me some of the information but not where i want it its the startB= endA + startB bits i'm having trouble with.
    in the pie chart button. i am using vb6
    VB Code:
    1. Dim x, y As Integer
    2.     Dim Astart, Aend, Radius, ProdA, ProdB, ProdC As Integer
    3.     Dim Aspect As Single
    4.     Const pi = 3.14159265
    5.     Dim StartA As Single
    6.     Dim EndA As Single
    7.     Dim StartB As Single
    8.     Dim EndB As Single
    9.     Dim StartC As Single
    10.     Dim EndC As Single
    11.    
    12. Private Sub cmdClose_Click()
    13.     End                 'ends program
    14. End Sub
    15.  
    16. Private Sub cmdPie_Click()
    17.     StartA = Astart - 0.001
    18.     EndA = 60 * pi / 180
    19.     picView.FillColor = vbBlue
    20.     Debug.Print
    21.     picView.Circle (x, y), Radius, vbBlack, -StartA, -EndA, Aspect
    22.      StartB = EndA + StartA
    23.     EndB = 120 * pi / 180
    24.        're-draw the circle
    25.     picView.FillColor = vbRed
    26.     Debug.Print
    27.     picView.Circle (x, y), Radius, vbBlack, -StartB, -EndB, Aspect
    28.     StartC = EndB + StartB
    29.     EndC = 180 * pi / 180
    30.     picView.FillColor = vbYellow
    31.         're-draw the circle
    32.     picView.Circle (x, y), Radius, vbBlack, -StartC, -EndC, Aspect
    33.     Debug.Print
    34. End Sub
    35.  
    36. Private Sub cmdStyle_Click()
    37.     'change the drawstyle property setting of the picture control(0-6)
    38.     picView.DrawStyle = (picView.DrawStyle + 1) Mod 7
    39.     picView.Cls     're-draw the circle
    40.     picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
    41. End Sub
    42.  
    43.  
    44.  
    45. Private Sub Form_Load()
    46.     Show            'force the form to be made visable
    47.                     'otherwise the circle will not be drawn
    48.     Initialise      'to establish the start up values
    49. End Sub
    50. Sub Initialise()
    51.     x = picView.ScaleWidth / 2 'the center of the circle
    52.     y = picView.ScaleHeight / 2
    53.     Radius = hsbRadius.Value * 20 'scaleup the scroll bar value
    54.     Aspect = hsbAspect.Value / 10   'scale down the scollbar value
    55.     Astart = hsbStart.Value / 360 * 2 * pi 'convert to radians
    56.     Aend = hsbEnd.Value / 360 * 2 * pi 'covert to radians
    57.     picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
    58. End Sub
    59.  
    60. Private Sub hsbAspect_Change()
    61.     Aspect = hsbAspect.Value / 10   'change the aspect value
    62.     txtAspect.Text = Aspect         'update the textbox
    63.    
    64.     picView.Cls                     're-draw the circle
    65.     picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
    66. End Sub
    67.  
    68. Private Sub hsbEnd_Change()
    69.     Aend = hsbEnd.Value / 360 * 2 * pi 'change the end angle value
    70.    
    71.     picView.FillColor = vbBlue
    72.     txtEnd.Text = hsbEnd.Value          'update the text box
    73.     'picView.FillColor = vbRed           'fills the colour red for pie chart
    74.     picView.FillStyle = 0
    75.     picView.Cls                         're-draw the circle
    76.    
    77.     picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
    78.    
    79. End Sub
    80.  
    81.  
    82.  
    83.  
    84. Private Sub hsbRadius_Change()
    85.     Radius = hsbRadius.Value * 20   'change the radius value
    86.     txtRadius.Text = Radius         'update the textbox
    87.    
    88.     picView.Cls                     're-draw the circle
    89.     picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
    90. End Sub
    91.  
    92. Private Sub hsbStart_Change()
    93.     Astart = hsbStart.Value / 360 * 2 * pi ' change the start angle value
    94.     txtStart.Text = hsbStart.Value - 0.09 ' update the textbox
    95.    
    96.     picView.Cls                 're-draw the circle
    97.     picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
    98. End Sub
    99.  
    100. Private Sub hsbWidth_Change()
    101.     picView.DrawWidth = hsbWidth.Value  'change the width of the line
    102.     txtWidth.Text = picView.DrawWidth   'update the textbox
    103.    
    104.     picView.Cls         're-draw the circle
    105.     picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
    106. End Sub
    Last edited by kkman; Apr 25th, 2006 at 09:50 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width