Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Pie Chart and VB

Posted on 2003-11-13
4
Medium Priority
?
313 Views
Last Modified: 2010-05-01

Hi All,

Is anyone of you have any good example of drawing pie chart in VB? The pie chart would have different color for each category and hence the legend to describe the category.

Looking forward to your answer!

Sean
0
Comment
Question by:whsean
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 11

Accepted Solution

by:
bingie earned 800 total points
ID: 9744676
Hi,

Here is an example on using the MS Chart Control.

http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q275649&ID=KB;EN-US;Q275649&sd=msdn&

*********************************************************

Here is a basic pie chart you can make using a picture box:


Just Load this code in to a new VB application, and make a new picture box that is a sqare.

Private Sub Form_Load()

Dim Total As Single
Dim ken As Single
Dim bill As Single
Dim fred As Single

bill = 6000
ken = 10000
fred = 7000

Total = bill + ken + fred

bill = bill / Total * 2 * 3.145926
ken = (ken + bill) / Total * 2 * 3.145926
fred = (ken + bill + fred) / Total * 2 * 3.145926


Picture1.Scale (-5, 5)-(5, -5)
Picture1.Circle (0, 0), 4
Picture1.Line (0, 0)-(4, 0)
Picture1.Line (0, 0)-(4 * Cos(bill), 4 * Sin(bill))
Picture1.Line (0, 0)-(4 * Cos(ken), 4 * Sin(ken))

End Sub

(thx to Jacamar for this)

***********************************************************

You can also see these links:

http:Q_20129610.html

http:Q_20372863.html
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 10548262
Moderator, my recommended disposition is:

    Accept bingie's comment(s) as an answer.

Dan Rollins -- EE database cleanup volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question