Solved

Pie Chart and VB

Posted on 2003-11-13
4
295 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
4 Comments
 
LVL 11

Accepted Solution

by:
bingie earned 200 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now