?
Solved

Pie Chart and VB

Posted on 2003-11-13
4
Medium Priority
?
308 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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
Course of the Month9 days, 15 hours left to enroll

762 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