Solved

Pascal pie charts

Posted on 1997-12-01
2
508 Views
Last Modified: 2012-06-21
Can anybody tell me how to create a pie chart in pascal.  The user must enter in the numbers to be represented> Thanks.
0
Comment
Question by:Pundit
  • 2
2 Comments
 
LVL 2

Accepted Solution

by:
mitchell042997 earned 70 total points
ID: 1216934
Do you know how to do basic graphics in pascal?  You will use graph.tpu, so you will need to add:

   uses graph;

now, look in help for the command titled arc.

The basics behind drawing a pie chart are as follows.  You must first determine the probability of each of your "wedges".  For example, if you had a pie chart representing a group's hobbies, and the sample was taken from 10 people, and 4 said reading, 2 said walking, 1 said modelling, and 3 said programming, then get probabilities for all activities (3/10, for programmers, 4/10 for reading, etc.)  Now, take that decimal number, and multiply it times 2*pi.  This is the amount of radians each will take up.  If you need it in degrees, multiply each decimal by 360.  Then just do a simple loop which starts at 0 degrees or 0 radians, and steps through each activity, drawing from the current radian to the current radian plus the activities allocated radians.  Once drawn, adjust the current radian setting to the current radian setting previously, plus the current activity's alloted radians.
0
 
LVL 2

Expert Comment

by:mitchell042997
ID: 1216935
Has this been helpful?  If so, please grade the answer, else tell me what further information you need and I will gladly supply it!  :)  Happy programming...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
There's a lot of hype surrounding blockchain technology. Here's how it works and some of the novel ways it' s now being used - including for data protection.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

831 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