Solved

Pascal pie charts

Posted on 1997-12-01
2
502 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

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

Title # Comments Views Activity
Twsocket as Twsocketserver 6 1,629
TClientSocket.SendStream is slow... 2 957
FMXGrid getting check box state 5 511
TVirtualStringTree  search using TEdit 7 106
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 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

15 Experts available now in Live!

Get 1:1 Help Now