CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2001
    Posts
    7

    how to generate pie chart

    hi, I have a easy question need ur help.

    I have a txt file which has two field, one is handset model (for example "Erisson T18"), another is test fault code(pure integer number- like 12-- which stands for different fault reason). I need read this file and then generate a pie chart for the fault codes in a certain handset.

    Any suggestion how to do it?

    BTW, I am a VB learner, please show me in detail.

    Many thanks [email protected]



  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: how to generate pie chart

    Option Explicit

    Private Const PI As Double = 3.14159265359
    Private Const CircleEnd As Double = -2 * PI

    Public Sub DrawPiePiece(lColor As Long, fStart As Double, fEnd As Double)
    Dim dStart As Double
    Dim dEnd As Double

    Picture1.FillColor = lColor
    Picture1.FillStyle = 0
    dStart = fStart * (CircleEnd / 100)
    dEnd = fEnd * (CircleEnd / 100)
    Picture1.Circle (100, 100), 60, , dStart, dEnd
    End Sub

    Private Sub Command1_Click()
    Picture1.ScaleMode = vbPixels
    Call DrawPiePiece(QBColor(1), 0.001, 36)
    Call DrawPiePiece(QBColor(2), 36, 55)
    Call DrawPiePiece(QBColor(3), 55, 75)
    Call DrawPiePiece(QBColor(4), 75, 99.999)
    End Sub


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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

Featured