Solved

Pie Chart and VB

Posted on 2003-11-13
4
294 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

706 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

12 Experts available now in Live!

Get 1:1 Help Now