Results 1 to 4 of 4

Thread: Help with creating a pie chart - Resolved

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Location
    UK
    Posts
    93

    Resolved Help with creating a pie chart - Resolved

    Hiya

    I have a program that creates a circle currently andcan make this a fulll circle by adjusting some scroll bars. I have a width, radius, startt and end scroll bar. When reducing the end scroll, this fills the circle with colour.... but I need to be able to change this into a pie chart and wondered if anyone can help me. This is what I have and I need to add a pie chart of A at 60 degrees (value 1), B at 120 degrees (value 2) and C at 180 degrees ()value 3.

    I think I need to add A, B & C as variables but not sure the best way to go abount it. Under the Aend change - can I add this as a if then statement or should I be doing something similar to the end and have the 3 a, b and c set up in a similar way

    This is using VB6.


    Option Explicit
    Dim X As Integer
    Dim Y As Integer
    Dim AStart As Integer
    Dim AEnd As Integer
    Dim Radius As Integer
    Dim Aspect As Single
    Const pi = 3.14159265
    Dim Value As Integer


    Private Sub cmdClose_Click()
    'to end the program
    End
    End Sub

    Private Sub cmdStyle_Click()
    'change the Drawstyle property setting of the picture control(0 to 6)
    picView.DrawStyle = (picView.DrawStyle + 1) Mod 7
    picView.Cls 'redraw the circle
    picView.Circle (X, Y), vbBlack, AStart, AEnd, Aspect
    End Sub

    Private Sub Form_Load()
    Show 'Force the form to be made visiable
    'otherwise the circle will not be drawn


    Initalise ' To establish the start up values
    End Sub

    Sub Initalise()
    X = picView.ScaleWidth / 2 'The circle of the circle
    Y = picView.ScaleHeight / 2
    Radius = hsbRadius.Value * 20 'scale up the scroll bar
    Aspect = hsbAspect.Value / 10 ' Scale down the scroll bar
    AStart = hsbStart.Value / 360 * 2 * pi 'convert to radians
    AEnd = hsbEnd.Value / 360 * 2 * pi ' convert to radians
    picView.Circle (X, Y), Radius, vbBlack, AStart, AEnd, Aspect
    End Sub

    Private Sub hsbAspect_Change()
    Aspect = hsbAspect.Value / 10 'Change the aspect value
    txtAspect.Text = Aspect 'update the textbox

    picView.Cls 'redraw the circle
    picView.Circle (X, Y), Radius, vbBlack, AStart, AEnd, Aspect
    End Sub

    Private Sub hsbEnd_Change()
    AEnd = hsbEnd.Value / 360 * 2 * pi 'Change the end angle value
    txtEnd.Text = hsbEnd.Value 'update the textbox
    picView.FillColor = vbBlue
    picView.FillStyle = 0
    picView.Cls 'redraw the circle
    picView.Circle (X, Y), Radius, vbBlack, -AStart, -AEnd, Aspect


    End Sub

    Private Sub hsbRadius_Change()
    Radius = hsbRadius.Value * 20 'Change the radius value
    txtRadius.Text = Radius 'update the textbox

    picView.Cls 'redraw the circle
    picView.Circle (X, Y), Radius, vbBlack, AStart, AEnd, Aspect
    End Sub

    Private Sub hsbStart_Change()
    AStart = hsbStart.Value / 360 * 2 * pi 'Change the start angle value
    txtStart.Text = hsbStart.Value 'update the textbox

    picView.Cls 'redraw the circle
    picView.Circle (X, Y), Radius, vbBlack, AStart, AEnd, Aspect
    End Sub


    Private Sub hsbAspect_Scroll()
    hsbAspect_Change
    End Sub

    Private Sub hsbWidth_Change()
    picView.DrawWidth = hsbWidth.Value 'Change the width of the line
    txtWidth.Text = picView.DrawWidth 'update the textbox

    picView.Cls 'redraw the circle
    picView.Circle (X, Y), Radius, vbBlack, AStart, AEnd, Aspect
    End Sub

    Thanks

    Tracey
    Last edited by Tazmania; Apr 29th, 2006 at 11:28 AM. Reason: Resolved

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